Top |
typedef | GrxColor |
enum | GrxColorMode |
#define | GRX_COLOR_VALUE_MASK |
#define | GRX_COLOR_MODE_MASK |
#define | GRX_COLOR_NONE |
enum | GrxColorPaletteType |
#define | GRX_COLOR_BLACK |
#define | GRX_COLOR_WHITE |
enum | GrxEgaColorIndex |
typedef | GrxColorCell |
The library supports two models for color management. In the 'indirect' (or color table) model, color values are indices to a color table. The color table slots will be allocated with the highest resolution supported by the hardware with respect to the component color intensities. In the 'direct' (or RGB) model, color values map directly into component color intensities with non-overlapping bitfields of the color index representing the component colors.
The color table model is supported up to 256 colors. The RGB model is supported for 256 colors and up.
In the RGB model the color index map to component color intensities depend on the video mode set, so it can't be assumed the component color bitfields.
GrxColor grx_color_get (guint8 r
,guint8 g
,guint8 b
);
Gets a color based on the RGB value.
A new color is allocated in the color table if needed.
The color should be released with grx_color_put()
when it is no longer used.
GrxColor grx_color_get_inline (guint8 r
,guint8 g
,guint8 b
);
Gets a color in the color table based on the RGB value.
This is the same as grx_color_get()
, but inlined in C code.
[skip]
GrxColor
grx_color_get2 (guint32 hcolor
);
Gets a color in the color table based on hcolor
.
A new color is allocated in the color table if needed.
The color should be released with grx_color_put()
when it is no longer used.
GrxColor
grx_color_get2_inline (guint32 hcolor
);
Gets a color in the color table based on hcolor
.
This is the same as grx_color_get2()
, but inlined in C code.
[skip]
void
grx_color_put (GrxColor c
);
Releases a color that was obtained by grx_color_get()
and friends.
This has no effect in RGB or grayscale graphics modes.
GrxColor grx_color_lookup (GArray *table
,guint index
);
Looks up a color in the color table.
GrxColor
grx_color_get_value (GrxColor c
);
Gets the color component of a color value.
GrxColorMode
grx_color_get_mode (GrxColor c
);
Gets the GrxColorMode component of a color value.
GrxColor
grx_color_to_write_mode (GrxColor c
);
Sets the color to GRX_COLOR_MODE_WRITE.
GrxColor
grx_color_to_xor_mode (GrxColor c
);
Sets the color to GRX_COLOR_MODE_XOR.
GrxColor
grx_color_to_or_mode (GrxColor c
);
Sets the color to GRX_COLOR_MODE_OR.
GrxColor
grx_color_to_and_mode (GrxColor c
);
Sets the color to GRX_COLOR_MODE_AND.
GrxColor
grx_color_to_image_mode (GrxColor c
);
Sets the color to GRX_COLOR_MODE_IMAGE.
GrxColor
grx_color_get_black (void
);
Gets the color value for black.
This is guaranteed to be 0. In C code, you can use GRX_COLOR_BLACK for short.
GrxColor
grx_color_get_white (void
);
Gets the color value for white.
In C code, you can use GRX_COLOR_WHITE for short.
GrxColor grx_color_build_rgb (guint8 r
,guint8 g
,guint8 b
);
Build a RGB color value based on the current graphics mode.
This will not allocate a new color even if a color table is being used.
GrxColor grx_color_build_rgb_round (guint8 r
,guint8 g
,guint8 b
);
Build a RGB color value based on the current graphics mode.
This function is similar to grx_color_build_rgb()
, but will limit
the RGB components to 255 during the scaling.
This will not allocate a new color even if a color table is being used.
GrxColor grx_color_build_grayscale (guint8 r
,guint8 g
,guint8 b
);
Build a grayscale color value based on the current graphics mode.
This will not allocate a new color even if a color table is being used.
guint8
grx_color_get_red (GrxColor c
);
Gets the red component of a color value.
This function only works on RGB colors and not color table values. For color
table values, use grx_color_query()
instead.
guint8
grx_color_get_green (GrxColor c
);
Gets the green component of a color value.
This function only works on RGB colors and not color table values. For color
table values, use grx_color_query()
instead.
guint8
grx_color_get_blue (GrxColor c
);
Gets the blue component of a color value.
This function only works on RGB colors and not color table values. For color
table values, use grx_color_query()
instead.
void grx_color_query (GrxColor c
,guint8 *r
,guint8 *g
,guint8 *b
);
Gets the RGB color components of a color.
void grx_color_query_inline (GrxColor c
,guint8 *r
,guint8 *g
,guint8 *b
);
Gets the RGB color components of a color.
This is the same as grx_color_query()
, but inlined in C code.
[skip]
void grx_color_query2 (GrxColor c
,guint32 *hcolor
);
Gets the RGB color components of a color.
void grx_color_query2_inline (GrxColor c
,guint32 *hcolor
);
Gets the RGB color components of a color.
This is the same as grx_color_query2()
, but inlined in C code.
[skip]
GrxColor *
grx_color_get_ega_colors (void
);
Gets an array of the 16 classic EGA colors. Use GrxEgaColorIndex to determine the color at each index of the array.
The the colors and the array itself must not be freed.
GrxColorCell
grx_color_cell_get (void
);
Allocates a new color that can be changed with grx_color_cell_set()
.
The color must be freed with grx_color_cell_put()
.
RGB and grayscale graphics modes will always return GRX_COLOR_NONE.
void grx_color_cell_set (GrxColorCell c
,guint8 r
,guint8 g
,guint8 b
);
Sets/changes the color of a cell after it was allocated.
c |
a color that was allocated by |
|
r |
the red component |
|
g |
the green component |
|
b |
the blue component |
void
grx_color_cell_put (GrxColorCell c
);
Releases a cell that was obtained with grx_color_cell_get()
.
void
grx_color_info_reset_colors (void
);
Frees all colors (except for black and white).
If grx_color_info_set_palette_type_rgb()
was called, this will also change
the color system back to using a color table.
void
grx_color_info_set_palette_type_rgb (void
);
Changes the graphics mode to RGB color values instead of using a color table.
Initially, graphics modes with 256 colors or less use a color table. Currently, this function only works for modes with 16 or 256 colors.
This has no effect if the color mode is already RGB or if it is grayscale.
GrxColorPaletteType
grx_color_info_get_palette_type (void
);
Gets the current color palette type.
void
grx_color_info_refresh_colors (void
);
Reloads the currently allocated color values into the video hardware.
This function is not needed in typical applications, unless the display adapter is programmed directly by the application.
gint
grx_color_info_n_colors (void
);
Gets the number of colors supported by the current graphics mode.
gint
grx_color_info_n_free_colors (void
);
Gets the number of unallocated colors remaining for the current graphics mode.
For RGB graphics modes, this will always return 0.
typedef guint32 GrxColor;
32-bit integer for storing color information.
The lower 24 bits are the actual color value and the upper 8 bits are the GrxColorMode.
Values added to a GrxColor to affect how the color is used in drawing operations.
Overwrite any existing color |
||
XOR this color with the existing color |
||
OR this color with the existing color |
||
AND this color with the existing color |
||
Overwrite existing color unless this color is GRX_COLOR_NONE. Only works with bitblt operations. |
#define GRX_COLOR_VALUE_MASK 0x00ffffffUL
Used to get the color portion of a GrxColor.
#define GRX_COLOR_MODE_MASK 0xff000000UL
Used to get the GrxColorMode portion of a GrxColor.
#define GRX_COLOR_NONE ((GrxColor)(GRX_COLOR_MODE_XOR | 0))
Used to indicate transparency in bitblt operations.
See GrxColorMode.
#define GRX_COLOR_BLACK grx_color_get_black()
Convenience macro for grx_color_get_black()
.
#define GRX_COLOR_WHITE grx_color_get_white()
Convenience macro for grx_color_get_white()
.
Indexes for use with the array returned by grx_color_get_ega_colors()
.