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 _RGBA32 function returns the 32-bit RGBA color value with the specified red, green, blue and alpha component intensities.

Syntax

color32value~& = _RGBA32(red&, green&, blue&, alpha&)

Description

Example(s)

Changing the ALPHA value to fade an image in and out using a 32 bit PNG image.


SCREEN _NEWIMAGE(600, 400, 32)

img& = _LOADIMAGE("qb64_trans.png")  'use any 24/32 bit image
'Turn off auto display
_DISPLAY

' Fade in
FOR i% = 255 TO 0 STEP -5
  _LIMIT 20                          'control fade speed 
  _PUTIMAGE (0, 0)-(600, 400), img&
  LINE (0, 0)-(600, 400), _RGBA(0, 0, 0, i%), BF 'decrease black box transparency
  _DISPLAY
NEXT

' Fade out
FOR i% = 0 TO 255 STEP 5
  _LIMIT 20                          'control fade speed 
  _PUTIMAGE (0, 0)-(600, 400), img&
  LINE (0, 0)-(600, 400), _RGBA(0, 0, 0, i%), BF 'increase black box transparency
  _DISPLAY
NEXT
END 

See Also