The gdk-pixbuf Library | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gdk-pixbuf/gdk-pixbuf.h> struct XlibRgbCmap; enum XlibRgbDither; void xlib_rgb_init ( |
The XlibRGB set of functions is a port of the GdkRGB library to use plain Xlib and X drawables. You can use these functions to render RGB buffers into drawables very quickly with high-quality dithering.
struct XlibRgbCmap { unsigned int colors[256]; unsigned char lut[256]; /* for 8-bit modes */ }; |
FIXME: Describe this.
unsigned int colors[256] | FIXME. |
unsigned char lut[256] | FIXME. |
typedef enum { XLIB_RGB_DITHER_NONE, XLIB_RGB_DITHER_NORMAL, XLIB_RGB_DITHER_MAX } XlibRgbDither; |
These values are used to specify which dithering method should be used. XLIB_RGB_DITHER_NONE will use no dithering and simply map the colors in an RGB buffer to the closest colors that the display can provide. XLIB_RGB_DITHER_NORMAL will provide dithering only on pseudocolor displays. XLIB_RGB_DITHER_MAX will provide dithering on pseudocolor and 16-bit truecolor or “high color” displays.
XLIB_RGB_DITHER_NONE | Specifies no dithering. |
XLIB_RGB_DITHER_NORMAL | Specifies dithering only on pseudocolor displays. |
XLIB_RGB_DITHER_MAX | Specifies dithering on high color displays. |
void xlib_rgb_init ( |
Initializes the XlibRGB machinery with the default depth. If you use this function XlibRGB will automatically pick the best visual available on your display. This function or xlib_rgb_init_with_depth() must be called before using any of the other functions in XlibRGB.
display : | X Display to use. |
screen : | Screen to use. |
void xlib_rgb_init_with_depth ( |
Initializes the XlibRGB machinery with a particular depth you specify, instead of automatically picking the best depth in the display. This function or xlib_rgb_init() must be called before using any of the other functions in XlibRGB.
display : | X display to use. |
screen : | Screen to use. |
prefDepth : | Visual depth to use for color substitution tables. This must be one of the supported visual depths in the specified display. |
void xlib_rgb_gc_set_foreground ( |
This is a convenience function to set the background of a GC from an RGB
triplet. It calls
gc : | A graphic context. |
rgb : | 32-bit representation of an RGB value, specified as 0x00RRGGBB. |
void xlib_draw_rgb_image ( |
Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB sequence of 8-bit values. This function does not let you specify dither offsets; applications that need to render partial regions of a buffer to build the final image should use xlib_draw_rgb_image_dithalign() instead.
drawable : | Destination drawable. |
gc : | A graphic context. |
x : | Leftmost coordinate of the destination rectangle. |
y : | Upper coordinate of the destination rectangle. |
width : | Width of the destination rectangle, in pixels. |
height : | Height of the destination rectangle, in pixels. |
dith : | Dithering method to use. |
rgb_buf : | Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. |
rowstride : | Offset between pixel rows in the RGB buffer, in bytes. |
void xlib_draw_rgb_image_dithalign ( |
Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB sequence of 8-bit values. This function lets you specify a pair of dither offsets. It should be used when you need to render regions of an RGB buffer separately to form the final image; the dither offsets let you align the dither mask appropriately.
drawable : | Destination drawable. |
gc : | A graphic context. |
x : | Leftmost coordinate of the destination rectangle. |
y : | Upper coordinate of the destination rectangle. |
width : | Width of the destination rectangle, in pixels. |
height : | Height of the destination rectangle, in pixels. |
dith : | Dithering method to use. |
rgb_buf : | Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. |
rowstride : | Offset between pixel rows in the RGB buffer, in bytes. |
xdith : | X offset for the dither mask. |
ydith : | Y offset for the dither mask. |
void xlib_draw_rgb_32_image ( |
This function is analogous to xlib_draw_rgb_image(), but it lets you use 32-bit RGB buffers with pixels specified as 0xRRGGBB00. The least-significant 8 bits are actually discarded. This function can lead to faster results than xlib_draw_rgb_image() since the pixels are aligned on 32-bit boundaries.
drawable : | Destination drawable. |
gc : | A graphic context. |
x : | Leftmost coordinate of the destination rectangle. |
y : | Upper coordinate of the destination rectangle. |
width : | Width of the destination rectangle, in pixels. |
height : | Height of the destination rectangle, in pixels. |
dith : | Dithering method to use. |
buf : | Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. |
rowstride : | Offset between pixel rows in the RGB buffer, in bytes. |
void xlib_draw_gray_image ( |
Renders a grayscale buffer to a drawable. Pixels are specified as 8-bit intensity values. An image will thus look as a GGGGGG sequence of 8-bit values.
drawable : | Destination drawable. |
gc : | A graphic context. |
x : | Leftmost coordinate of the destination rectangle. |
y : | Upper coordinate of the destination rectangle. |
width : | Width of the destination rectangle, in pixels. |
height : | Height of thd destination rectangle, in pixels. |
dith : | Dithering method to use. |
buf : | Pointer to the pixel in the grayscale buffer that corresponds to the upper-left corner of the rectangular region to render. |
rowstride : | Offset between pixel rows in the grayscale buffer, in pixels. |
XlibRgbCmap* xlib_rgb_cmap_new ( |
FIXME
colors : | FIXME |
n_colors : | FIXME |
Returns : | FIXME |
void xlib_rgb_cmap_free (XlibRgbCmap *cmap); |
Frees an XlibRGB colormap.
cmap : | An XlibRGB colormap. |
void xlib_draw_indexed_image ( |
FIXME
drawable : | FIXME |
gc : | FIXME |
x : | FIXME |
y : | FIXME |
width : | FIXME |
height : | FIXME |
dith : | FIXME |
buf : | FIXME |
rowstride : | FIXME |
cmap : | FIXME |
|
Queries whether XlibRGB supports dithering for its chosen visual.
Returns : | TRUE if dithering can be performed for the visual that XlibRGB is using, FALSE otherwise. |
|
Queries the X colormap that XlibRGB is using.
Returns : | An X colormap. |
|
Queries the visual that XlibRGB is using.
Returns : | An X visual. |
|
Queries the visual info structure for the visual that XlibRGB is using.
Returns : | An XVisualInfo structure. |
int xlib_rgb_get_depth (void); |
Queries the depth of the visual that XlibRGB is using.
Returns : | Bit depth. |
|
Queries the X display that XlibRGB is using.
Returns : | An X display. |
<<< Previous Page | Home | Up | Next Page >>> |
X Drawables to Pixbufs | Porting applications from Imlib to gdk-pixbuf |