GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AG_COLOR(3) FreeBSD Library Functions Manual AG_COLOR(3)

AG_Coloragar color structure

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

The AG_Color structure describes a color in terms of , , , and components. The AG_Color structure is declared as:

typedef struct ag_color {
#if AG_MODEL == AG_LARGE
	Uint16 r,g,b,a;			/* LG (16-bit color) */
#else
	Uint8  r,g,b,a;			/* MD (8-bit color) */
#endif
} AG_Color;

The alpha component may or may not be used in a given context. A value of 0 (or AG_TRANSPARENT or AG_COLOR_FIRST) is fully transparent, while AG_OPAQUE (or AG_COLOR_LAST) is fully opaque.

void
(AG_Color *c, Uint8 r, Uint8 g, Uint8 b);


void
(AG_Color *c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);


void
(AG_Color *c, Uint16 r, Uint16 g, Uint16 b);


void
(AG_Color *c, Uint16 r, Uint16 g, Uint16 b, Uint16 a);


void
(float hue, float sat, float val, AG_Color *c);


void
(AG_Color *c, float *hue, float *sat, float *val);


void
(AG_Color *c, Uint16 hex);


void
(AG_Color *c, Uint32 hex);


void
(AG_Color *c, Uint64 hex);


void
(AG_Color *c, const char *spec, const AG_Color *parentColor);


void
(AG_Color *c);


void
(AG_Color *c);


void
(AG_Color *c);


void
(AG_Color *c, int shade);


void
(AG_Color *c, int shade);


void
(AG_Color *cx, const AG_Color *c1, const AG_Color *c2);


int
(const AG_Color *a, const AG_Color *b);

() and AG_ColorRGB_16() return an AG_Color from 8- or 16-bit red, green and blue components (with alpha set to fully opaque).

() and AG_ColorRGBA_16() return an AG_Color from 8- or 16-bit RGB and alpha components.

() maps a color in HSV space to the closest approximation in RGB space, and copies the A component as-is. The inverse operation is performed by AG_Color2HSV(). Note: H and V become increasingly lossy as S->0.

The (), AG_ColorHex32() and AG_ColorHex64() routines convert a color packed into (4-bit components), (8-bit components), or (16-bit components) into an AG_Color.

() converts a text-based color representation to an AG_Color. The following formats are allowed:

"#RGB[A]"
"#RRGGBB[AA]"
"#RRRRGGGGBBBB[AAAA]"
"r,g,b[,a]"
"rgb(r,g,b[,a])"
"rgb16(r,g,b[,a])"
"hsv(h,s,v[,a])"
"AliceBlue"

Color components may be separated by `/', ':' or ','.

A component terminating with a `%' character is interpreted as a ratio (in %) of the corresponding component of pColor (or White if pColor is NULL).

() initializes the color to fully transparent black (0,0,0,0). AG_ColorBlack() and AG_ColorWhite() initialize the respective fully opaque color.

() and AG_ColorDarken increase and decrease the overall value of c by some small increment multiplied by shade. A shade argument of 0 leaves the color value unchanged.

() traces an imaginary line in RGB color space between c1 and c2 and returns into cx the color closest to the point described by the fraction num over denom.

() returns non-zero if the two colors differ.

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

Agar 1.0 through 1.3 described colors using packed pixels in a 32-bit reference format. The AG_Color structure first appeared in Agar 1.4.0. Agar 1.6.0 introduced the AG_LARGE memory model and 48-bit "Deep Color". AG_Color2HSV(), AG_HSV2Color(), AG_ColorNone(), AG_ColorDarken(), AG_ColorLighten() and the AG_ColorInterpolate() functions appeared in 1.6.0.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.