RGBA32: Difference between revisions
Jump to navigation
Jump to search
Code by Unseen Machine
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{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 _UNSIGNED LONG or resulting color...") |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
{{PageDescription}} | {{PageDescription}} | ||
* The value returned is a 32-bit [[_UNSIGNED]] [[LONG]] color value. | * 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.''' | * '''Return variable types must be [[_UNSIGNED]] [[LONG]] or resulting color may lose the [[_BLUE]] value.''' | ||
* {{Parameter|red&}} specifies the red component intensity from 0 to 255. | * {{Parameter|red&}} specifies the red component intensity from 0 to 255. | ||
Line 15: | Line 15: | ||
* {{Parameter|alpha&}} specifies the [[_ALPHA|''alpha'']] component transparency value from 0 (fully transparent) to 255 (opaque). | * {{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. | * Alpha or intensity values outside of the valid range of 0 to 255 are clipped. | ||
* Returns [[LONG]] 32-bit hexadecimal values from '''&H00{{ | * 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. | * 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.''' | * '''NOTE: Default 32-bit backgrounds are clear black or [[_RGBA]](0, 0, 0, 0). Use [[CLS]] to make the black opaque.''' | ||
Line 22: | Line 22: | ||
{{PageExamples}} | {{PageExamples}} | ||
''Example:'' Changing the [[ALPHA]] value to fade an image in and out using a 32 bit PNG image. | ''Example:'' Changing the [[ALPHA]] value to fade an image in and out using a 32 bit PNG image. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl | {{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(600, 400, 32) | ||
img& = {{Cl|_LOADIMAGE}}("qb64_trans.png") ' | img& = {{Cl|_LOADIMAGE}}("qb64_trans.png") 'use any 24/32 bit image | ||
'Turn off auto display | 'Turn off auto display | ||
{{Cl|_DISPLAY}} | {{Cl|_DISPLAY}} | ||
Line 31: | Line 31: | ||
' Fade in | ' Fade in | ||
{{Cl|FOR...NEXT|FOR}} i% = 255 {{Cl|TO}} 0 {{Cl|STEP}} -5 | {{Cl|FOR...NEXT|FOR}} i% = 255 {{Cl|TO}} 0 {{Cl|STEP}} -5 | ||
{{Cl|_LIMIT}} 20 'control fade speed | {{Cl|_LIMIT}} 20 'control fade speed | ||
{{Cl|_PUTIMAGE}} (0, 0)-(600, 400), img& | {{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|LINE}} (0, 0)-(600, 400), {{Cl|_RGBA}}(0, 0, 0, i%), BF 'decrease black box transparency | ||
Line 39: | Line 39: | ||
' Fade out | ' Fade out | ||
{{Cl|FOR...NEXT|FOR}} i% = 0 {{Cl|TO}} 255 {{Cl|STEP}} 5 | {{Cl|FOR...NEXT|FOR}} i% = 0 {{Cl|TO}} 255 {{Cl|STEP}} 5 | ||
{{Cl|_LIMIT}} 20 'control fade speed | {{Cl|_LIMIT}} 20 'control fade speed | ||
{{Cl|_PUTIMAGE}} (0, 0)-(600, 400), img& | {{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|LINE}} (0, 0)-(600, 400), {{Cl|_RGBA}}(0, 0, 0, i%), BF 'increase black box transparency | ||
{{Cl|_DISPLAY}} | {{Cl|_DISPLAY}} | ||
{{Cl|NEXT}} | {{Cl|NEXT}} | ||
{{Cl|END}} | {{Cl|END}} | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{ | {{Small|Code by Unseen Machine}} | ||
Line 53: | Line 53: | ||
* [[_RED32]], [[_GREEN32]], [[_BLUE32]] | * [[_RED32]], [[_GREEN32]], [[_BLUE32]] | ||
* [[HEX$ 32 Bit Values]], [[POINT]] | * [[HEX$ 32 Bit Values]], [[POINT]] | ||
* [[ | * [[SaveImage SUB]] | ||
* [http://www.w3schools.com/html/html_colornames.asp Hexadecimal Color Values] | * [http://www.w3schools.com/html/html_colornames.asp Hexadecimal Color Values] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 20:05, 5 January 2024
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
- 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.
- red& specifies the red component intensity from 0 to 255.
- green& specifies the green component intensity from 0 to 255.
- blue& specifies the blue component intensity from 0 to 255.
- alpha& 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 &H00000000 to &HFFFFFFFF with varying _ALPHA transparency.
- When LONG values are PUT to file, the ARGB values become BGRA. Use LEFT$(MKL$(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.
Examples
Example: 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
- _RGB32, _RGBA, _RGB
- _RED32, _GREEN32, _BLUE32
- HEX$ 32 Bit Values, POINT
- SaveImage SUB
- Hexadecimal Color Values