2002-11-04 22:56:41 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimppickbutton.c
|
|
|
|
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2004-02-08 15:47:20 +00:00
|
|
|
* based on gtk+/gtk/gtkcolorsel.c
|
2002-11-04 22:56:41 +00:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-17 22:28:01 +00:00
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2002-11-04 22:56:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2012-05-03 03:36:22 +02:00
|
|
|
#include <gegl.h>
|
2002-11-04 22:56:41 +00:00
|
|
|
#include <gtk/gtk.h>
|
2012-03-30 15:08:54 +02:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
|
|
|
|
#include "gimpwidgetstypes.h"
|
|
|
|
|
2010-08-08 16:10:14 +02:00
|
|
|
#include "gimpcairo-utils.h"
|
2002-11-04 22:56:41 +00:00
|
|
|
#include "gimphelpui.h"
|
|
|
|
#include "gimppickbutton.h"
|
|
|
|
#include "gimpstock.h"
|
|
|
|
|
2015-04-14 22:55:10 +02:00
|
|
|
#include "cursors/gimp-color-picker-cursors.c"
|
2010-09-13 02:16:18 +02:00
|
|
|
|
2002-11-04 22:56:41 +00:00
|
|
|
#include "libgimp/libgimp-intl.h"
|
|
|
|
|
2012-05-28 07:36:36 -07:00
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
#endif
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2010-07-05 18:01:28 +02:00
|
|
|
/**
|
|
|
|
* SECTION: gimppickbutton
|
|
|
|
* @title: GimpPickButton
|
|
|
|
* @short_description: Widget to pick a color from screen.
|
|
|
|
*
|
|
|
|
* #GimpPickButton is a specialized button. When clicked, it changes
|
|
|
|
* the cursor to a color-picker pipette and allows the user to pick a
|
|
|
|
* color from any point on the screen.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2002-11-04 22:56:41 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
COLOR_PICKED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-10-15 02:34:29 +02:00
|
|
|
static void gimp_pick_button_dispose (GObject *object);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
static void gimp_pick_button_clicked (GtkButton *button);
|
|
|
|
|
|
|
|
static gboolean gimp_pick_button_mouse_press (GtkWidget *invisible,
|
|
|
|
GdkEventButton *event,
|
|
|
|
GimpPickButton *button);
|
|
|
|
static gboolean gimp_pick_button_key_press (GtkWidget *invisible,
|
|
|
|
GdkEventKey *event,
|
|
|
|
GimpPickButton *button);
|
|
|
|
static gboolean gimp_pick_button_mouse_motion (GtkWidget *invisible,
|
|
|
|
GdkEventMotion *event,
|
|
|
|
GimpPickButton *button);
|
|
|
|
static gboolean gimp_pick_button_mouse_release (GtkWidget *invisible,
|
|
|
|
GdkEventButton *event,
|
|
|
|
GimpPickButton *button);
|
|
|
|
static void gimp_pick_button_shutdown (GimpPickButton *button);
|
2003-08-18 23:21:44 +00:00
|
|
|
static void gimp_pick_button_pick (GdkScreen *screen,
|
2002-11-04 22:56:41 +00:00
|
|
|
gint x_root,
|
|
|
|
gint y_root,
|
|
|
|
GimpPickButton *button);
|
|
|
|
|
|
|
|
|
2006-05-15 09:46:31 +00:00
|
|
|
G_DEFINE_TYPE (GimpPickButton, gimp_pick_button, GTK_TYPE_BUTTON)
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2005-12-20 20:35:23 +00:00
|
|
|
#define parent_class gimp_pick_button_parent_class
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2005-12-20 20:35:23 +00:00
|
|
|
static guint pick_button_signals[LAST_SIGNAL] = { 0 };
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pick_button_class_init (GimpPickButtonClass* klass)
|
|
|
|
{
|
2010-10-15 02:34:29 +02:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2004-07-13 14:55:16 +00:00
|
|
|
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2010-07-05 18:01:28 +02:00
|
|
|
/**
|
|
|
|
* GimpPickButton::color-picked:
|
|
|
|
* @gimppickbutton: the object which received the signal.
|
|
|
|
* @arg1: pointer to a #GimpRGB structure that holds the picked color
|
|
|
|
*
|
|
|
|
* This signal is emitted when the user has picked a color.
|
|
|
|
**/
|
2003-10-29 20:57:21 +00:00
|
|
|
pick_button_signals[COLOR_PICKED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("color-picked",
|
2006-04-12 10:53:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpPickButtonClass, color_picked),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__POINTER,
|
|
|
|
G_TYPE_NONE, 1,
|
2002-11-04 22:56:41 +00:00
|
|
|
G_TYPE_POINTER);
|
|
|
|
|
2010-10-15 02:34:29 +02:00
|
|
|
object_class->dispose = gimp_pick_button_dispose;
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
button_class->clicked = gimp_pick_button_clicked;
|
|
|
|
|
|
|
|
klass->color_picked = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pick_button_init (GimpPickButton *button)
|
|
|
|
{
|
|
|
|
GtkWidget *image;
|
|
|
|
|
2014-05-07 21:27:57 +02:00
|
|
|
image = gtk_image_new_from_icon_name (GIMP_STOCK_COLOR_PICK_FROM_SCREEN,
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
2002-11-04 22:56:41 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (GTK_WIDGET (button),
|
|
|
|
_("Click the eyedropper, then click a color "
|
|
|
|
"anywhere on your screen to select that color."),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-15 02:34:29 +02:00
|
|
|
gimp_pick_button_dispose (GObject *object)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
2004-02-08 15:47:20 +00:00
|
|
|
GimpPickButton *button = GIMP_PICK_BUTTON (object);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
if (button->cursor)
|
|
|
|
{
|
|
|
|
gdk_cursor_unref (button->cursor);
|
|
|
|
button->cursor = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (button->grab_widget)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (button->grab_widget);
|
|
|
|
button->grab_widget = NULL;
|
|
|
|
}
|
|
|
|
|
2010-10-15 02:34:29 +02:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2002-11-04 22:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2003-01-05 15:41:23 +00:00
|
|
|
/**
|
|
|
|
* gimp_pick_button_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GimpPickButton widget.
|
2003-10-29 20:57:21 +00:00
|
|
|
*
|
2003-01-05 15:41:23 +00:00
|
|
|
* Returns: A new #GimpPickButton widget.
|
|
|
|
**/
|
2002-11-04 22:56:41 +00:00
|
|
|
GtkWidget *
|
|
|
|
gimp_pick_button_new (void)
|
|
|
|
{
|
2004-02-08 15:47:20 +00:00
|
|
|
return g_object_new (GIMP_TYPE_PICK_BUTTON, NULL);
|
2002-11-04 22:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static GdkCursor *
|
2010-09-12 02:44:00 +02:00
|
|
|
make_cursor (GdkDisplay *display)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
2015-04-14 22:55:10 +02:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GError *error = NULL;
|
2010-09-12 02:44:00 +02:00
|
|
|
|
2015-04-14 22:55:10 +02:00
|
|
|
pixbuf = gdk_pixbuf_new_from_resource ("/org/gimp/color-picker-cursors/cursor-color-picker.png",
|
|
|
|
&error);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2015-04-14 22:55:10 +02:00
|
|
|
if (pixbuf)
|
|
|
|
{
|
|
|
|
GdkCursor *cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, 1, 30);
|
|
|
|
|
|
|
|
g_object_unref (pixbuf);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2015-04-14 22:55:10 +02:00
|
|
|
return cursor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_critical ("Failed to create cursor image: %s", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2015-04-14 22:55:10 +02:00
|
|
|
return NULL;
|
2002-11-04 22:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pick_button_clicked (GtkButton *gtk_button)
|
|
|
|
{
|
2004-02-08 15:47:20 +00:00
|
|
|
GimpPickButton *button = GIMP_PICK_BUTTON (gtk_button);
|
|
|
|
GtkWidget *widget;
|
|
|
|
guint32 timestamp;
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2004-02-08 15:47:20 +00:00
|
|
|
if (! button->cursor)
|
2010-09-12 02:44:00 +02:00
|
|
|
button->cursor = make_cursor (gtk_widget_get_display (GTK_WIDGET (gtk_button)));
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2004-02-08 15:47:20 +00:00
|
|
|
if (! button->grab_widget)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
|
|
|
button->grab_widget = gtk_invisible_new ();
|
|
|
|
|
|
|
|
gtk_widget_add_events (button->grab_widget,
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
2004-02-08 15:47:20 +00:00
|
|
|
GDK_BUTTON_PRESS_MASK |
|
2002-11-04 22:56:41 +00:00
|
|
|
GDK_POINTER_MOTION_MASK);
|
|
|
|
|
|
|
|
gtk_widget_show (button->grab_widget);
|
|
|
|
}
|
|
|
|
|
2004-02-08 15:47:20 +00:00
|
|
|
widget = button->grab_widget;
|
|
|
|
timestamp = gtk_get_current_event_time ();
|
|
|
|
|
2009-03-22 15:42:42 +00:00
|
|
|
if (gdk_keyboard_grab (gtk_widget_get_window (widget), FALSE,
|
|
|
|
timestamp) != GDK_GRAB_SUCCESS)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
|
|
|
g_warning ("Failed to grab keyboard to do eyedropper");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-22 15:42:42 +00:00
|
|
|
if (gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
|
2002-11-04 22:56:41 +00:00
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
2004-02-08 15:47:20 +00:00
|
|
|
GDK_BUTTON_PRESS_MASK |
|
2002-11-04 22:56:41 +00:00
|
|
|
GDK_POINTER_MOTION_MASK,
|
|
|
|
NULL,
|
|
|
|
button->cursor,
|
2004-02-08 15:47:20 +00:00
|
|
|
timestamp) != GDK_GRAB_SUCCESS)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
2004-02-08 15:47:20 +00:00
|
|
|
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), timestamp);
|
2002-11-04 22:56:41 +00:00
|
|
|
g_warning ("Failed to grab pointer to do eyedropper");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-02-08 15:47:20 +00:00
|
|
|
gtk_grab_add (widget);
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (widget, "button-press-event",
|
2002-11-04 22:56:41 +00:00
|
|
|
G_CALLBACK (gimp_pick_button_mouse_press),
|
|
|
|
button);
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (widget, "key-press-event",
|
2002-11-04 22:56:41 +00:00
|
|
|
G_CALLBACK (gimp_pick_button_key_press),
|
|
|
|
button);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_pick_button_mouse_press (GtkWidget *invisible,
|
|
|
|
GdkEventButton *event,
|
|
|
|
GimpPickButton *button)
|
|
|
|
{
|
|
|
|
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
|
|
|
{
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (invisible, "motion-notify-event",
|
2002-11-04 22:56:41 +00:00
|
|
|
G_CALLBACK (gimp_pick_button_mouse_motion),
|
|
|
|
button);
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (invisible, "button-release-event",
|
2002-11-04 22:56:41 +00:00
|
|
|
G_CALLBACK (gimp_pick_button_mouse_release),
|
|
|
|
button);
|
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_mouse_press,
|
|
|
|
button);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_key_press,
|
|
|
|
button);
|
2004-02-08 15:47:20 +00:00
|
|
|
|
2002-11-04 22:56:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_pick_button_key_press (GtkWidget *invisible,
|
|
|
|
GdkEventKey *event,
|
|
|
|
GimpPickButton *button)
|
2003-10-29 20:57:21 +00:00
|
|
|
{
|
2011-04-11 23:43:03 +02:00
|
|
|
if (event->keyval == GDK_KEY_Escape)
|
2002-11-04 22:56:41 +00:00
|
|
|
{
|
|
|
|
gimp_pick_button_shutdown (button);
|
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_mouse_press,
|
|
|
|
button);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_key_press,
|
|
|
|
button);
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2002-11-04 22:56:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_pick_button_mouse_motion (GtkWidget *invisible,
|
|
|
|
GdkEventMotion *event,
|
|
|
|
GimpPickButton *button)
|
|
|
|
{
|
2004-05-27 15:12:31 +00:00
|
|
|
gint x_root;
|
|
|
|
gint y_root;
|
|
|
|
|
|
|
|
gdk_window_get_origin (event->window, &x_root, &y_root);
|
|
|
|
x_root += event->x;
|
|
|
|
y_root += event->y;
|
|
|
|
|
2003-08-18 23:21:44 +00:00
|
|
|
gimp_pick_button_pick (gdk_event_get_screen ((GdkEvent *) event),
|
2004-05-27 15:12:31 +00:00
|
|
|
x_root, y_root, button);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_pick_button_mouse_release (GtkWidget *invisible,
|
|
|
|
GdkEventButton *event,
|
|
|
|
GimpPickButton *button)
|
|
|
|
{
|
2004-05-27 15:12:31 +00:00
|
|
|
gint x_root;
|
|
|
|
gint y_root;
|
|
|
|
|
2002-11-04 22:56:41 +00:00
|
|
|
if (event->button != 1)
|
|
|
|
return FALSE;
|
|
|
|
|
2004-05-27 15:12:31 +00:00
|
|
|
gdk_window_get_origin (event->window, &x_root, &y_root);
|
|
|
|
x_root += event->x;
|
|
|
|
y_root += event->y;
|
|
|
|
|
2003-08-18 23:21:44 +00:00
|
|
|
gimp_pick_button_pick (gdk_event_get_screen ((GdkEvent *) event),
|
2004-05-27 15:12:31 +00:00
|
|
|
x_root, y_root, button);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
gimp_pick_button_shutdown (button);
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_mouse_motion,
|
|
|
|
button);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (invisible,
|
2002-11-04 22:56:41 +00:00
|
|
|
gimp_pick_button_mouse_release,
|
|
|
|
button);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_pick_button_shutdown (GimpPickButton *button)
|
|
|
|
{
|
2004-02-08 15:47:20 +00:00
|
|
|
GdkDisplay *display = gtk_widget_get_display (button->grab_widget);
|
|
|
|
guint32 timestamp = gtk_get_current_event_time ();
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2004-02-08 15:47:20 +00:00
|
|
|
gdk_display_keyboard_ungrab (display, timestamp);
|
|
|
|
gdk_display_pointer_ungrab (display, timestamp);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
|
|
|
gtk_grab_remove (button->grab_widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-08-18 23:21:44 +00:00
|
|
|
gimp_pick_button_pick (GdkScreen *screen,
|
2002-11-04 22:56:41 +00:00
|
|
|
gint x_root,
|
|
|
|
gint y_root,
|
|
|
|
GimpPickButton *button)
|
|
|
|
{
|
2013-10-11 22:52:38 +02:00
|
|
|
#ifndef GDK_WINDOWING_QUARTZ
|
|
|
|
|
2010-08-08 16:10:14 +02:00
|
|
|
GdkWindow *root_window = gdk_screen_get_root_window (screen);
|
|
|
|
cairo_surface_t *image;
|
|
|
|
cairo_t *cr;
|
|
|
|
guchar *data;
|
|
|
|
guchar color[3];
|
|
|
|
GimpRGB rgb;
|
|
|
|
|
|
|
|
image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
|
|
|
|
|
|
|
|
cr = cairo_create (image);
|
|
|
|
|
2010-10-19 13:46:31 +02:00
|
|
|
gdk_cairo_set_source_window (cr, root_window, -x_root, -y_root);
|
2010-08-08 16:10:14 +02:00
|
|
|
cairo_paint (cr);
|
|
|
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
|
|
|
data = cairo_image_surface_get_data (image);
|
|
|
|
GIMP_CAIRO_RGB24_GET_PIXEL (data, color[0], color[1], color[2]);
|
|
|
|
|
|
|
|
cairo_surface_destroy (image);
|
|
|
|
|
2013-11-16 22:53:16 +01:00
|
|
|
gimp_rgba_set_uchar (&rgb, color[0], color[1], color[2], 255);
|
2002-11-04 22:56:41 +00:00
|
|
|
|
2013-10-11 22:52:38 +02:00
|
|
|
#else /* GDK_WINDOWING_QUARTZ */
|
|
|
|
|
2012-05-28 07:36:36 -07:00
|
|
|
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);
|
|
|
|
|
2013-10-11 22:52:38 +02:00
|
|
|
gimp_rgba_set_uchar (&rgb, data[2], data[1], data[0], 255);
|
2012-05-28 07:36:36 -07:00
|
|
|
|
|
|
|
CGImageRelease (root_image_ref);
|
|
|
|
CFRelease (pixel_data);
|
2013-10-11 22:52:38 +02:00
|
|
|
|
|
|
|
#endif /* GDK_WINDOWING_QUARTZ */
|
2012-05-28 07:36:36 -07:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (button, pick_button_signals[COLOR_PICKED], 0, &rgb);
|
2002-11-04 22:56:41 +00:00
|
|
|
}
|