本文整理汇总了C++中GIMP_COLOR_TOOL函数的典型用法代码示例。如果您正苦于以下问题:C++ GIMP_COLOR_TOOL函数的具体用法?C++ GIMP_COLOR_TOOL怎么用?C++ GIMP_COLOR_TOOL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GIMP_COLOR_TOOL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gimp_paint_tool_modifier_key
static void
gimp_paint_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (paint_tool->pick_colors && ! paint_tool->draw_line)
{
if ((state & gimp_get_all_modifiers_mask ()) ==
gimp_get_constrain_behavior_mask ())
{
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GimpToolInfo *info = gimp_get_tool_info (display->gimp,
"gimp-color-picker-tool");
if (GIMP_IS_TOOL_INFO (info))
{
if (gimp_draw_tool_is_active (draw_tool))
gimp_draw_tool_stop (draw_tool);
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
GIMP_COLOR_OPTIONS (info->tool_options));
switch (GIMP_COLOR_TOOL (tool)->pick_mode)
{
case GIMP_COLOR_PICK_MODE_FOREGROUND:
gimp_tool_push_status (tool, display,
_("Click in any image to pick the "
"foreground color"));
break;
case GIMP_COLOR_PICK_MODE_BACKGROUND:
gimp_tool_push_status (tool, display,
_("Click in any image to pick the "
"background color"));
break;
default:
break;
}
}
}
}
else
{
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
gimp_tool_pop_status (tool, display);
gimp_color_tool_disable (GIMP_COLOR_TOOL (tool));
}
}
}
}
示例2: gimp_color_tool_start_sample_point
void
gimp_color_tool_start_sample_point (GimpTool *tool,
GimpDisplay *display)
{
GimpColorTool *color_tool;
g_return_if_fail (GIMP_IS_COLOR_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
color_tool = GIMP_COLOR_TOOL (tool);
gimp_display_shell_selection_control (GIMP_DISPLAY_SHELL (display->shell),
GIMP_SELECTION_PAUSE);
tool->display = display;
gimp_tool_control_activate (tool->control);
if (color_tool->sample_point)
gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (display->shell),
color_tool->sample_point, FALSE);
color_tool->sample_point = NULL;
color_tool->moving_sample_point = TRUE;
color_tool->sample_point_x = -1;
color_tool->sample_point_y = -1;
gimp_tool_set_cursor (tool, display,
GIMP_CURSOR_MOUSE,
GIMP_TOOL_CURSOR_COLOR_PICKER,
GIMP_CURSOR_MODIFIER_MOVE);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
}
示例3: gimp_color_picker_tool_init
static void
gimp_color_picker_tool_init (GimpColorPickerTool *picker_tool)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (picker_tool);
color_tool->pick_mode = GIMP_COLOR_PICK_MODE_FOREGROUND;
}
示例4: gimp_color_tool_control
static void
gimp_color_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
break;
case GIMP_TOOL_ACTION_RESUME:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (shell))
gimp_display_shell_draw_sample_point (shell,
color_tool->sample_point, TRUE);
break;
case GIMP_TOOL_ACTION_HALT:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (shell))
gimp_display_shell_draw_sample_point (shell,
color_tool->sample_point, FALSE);
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
}
示例5: gimp_color_tool_motion
static void
gimp_color_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
if (! color_tool->enabled)
return;
if (! color_tool->sample_point)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
color_tool->center_x = coords->x;
color_tool->center_y = coords->y;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_UPDATE,
coords->x, coords->y);
}
}
示例6: gimp_color_tool_button_release
static void
gimp_color_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
/* Chain up to halt the tool */
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display);
if (! color_tool->enabled)
return;
if (! color_tool->sample_point)
{
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_END,
coords->x, coords->y);
}
}
示例7: gimp_curves_tool_oper_update
static void
gimp_curves_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
GimpColorPickMode mode = GIMP_COLOR_PICK_MODE_NONE;
const gchar *status = NULL;
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
gimp_tool_pop_status (tool, display);
if (state & GDK_SHIFT_MASK)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add a control point");
}
else if (state & GDK_CONTROL_MASK)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add control points to all channels");
}
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
if (status && proximity)
gimp_tool_push_status (tool, display, "%s", status);
}
示例8: gimp_color_tool_start_sample_point
void
gimp_color_tool_start_sample_point (GimpTool *tool,
GimpDisplay *display)
{
GimpColorTool *color_tool;
g_return_if_fail (GIMP_IS_COLOR_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display));
color_tool = GIMP_COLOR_TOOL (tool);
gimp_display_shell_selection_pause (gimp_display_get_shell (display));
tool->display = display;
gimp_tool_control_activate (tool->control);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
color_tool->sample_point = NULL;
color_tool->moving_sample_point = TRUE;
color_tool->sample_point_x = SAMPLE_POINT_POSITION_INVALID;
color_tool->sample_point_y = SAMPLE_POINT_POSITION_INVALID;
gimp_tool_set_cursor (tool, display,
GIMP_CURSOR_MOUSE,
GIMP_TOOL_CURSOR_COLOR_PICKER,
GIMP_CURSOR_MODIFIER_MOVE);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
}
示例9: gimp_paint_tool_cursor_update
static void
gimp_paint_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpCursorModifier modifier;
GimpCursorModifier toggle_modifier;
GimpCursorModifier old_modifier;
GimpCursorModifier old_toggle_modifier;
modifier = tool->control->cursor_modifier;
toggle_modifier = tool->control->toggle_cursor_modifier;
old_modifier = modifier;
old_toggle_modifier = toggle_modifier;
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
gimp_item_is_content_locked (GIMP_ITEM (drawable)) ||
! gimp_item_is_visible (GIMP_ITEM (drawable)))
{
modifier = GIMP_CURSOR_MODIFIER_BAD;
toggle_modifier = GIMP_CURSOR_MODIFIER_BAD;
}
if (! paint_tool->show_cursor &&
modifier != GIMP_CURSOR_MODIFIER_BAD)
{
gimp_tool_set_cursor (tool, display,
GIMP_CURSOR_NONE,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
return;
}
gimp_tool_control_set_cursor_modifier (tool->control,
modifier);
gimp_tool_control_set_toggle_cursor_modifier (tool->control,
toggle_modifier);
}
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
display);
/* reset old stuff here so we are not interferring with the modifiers
* set by our subclasses
*/
gimp_tool_control_set_cursor_modifier (tool->control,
old_modifier);
gimp_tool_control_set_toggle_cursor_modifier (tool->control,
old_toggle_modifier);
}
示例10: gimp_color_picker_tool_constructed
static void
gimp_color_picker_tool_constructed (GObject *object)
{
GimpTool *tool = GIMP_TOOL (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
GIMP_COLOR_TOOL_GET_OPTIONS (tool));
}
示例11: gimp_paint_tool_enable_color_picker
/**
* gimp_paint_tool_enable_color_picker:
* @tool: a #GimpPaintTool
* @mode: the #GimpColorPickMode to set
*
* This is a convenience function used from the init method of paint
* tools that want the color picking functionality. The @mode that is
* set here is used to decide what cursor modifier to draw and if the
* picked color goes to the foreground or background color.
**/
void
gimp_paint_tool_enable_color_picker (GimpPaintTool *tool,
GimpColorPickMode mode)
{
g_return_if_fail (GIMP_IS_PAINT_TOOL (tool));
tool->pick_colors = TRUE;
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
}
示例12: gimp_color_tool_cursor_update
static void
gimp_color_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
if (color_tool->enabled)
{
if (color_tool->sample_point)
{
gimp_tool_set_cursor (tool, display,
GIMP_CURSOR_MOUSE,
GIMP_TOOL_CURSOR_COLOR_PICKER,
GIMP_CURSOR_MODIFIER_MOVE);
}
else
{
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
if (gimp_image_coords_in_active_pickable (image, coords,
color_tool->options->sample_merged,
FALSE))
{
switch (color_tool->pick_mode)
{
case GIMP_COLOR_PICK_MODE_NONE:
modifier = GIMP_CURSOR_MODIFIER_NONE;
break;
case GIMP_COLOR_PICK_MODE_FOREGROUND:
modifier = GIMP_CURSOR_MODIFIER_FOREGROUND;
break;
case GIMP_COLOR_PICK_MODE_BACKGROUND:
modifier = GIMP_CURSOR_MODIFIER_BACKGROUND;
break;
case GIMP_COLOR_PICK_MODE_PALETTE:
modifier = GIMP_CURSOR_MODIFIER_PLUS;
break;
}
}
gimp_tool_set_cursor (tool, display,
GIMP_CURSOR_COLOR_PICKER,
GIMP_TOOL_CURSOR_COLOR_PICKER,
modifier);
}
return; /* don't chain up */
}
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
示例13: gimp_color_tool_finalize
static void
gimp_color_tool_finalize (GObject *object)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (object);
if (color_tool->options)
{
g_object_unref (color_tool->options);
color_tool->options = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
示例14: gimp_color_tool_button_press
static void
gimp_color_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
/* Chain up to activate the tool */
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
if (! color_tool->enabled)
return;
if (color_tool->sample_point)
{
color_tool->moving_sample_point = TRUE;
gimp_sample_point_get_position (color_tool->sample_point,
&color_tool->sample_point_x,
&color_tool->sample_point_y);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_display_shell_selection_pause (shell);
if (! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control),
_("Move Sample Point: "),
color_tool->sample_point_x,
", ",
color_tool->sample_point_y,
NULL);
}
else
{
color_tool->center_x = coords->x;
color_tool->center_y = coords->y;
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_START,
coords->x, coords->y);
}
}
示例15: gimp_curves_tool_oper_update
static void
gimp_curves_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
if (gimp_image_map_tool_on_guide (GIMP_IMAGE_MAP_TOOL (tool),
coords, display))
{
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
}
else
{
GimpColorPickMode mode;
gchar *status = NULL;
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
gimp_tool_pop_status (tool, display);
if (state & extend_mask)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = g_strdup (_("Click to add a control point"));
}
else if (state & toggle_mask)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = g_strdup (_("Click to add control points to all channels"));
}
else
{
mode = GIMP_COLOR_PICK_MODE_NONE;
status = gimp_suggest_modifiers (_("Click to locate on curve"),
(extend_mask | toggle_mask) & ~state,
_("%s: add control point"),
_("%s: add control points to all channels"),
NULL);
}
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
if (proximity)
gimp_tool_push_status (tool, display, "%s", status);
g_free (status);
}
}