ARGB function

Requires: Direct2D.lg32

Purpose

Returns a long with an ARGB formatted color value.

Syntax

argb = ARGB(alpha|, red|, green|, blue|)

argb: 32-bit integer
alpha|, red|, green|, blue|: byte expression

Description

In contrast with GDI the Direct2D library uses ARGB formatted colors. Hexadicimal coded as AARRGGBB, representing the values of the Alpha, Red, Green and Blue channel, respectively. For example, 80FFFF00 represents 50.2% opaque (non-premultiplied) yellow. The 80 hex value, which is 128 in decimal, represents a 50.2% alpha value because 128 is approximately 50.2% of the maximum value of 255 (FF hex).

Example

'

' D2PBox sample (dpi-unaware)

'

$Library "direct2d"

Global Object Win1RT

OpenW 1, 0, 0, 320, 260, ~15

Set Win1RT = D2GetRT()

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_Paint

D2BeginDraw Win1RT, D2C_White

D2ForeColor = D2C_Brown

D2Box 20, 20, 120, 120

D2PBox 20, 20, 120, 120

' Create and select a 50% transparent fillpattern

D2Box 70, 20, 240, 120

D2DefFill ARGB(128, 0, 128, 0)

D2PBox 70, 20, 240, 120

D2EndDraw

EndSub

Remarks

The GB Direct2D library defines Direct2D ARGB color constants for many colors. The names of these ARGB color constants start with D2C_ and are formatted as D2C_Colorname.

See Also

D2Color, D2ForeColor, D2BkColor, D2RGBColor, ARGBToRGB

{Created by Sjouke Hamstra; Last updated: 04/03/2021 by James Gaite}