BlendFunc
(Created page with "= <span class="f_Header">Action</span> = Specify pixel arithmetic. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </span> = <span ...") |
|||
Line 63: | Line 63: | ||
= <span class="f_Header">Example</span> = | = <span class="f_Header">Example</span> = | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Pseudocode | ||
+ | |||
+ | ' The default blend function of (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) causes drawing | ||
+ | ' to overlay the destination using the alpha value | ||
+ | Begin_G BITMAPS | ||
+ | Vertex2II 50, 30, 31, &H47 | ||
+ | Color_A 128 | ||
+ | Vertex2II 60, 40, 31, &H47 | ||
+ | </source> [[File:Clip0096.png|center|Clip0096.png]] <source lang="bascomavr"> | ||
+ | ' A destination factor of zero means that destination pixels are not used | ||
+ | Begin_G BITMAPS | ||
+ | BlendFunc SRC_ALPHA, ZERO | ||
+ | Vertex2II 50, 30, 31, &H47 | ||
+ | Color_A 128 | ||
+ | Vertex2II 60, 40, 31, &H47 | ||
+ | </source> [[File:Clip0097.png|center|Clip0097.png]] <source lang="bascomavr"> | ||
+ | ' Using the source alpha to control how much of the destination to keep | ||
+ | Begin_G BITMAPS | ||
+ | BlendFunc ZERO, SRC_ALPHA | ||
+ | Vertex2II 60, 40, 31, &H47 | ||
+ | </source> [[File:Clip0098.png|center|Clip0098.png]] | ||
+ | |||
+ | |||
+ | |||
+ | <br/>{{Languages}} | ||
+ | |||
+ | [[Category:FT800 Commands]] |
Latest revision as of 22:14, 12 December 2014
Contents |
Action
Specify pixel arithmetic.
Syntax
BlendFunc src, dst
Remarks
src |
Specifies how the source blending factor is computed. One of ZERO, ONE, SRC_ALPHA,DST_ALPHA,ONE_MINUS_SRC_ALPHA or ONE_MINUS_DST_ALPHA. |
dst |
Specifies how the destination blending factor is computed, One of ZERO, ONE, SRC_ALPHA,DST_ALPHA,ONE_MINUS_SRC_ALPHA or ONE_MINUS_DST_ALPHA. |
The blend function controls how new color values are combined with the values already in the color buffer.
Given a pixel value source and a previous value in the color buffer destination, the computed color is:
source × src + destination × dst
for each color channel: red, green, blue and alpha.
For more details please refer to the FT800 Series Programmer Guide.PDF from FTDI.
See also
Example
' Pseudocode ' The default blend function of (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) causes drawing ' to overlay the destination using the alpha value Begin_G BITMAPS Vertex2II 50, 30, 31, &H47 Color_A 128 Vertex2II 60, 40, 31, &H47
' A destination factor of zero means that destination pixels are not used Begin_G BITMAPS BlendFunc SRC_ALPHA, ZERO Vertex2II 50, 30, 31, &H47 Color_A 128
Vertex2II 60, 40, 31, &H47
' Using the source alpha to control how much of the destination to keep Begin_G BITMAPS BlendFunc ZERO, SRC_ALPHA
Vertex2II 60, 40, 31, &H47
Languages | English |
---|