mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-31 14:40:15 +00:00
59 lines
No EOL
2.7 KiB
Text
59 lines
No EOL
2.7 KiB
Text
{{DISPLAYTITLE:_RGBA32}}
|
|
The [[_RGBA32]] function returns the 32-bit ''RGBA'' color value with the specified red, green, blue and alpha component intensities.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|color32value~&}} = [[_RGBA32]]({{Parameter|red&}}, {{Parameter|green&}}, {{Parameter|blue&}}, {{Parameter|alpha&}})
|
|
|
|
|
|
{{PageDescription}}
|
|
* The value returned is a 32-bit [[_UNSIGNED]] [[LONG]] color value.
|
|
* '''Return variable types must be [[LONG]] or resulting color may lose the [[_BLUE]] value.'''
|
|
* {{Parameter|red&}} specifies the red component intensity from 0 to 255.
|
|
* {{Parameter|green&}} specifies the green component intensity from 0 to 255.
|
|
* {{Parameter|blue&}} specifies the blue component intensity from 0 to 255.
|
|
* {{Parameter|alpha&}} specifies the [[_ALPHA|''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{{text|00|red}}{{text|00|green}}{{text|00|blue}}''' to '''&HFF{{text|FF|red}}{{text|FF|green}}{{text|FF|blue}}''' with varying [[_ALPHA]] transparency.
|
|
* When [[LONG]] values are [[PUT]] to file, the ARGB values become BGRA. Use [[LEFT$]]([[MKL$]]({{Parameter|color32value~&}}), 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.'''
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Changing the [[ALPHA]] value to fade an image in and out using a 32 bit PNG image.
|
|
{{CodeStart}} '' ''
|
|
{{Cl|SCREEN (statement)|SCREEN}} {{Cl|_NEWIMAGE}}(600, 400, 32)
|
|
|
|
img& = {{Cl|_LOADIMAGE}}("qb64_trans.png") 'from http://www.qb64.net/qb64_trans.png (or use any 24/32 bit image)
|
|
'Turn off auto display
|
|
{{Cl|_DISPLAY}}
|
|
|
|
' Fade in
|
|
{{Cl|FOR...NEXT|FOR}} i% = 255 {{Cl|TO}} 0 {{Cl|STEP}} -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}}
|
|
{{Cl|NEXT}}
|
|
|
|
' Fade out
|
|
{{Cl|FOR...NEXT|FOR}} i% = 0 {{Cl|TO}} 255 {{Cl|STEP}} 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}}
|
|
{{Cl|NEXT}}
|
|
{{Cl|END}} '' ''
|
|
{{CodeEnd}}
|
|
{{small|Code by Unseen Machine}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_RGB32]], [[_RGBA]], [[_RGB]]
|
|
* [[_RED32]], [[_GREEN32]], [[_BLUE32]]
|
|
* [[HEX$ 32 Bit Values]], [[POINT]]
|
|
* [[SAVEIMAGE]]
|
|
* [http://www.w3schools.com/html/html_colornames.asp Hexadecimal Color Values]
|
|
|
|
|
|
{{PageNavigation}} |