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 _PIXELSIZE function returns the color depth (Bits Per Pixel) of an image as 0 for text, 1 for 1 to 8 BPP or 4 for 32 bit.

Syntax

pixelSize% = _PIXELSIZE[(imageHandle&)]

Description

Example(s)

Snippet: Saving Images for later program use. Handle values could be saved to an array.

  
handle1& = _Getimage(sx1, sy1, sx2, sy2, sourcehandle&) ' function call

FUNCTION GetImage& (sx1, sy1, sx2, sy2, sourcehandle&)
bytespp = _PIXELSIZE(sourcehandle&)
IF bytespp = 4 THEN Pal = 32 ELSE IF bytespp = 1 THEN Pal = 256 ELSE EXIT FUNCTION
h& = _NEWIMAGE(ABS(sx2 - sx1) + 1, ABS(sy2 - sy1) + 1, Pal)
_PUTIMAGE (0, 0), sourcehandle&, h&, (sx1, sy1)-(sx2, sy2) 'image is not displayed
GetImage& = h&
END FUNCTION 

More examples

See Also