mirror of https://github.com/GNOME/gimp.git
Use the Quartz core graphics API to implement gimp_pick_button_pick when building with GDK Quartz.
Signed-off-by: Clayton Walker <clayton.m.walker@gmail.com>
This commit is contained in:
parent
c15f9799c1
commit
e6ed0a4c50
|
@ -35,6 +35,9 @@
|
|||
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SECTION: gimppickbutton
|
||||
|
@ -354,6 +357,7 @@ gimp_pick_button_pick (GdkScreen *screen,
|
|||
gint y_root,
|
||||
GimpPickButton *button)
|
||||
{
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
GdkWindow *root_window = gdk_screen_get_root_window (screen);
|
||||
cairo_surface_t *image;
|
||||
cairo_t *cr;
|
||||
|
@ -377,5 +381,25 @@ gimp_pick_button_pick (GdkScreen *screen,
|
|||
|
||||
gimp_rgba_set_uchar (&rgb, color[0], color[1], color[2], 1.0);
|
||||
|
||||
#else /* GDK_WINDOWING_QUARTZ */
|
||||
CGImageRef root_image_ref;
|
||||
CFDataRef pixel_data;
|
||||
const guchar *data;
|
||||
GimpRGB rgb;
|
||||
|
||||
CGRect rect = CGRectMake (x_root, y_root, 1, 1);
|
||||
root_image_ref = CGWindowListCreateImage (rect,
|
||||
kCGWindowListOptionOnScreenOnly,
|
||||
kCGNullWindowID,
|
||||
kCGWindowImageDefault);
|
||||
pixel_data = CGDataProviderCopyData(CGImageGetDataProvider(root_image_ref));
|
||||
data = CFDataGetBytePtr(pixel_data);
|
||||
|
||||
gimp_rgba_set_uchar (&rgb, data[2], data[1], data[0], 1.0);
|
||||
|
||||
CGImageRelease (root_image_ref);
|
||||
CFRelease (pixel_data);
|
||||
#endif /* GDK_WINDOWING_QUARTZ */
|
||||
|
||||
g_signal_emit (button, pick_button_signals[COLOR_PICKED], 0, &rgb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue