[gimp] libgimpwidgets: add new macro GIMP_CAIRO_RGB24_GET_PIXEL()



commit 789cc05baf1430eb97f79184cbd252bc65c15893
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 8 16:09:21 2010 +0200

    libgimpwidgets: add new macro GIMP_CAIRO_RGB24_GET_PIXEL()
    
    which reads a pixel from a cairo image surface's data.

 libgimpwidgets/gimpcairo-utils.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libgimpwidgets/gimpcairo-utils.h b/libgimpwidgets/gimpcairo-utils.h
index 692ba69..79ebfd3 100644
--- a/libgimpwidgets/gimpcairo-utils.h
+++ b/libgimpwidgets/gimpcairo-utils.h
@@ -62,6 +62,26 @@ cairo_surface_t * gimp_cairo_surface_create_from_pixbuf (GdkPixbuf     *pixbuf);
 
 
 /**
+ * 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
  * @r: red component, not pre-multiplied



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]