本文整理匯總了C++中GIMP_PAINT_TOOL函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_PAINT_TOOL函數的具體用法?C++ GIMP_PAINT_TOOL怎麽用?C++ GIMP_PAINT_TOOL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_PAINT_TOOL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_source_tool_cursor_update
static void
gimp_source_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
if (gimp_source_core_use_source (GIMP_SOURCE_CORE (paint_tool->core),
options))
{
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
{
cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
}
else if (! GIMP_SOURCE_CORE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
{
modifier = GIMP_CURSOR_MODIFIER_BAD;
}
}
gimp_tool_control_set_cursor (tool->control, cursor);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
示例2: gimp_source_tool_control
static void
gimp_source_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
/* chain up early so the draw tool can undraw the source marker
* while we still know about source drawable and display
*/
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
source_tool->src_display = NULL;
g_object_set (GIMP_PAINT_TOOL (tool)->core,
"src-drawable", NULL,
NULL);
break;
}
}
示例3: gimp_source_tool_modifier_key
static void
gimp_source_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
if (options->use_source && key == GDK_CONTROL_MASK)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if (press)
{
paint_tool->status = source_tool->status_set_source;
source_tool->show_source_outline = FALSE;
}
else
{
paint_tool->status = source_tool->status_paint;
source_tool->show_source_outline = TRUE;
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool, key, press, state,
display);
}
示例4: gimp_source_tool_control
static void
gimp_source_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_source_tool_set_src_display (source_tool, NULL);
g_object_set (GIMP_PAINT_TOOL (tool)->core,
"src-drawable", NULL,
NULL);
break;
case GIMP_TOOL_ACTION_COMMIT:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
}
示例5: gimp_source_tool_button_press
static void
gimp_source_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
GimpSourceCore *source = GIMP_SOURCE_CORE (paint_tool->core);
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
{
source->set_source = TRUE;
gimp_source_tool_set_src_display (source_tool, display);
}
else
{
source->set_source = FALSE;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
source_tool->src_x = source->src_x;
source_tool->src_y = source->src_y;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
示例6: gimp_source_tool_cursor_update
static void
gimp_source_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
GimpSourceOptions *options = GIMP_SOURCE_TOOL_GET_OPTIONS (tool);
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
if (options->use_source)
{
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
{
cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
}
else if (! GIMP_SOURCE_CORE (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
{
modifier = GIMP_CURSOR_MODIFIER_BAD;
}
}
gimp_tool_control_set_cursor (tool->control, cursor);
gimp_tool_control_set_cursor_modifier (tool->control, modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
示例7: gimp_source_tool_button_press
static void
gimp_source_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
GimpSourceCore *source = GIMP_SOURCE_CORE (paint_tool->core);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
{
source->set_source = TRUE;
source_tool->src_display = display;
}
else
{
source->set_source = FALSE;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
display);
source_tool->src_x = source->src_x;
source_tool->src_y = source->src_y;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
示例8: gimp_airbrush_tool_stamp
static void
gimp_airbrush_tool_stamp (GimpAirbrushTool *airbrush_tool,
gpointer data)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (airbrush_tool);
gimp_airbrush_stamp (GIMP_AIRBRUSH (paint_tool->core));
}
示例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_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));
}
}
}
}
示例11: gimp_perspective_clone_tool_options_notify
static void
gimp_perspective_clone_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec)
{
GimpPerspectiveCloneTool *clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (tool);
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpPerspectiveCloneOptions *clone_options;
clone_options = GIMP_PERSPECTIVE_CLONE_OPTIONS (options);
GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
if (! strcmp (pspec->name, "clone-mode"))
{
GimpPerspectiveClone *clone;
clone = GIMP_PERSPECTIVE_CLONE (GIMP_PAINT_TOOL (tool)->core);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (clone_tool));
if (clone_options->clone_mode == GIMP_PERSPECTIVE_CLONE_MODE_PAINT)
{
gimp_perspective_clone_set_transform (clone, &clone_tool->transform);
gimp_paint_tool_set_active (paint_tool, TRUE);
}
else
{
gimp_paint_tool_set_active (paint_tool, FALSE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
/* start drawing the bounding box and handles... */
if (tool->display &&
! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (clone_tool)))
{
gimp_draw_tool_start (GIMP_DRAW_TOOL (clone_tool), tool->display);
}
}
gimp_draw_tool_resume (GIMP_DRAW_TOOL (clone_tool));
}
}
示例12: gimp_airbrush_tool_init
static void
gimp_airbrush_tool_init (GimpAirbrushTool *airbrush)
{
GimpTool *tool = GIMP_TOOL (airbrush);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_AIRBRUSH);
gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (airbrush),
GIMP_COLOR_PICK_MODE_FOREGROUND);
}
示例13: gimp_airbrush_tool_airbrush_stamp
static void
gimp_airbrush_tool_airbrush_stamp (GimpAirbrush *airbrush,
GimpAirbrushTool *airbrush_tool)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (airbrush_tool);
gimp_paint_tool_paint_push (
paint_tool,
(GimpPaintToolPaintFunc) gimp_airbrush_tool_stamp,
NULL);
}
示例14: gimp_brush_tool_brush_changed
static void
gimp_brush_tool_brush_changed (GimpContext *context,
GimpBrush *brush,
GimpBrushTool *brush_tool)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool);
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
gimp_brush_core_set_brush (brush_core, brush);
}
示例15: gimp_airbrush_tool_constructed
static void
gimp_airbrush_tool_constructed (GObject *object)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
g_signal_connect_object (paint_tool->core, "stamp",
G_CALLBACK (gimp_airbrush_tool_airbrush_stamp),
object, 0);
}