libgimpwidgets: add new macro GIMP_CAIRO_RGB24_GET_PIXEL()

which reads a pixel from a cairo image surface's data.
This commit is contained in:
Michael Natterer 2010-08-08 16:09:21 +02:00
parent 1e48f16113
commit 789cc05baf
1 changed files with 20 additions and 0 deletions

View File

@ -61,6 +61,26 @@ cairo_surface_t * gimp_cairo_surface_create_from_pixbuf (GdkPixbuf *pixbuf);
#endif
/**
* GIMP_CAIRO_RGB24_GET_PIXEL:
* @s: pointer to the source buffer
* @r: red component
* @g: green component
* @b: blue component
*
* Gets a single pixel from a Cairo image surface in %CAIRO_FORMAT_RGB24.
*
* Since: GIMP 2.8
**/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define GIMP_CAIRO_RGB24_GET_PIXEL(s, r, g, b) \
G_STMT_START { (b) = s[0]; (g) = s[1]; (r) = s[2]; } G_STMT_END
#else
#define GIMP_CAIRO_RGB24_GET_PIXEL(s, r, g, b) \
G_STMT_START { (r) = s[1]; (g) = s[2]; (b) = s[3]; } G_STMT_END
#endif
/**
* GIMP_CAIRO_ARGB32_SET_PIXEL:
* @d: pointer to the destination buffer