Share via


GDI Plus Color Foundation Class

The gpColor class encapsulates a GDI+ color, consisting of 4 positive integers (each ranging from 0 to 255) for red, green, blue and alpha components.

Category Reporting

Default Catalog

Visual FoxPro Catalog\Foundation Classes\Output\GDIplus

Class

gpColor

Base Class

Custom

Class Library

_GDIPLUS.vcx

Parent Class

gpBase (GDI Plus Base Foundation Class)

Remarks

The following table lists public properties and methods added by this class to its parent class, gpBase. It also implements the Clone and Init methods.

Values listed as ARGB type in the table are composite colors represented in GDI+ native format. Bits 24-31 of these values hold the color's alpha component, bits 16-23 hold the red component, bits 8-15 hold green, and bits 0-7 hold blue.

Properties and methods Description

Alpha Property

Alpha (transparency) component of a color, with legal values ranging from 0 to 255.

Default: 0

Remarks: The value 0 represents complete transparency and the value 255 represents complete opacity.

ARGB Property

Color in native GDI+ (alpha,red,green,blue) format. The underlying GDI+ representation is a 32-bit signed integer, so legal values range from -2^31 to (2^31-1).

Default: 0

Blue Property

Blue component of a color, with legal values ranging from 0 to 255.

Default: 0

Clone Method

Clones a color object.

Syntax: ? THIS.Clone(toColor)

Return Values: Logical, representing success or failure.

Parameters: 

toColor, required, the gpColor object to clone.

FoxRGB Property

Color in Visual FoxPro RGB format, opaque with bits 0-7 representing red, bits 8-15 representing green, and bits 16-23 representing blue.

Default: 0

Green Property

Green component of a color, with legal values ranging from 0 to 255.

Default: 0

Init Method

Constructs a color value during initialization if passed appropriate arguments.

Syntax: CREATEOBJECT("gpColor"[, tnRedOrARGB[, tnGreen[, tnBlue[, tnAlpha]]]])

Return Values: Logical, representing success or failure. If the method fails, the object does not instantiate.

Parameters: 

tnRedOrARGB, required if immediate initialization of the color value is requested. An integer representing either the red component of the color value or the full ARGB-type composite color value.

tnGreen, optional, an integer representing the green component of the color value.

tnBlue, optional, an integer representing the blue component of the color value.

tnAlpha, optional, an integer representing the alpha component of the color value. The default is 255, or completely opaque.

Red Property

Red component of a color, with legal values ranging from 0 to 255.

Default: 0

Set Method

Set a color value using separate Red,Green,Blue, and Alpha components.

Syntax: THIS.Set(tnRed, tnGreen, tnBlue[, tnAlpha])

Return Values: None.

Parameters: 

tnRed, required, an integer representing the red component of the color value.

tnGreen, required, an integer representing the green component of the color value.

tnBlue, required, an integer representing the blue component of the color value.

tnAlpha, optional, an integer representing the alpha component of the color value. The default is 255, or completely opaque.

See Also

Reference

Visual FoxPro Foundation Classes A-Z
GDI Plus API Wrapper Foundation Classes

Concepts

Guidelines for Using Visual FoxPro Foundation Classes