Difference between revisions of "ALPHA"

From QB64 Wiki
Jump to navigation Jump to search
imported>Stylin
(added bad palette index info)
imported>Clippy
m (descr)
Line 14: Line 14:
 
* If the image specified by {{Parameter|imageHandle&}} does not use a palette, {{Parameter|c&}} is the color value used to retrieve the alpha level.
 
* If the image specified by {{Parameter|imageHandle&}} does not use a palette, {{Parameter|c&}} is the color value used to retrieve the alpha level.
 
* If {{Parameter|imageHandle&}} is an invalid handle, an [[ERROR Codes|illegal function call]] error is thrown.
 
* If {{Parameter|imageHandle&}} is an invalid handle, an [[ERROR Codes|illegal function call]] error is thrown.
 +
*_RED32, _GREEN32, _BLUE32 & _ALPHA32 are all equivalent to _RED, _GREEN, _BLUE & _ALPHA but they are highly optimized and only accept a 32-bit color (B8:G8:R8:A8). Using these in your code (as appose to dividing then ANDing 32-bit color values manually) makes your code easy to read too.
 +
  
  

Revision as of 00:25, 15 January 2010

The _ALPHA function returns the alpha channel level of a color value.


Syntax

result& = _ALPHA(c&[, imageHandle&])


Description

  • If imageHandle& is omitted, it is assumed to be the current write page.
  • If the image specified by imageHandle& uses a palette, c& is the palette index of the color value used to retrieve the alpha level.
    • Color values that match the clear color set by _CLEARCOLOR have an alpha level of 0 (zero).
    • Color values that don't match the clear color have an alpha level of 255.
    • If c& is outside the range 0 (zero) to 255, an illegal function call error is thrown.
  • If the image specified by imageHandle& does not use a palette, c& is the color value used to retrieve the alpha level.
  • If imageHandle& is an invalid handle, an illegal function call error is thrown.
  • _RED32, _GREEN32, _BLUE32 & _ALPHA32 are all equivalent to _RED, _GREEN, _BLUE & _ALPHA but they are highly optimized and only accept a 32-bit color (B8:G8:R8:A8). Using these in your code (as appose to dividing then ANDing 32-bit color values manually) makes your code easy to read too.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page