Manipulate the gamma maps and the gamma correction of a visual
Name
ggiGetGamma, ggiSetGamma, ggiGetGammaMap, ggiSetGammaMap, ggiGammaMax : Manipulate the gamma maps and the gamma correction of a visual
Synopsis
#include <ggi/ggi.h> int ggiGetGamma(ggi_visual_t vis, ggi_float *r, ggi_float *g, ggi_float *b); int ggiSetGamma(ggi_visual_t vis, ggi_float r, ggi_float g, ggi_float b); int ggiGetGammaMap(ggi_visual_t vis, int s, int len, ggi_color *gammamap); int ggiSetGammaMap(ggi_visual_t vis, int s, int len, ggi_color *gammamap); int ggiGammaMax(ggi_visual_t vis, uint32 bitmeaning, int *max_r, int *max_w);
Description
Some modes on some hardware can use a per-channel palette to lookup the values before sending to the monitor. Generally this is used for gamma correction by filling the lookup table with a curve, hence the name "gamma map", but it could be used for other things e.g. special effects in games. Truecolor modes with gamma maps are sometimes referred to as "directcolor".
ggiSetGammaMap and ggiGetGammaMap set or get the gamma map, for len colors starting at s. In the event that there are more map entries for some channels than others, values for the upper indices of the map in the shallow channels are ignored on write, and undefined on read.
The ggiGammaMax function is used in order to find out how many readable and writeable entries are in the map (returned in the integers referenced by max_w and max_r). This must be done once for each channel. The parameter bitmeaning should be set to the bit meaning (e.g. GGI_BM_TYPE_COLOR | GGI_BM_SUB_BLUE) of the channel of which you are inquiring. If ggiGammaMax returns an ggi-error(3), you cannot set the gamma map on this visual. If ggiGammaMax succeeds, but max_w is -1 on return, this means that ggiSetGamma will work, but that ggiSetGammaMap will not.
ggiSetGamma and ggiGetGamma sets or gets the gamma correction for the visual according to the usual curve associated with the given values for each channel, which should be positive.
Return value
All five functions 0 for OK, otherwise an ggi-error(3) code.