QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The CLS statement clears the _DEST.

Syntax

CLS [method%] [, bgColor&]

Parameter(s)

Description

Example(s)

Printing black text on a white background in QB64.


SCREEN 12
CLS , 15
_PRINTMODE  _KEEPBACKGROUND        'keeps the text background visible
COLOR 0: PRINT "This is black text on a white background!"
K$ = INPUT$(1)

Explanation: _PRINTMODE can be used with PRINT or _PRINTSTRING to make the text or the text background transparent.

You don’t need to do anything special to use a .PNG image with alpha/transparency. Here’s a simple example:


SCREEN _NEWIMAGE(640, 480, 32)
CLS , _RGB(0, 255, 0)
i = _LOADIMAGE(**"qb64_trans.png"**) 'see note below examples to get the image 
_PUTIMAGE (0, 0), i 'places image at upper left corner of window w/o stretching it 


Explanation: When QB64 loads a .PNG file containing a transparent color, that color will be properly treated as transparent when _PUTIMAGE is used to put it onto another image. You can use a .PNG file containing transparency information in a 256-color screen mode in QB64. CLS sets the _CLEARCOLOR setting using _RGB.

See Also