Skip to content

$SCREENHIDE

github-actions[bot] edited this page Jun 16, 2022 · 5 revisions

The _RGBA32 function returns the 32-bit RGBA color value with the specified red, green, blue and alpha component intensities.

= _RGBA32(, , , )
  • The value returned is a 32-bit _UNSIGNED LONG color value.
  • Return variable types must be _UNSIGNED LONG or resulting color may lose the _BLUE value.
  • specifies the red component intensity from 0 to 255.
  • specifies the green component intensity from 0 to 255.
  • specifies the blue component intensity from 0 to 255.
  • specifies the ''alpha'' component transparency value from 0 (fully transparent) to 255 (opaque).
  • Alpha or intensity values outside of the valid range of 0 to 255 are clipped.
  • Returns LONG 32-bit hexadecimal values from &H00 to &HFF with varying _ALPHA transparency.
  • When LONG values are PUT to file, the ARGB values become BGRA. Use LEFT$(MKL$(), 3) to place 3 colors.
  • NOTE: Default 32-bit backgrounds are clear black or _RGBA(0, 0, 0, 0). Use CLS to make the black opaque.
Example: Changing the ALPHA value to fade an image in and out using a 32 bit PNG image. (600, 400, 32)

img& = ("qb64_trans.png") 'from http://www.qb64.org/images/qb64bee.png (or use any 24/32 bit image) 'Turn off auto display

' Fade in i% = 255 0 -5

  {{Cl|_LIMIT}} 20                          'control fade speed 
  {{Cl|_PUTIMAGE}} (0, 0)-(600, 400), img&
  {{Cl|LINE}} (0, 0)-(600, 400), {{Cl|_RGBA}}(0, 0, 0, i%), BF 'decrease black box transparency
  {{Cl|_DISPLAY}}

' Fade out i% = 0 255 5

  {{Cl|_LIMIT}} 20                          'control fade speed 
  {{Cl|_PUTIMAGE}} (0, 0)-(600, 400), img&
  {{Cl|LINE}} (0, 0)-(600, 400), {{Cl|_RGBA}}(0, 0, 0, i%), BF 'increase black box transparency
  {{Cl|_DISPLAY}}

Clone this wiki locally