Agar

<-- Back to AG_Intro.3

SYNOPSIS

#include <agar/core.h>
#include <agar/gui.h>

DESCRIPTION

Many functions in Agar accept AG_Color parameters. This structure describes a color in terms of its red, green and blue and alpha components:
typedef struct ag_color {
	Uint8 r, g, b, a;
} AG_Color;

The alpha component may or may not be used in a particular context; a value of 0 is fully transparent and 255 is fully opaque.

INTERFACE


AG_Color AG_ColorRGB (Uint8 r, Uint8 g, Uint8 b)

AG_Color AG_ColorRGBA (Uint8 r, Uint8 g, Uint8 b, Uint8 a)

AG_Color AG_ColorHex (Uint32 hex)

AG_Color AG_ColorFromString (const char *spec, const AG_Color *parentColor)

int AG_ColorCompare (AG_Color a, AG_Color b)


The AG_ColorRGB() routine returns an AG_Color from the given red, green and blue components. The alpha component is initialized to 255 (opaque).

AG_ColorRGBA() accepts an explicit alpha component.

AG_ColorHex() returns an AG_Color structure from an argument of the form 0xRRGGBBAA.

The AG_ColorFromString() function converts a text-based color representation to an AG_Color. The following formats are allowed:
	"#RRGGBB"
	"r:g:b[:a]"
	"r,g,b[,a]"
	"rgb(r,g,b[,a])"
	"hsv(h,s,v[,a])"

If components are given with a terminating "%" character, they are interpreted as a percentage of the corresponding component in parentColor (assuming the argument is non-NULL).

The AG_ColorCompare() function returns non-zero if the two given colors differ.

SEE ALSO

AG_Intro(3), AG_MapColorRGB(3), AG_MapColorRGBA(3), AG_MapPixelRGB(3), AG_MapPixelRGBA(3), AG_Widget(3)

HISTORY

Colors in Agar were originally described as 32-bit packed pixel values. This was replaced by the AG_Color structure in Agar 1.4.

Csoft.net ElectronTubeStore.com