app: add a "custom" guide concept.
With gimp_guide_custom_new(), you can create a custom guide with a different style on canvas (other pattern/color/width). A custom guide won't be saved and could be used, for instance, for specific GEGL op guiding.
This commit is contained in:
@ -583,14 +583,17 @@ GimpCanvasItem *
|
||||
gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
|
||||
GimpOrientationType orientation,
|
||||
gint position,
|
||||
gboolean guide_style)
|
||||
cairo_pattern_t *normal_style,
|
||||
cairo_pattern_t *active_style,
|
||||
gdouble line_width)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
|
||||
|
||||
item = gimp_canvas_guide_new (gimp_display_get_shell (draw_tool->display),
|
||||
orientation, position, guide_style);
|
||||
orientation, position,
|
||||
normal_style, active_style, line_width);
|
||||
|
||||
gimp_draw_tool_add_item (draw_tool, item);
|
||||
g_object_unref (item);
|
||||
@ -617,9 +620,11 @@ gimp_draw_tool_add_crosshair (GimpDrawTool *draw_tool,
|
||||
|
||||
gimp_draw_tool_push_group (draw_tool, group);
|
||||
gimp_draw_tool_add_guide (draw_tool,
|
||||
GIMP_ORIENTATION_VERTICAL, position_x, FALSE);
|
||||
GIMP_ORIENTATION_VERTICAL, position_x,
|
||||
NULL, NULL, 1.0);
|
||||
gimp_draw_tool_add_guide (draw_tool,
|
||||
GIMP_ORIENTATION_HORIZONTAL, position_y, FALSE);
|
||||
GIMP_ORIENTATION_HORIZONTAL, position_y,
|
||||
NULL, NULL, 1.0);
|
||||
gimp_draw_tool_pop_group (draw_tool);
|
||||
|
||||
return GIMP_CANVAS_ITEM (group);
|
||||
|
||||
@ -115,7 +115,9 @@ GimpCanvasItem * gimp_draw_tool_add_line (GimpDrawTool *draw_too
|
||||
GimpCanvasItem * gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
|
||||
GimpOrientationType orientation,
|
||||
gint position,
|
||||
gboolean guide_style);
|
||||
cairo_pattern_t *normal_style,
|
||||
cairo_pattern_t *active_style,
|
||||
gdouble line_width);
|
||||
GimpCanvasItem * gimp_draw_tool_add_crosshair (GimpDrawTool *draw_tool,
|
||||
gint position_x,
|
||||
gint position_y);
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimp-cairo.h"
|
||||
#include "core/gimpguide.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-guides.h"
|
||||
@ -834,12 +835,32 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
|
||||
|
||||
if (move->guide)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
GimpCanvasItem *item;
|
||||
cairo_pattern_t *normal_style;
|
||||
cairo_pattern_t *active_style;
|
||||
GimpRGB normal_foreground;
|
||||
GimpRGB normal_background;
|
||||
GimpRGB active_foreground;
|
||||
GimpRGB active_background;
|
||||
|
||||
gimp_guide_get_normal_style (move->guide,
|
||||
&normal_foreground,
|
||||
&normal_background);
|
||||
gimp_guide_get_active_style (move->guide,
|
||||
&active_foreground,
|
||||
&active_background);
|
||||
normal_style = gimp_cairo_stipple_pattern_create (&normal_foreground,
|
||||
&normal_background,
|
||||
0);
|
||||
active_style = gimp_cairo_stipple_pattern_create (&active_foreground,
|
||||
&active_background,
|
||||
0);
|
||||
|
||||
item = gimp_draw_tool_add_guide (draw_tool,
|
||||
gimp_guide_get_orientation (move->guide),
|
||||
gimp_guide_get_position (move->guide),
|
||||
TRUE);
|
||||
normal_style, active_style,
|
||||
gimp_guide_get_line_width (move->guide));
|
||||
gimp_canvas_item_set_highlight (item, TRUE);
|
||||
}
|
||||
|
||||
@ -849,7 +870,7 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
|
||||
gimp_draw_tool_add_guide (draw_tool,
|
||||
move->guide_orientation,
|
||||
move->guide_position,
|
||||
FALSE);
|
||||
NULL, NULL, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user