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:
Jehan
2015-12-15 02:54:04 +01:00
parent b6a756f284
commit b8fadf3ad7
12 changed files with 348 additions and 79 deletions

View File

@ -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-grid.h"
@ -629,11 +630,26 @@ gimp_display_shell_guide_add_handler (GimpImage *image,
{
GimpCanvasProxyGroup *group = GIMP_CANVAS_PROXY_GROUP (shell->guides);
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 (guide, &normal_foreground, &normal_background);
gimp_guide_get_active_style (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_canvas_guide_new (shell,
gimp_guide_get_orientation (guide),
gimp_guide_get_position (guide),
TRUE);
normal_style, active_style,
gimp_guide_get_line_width (guide));
gimp_canvas_proxy_group_add_item (group, guide, item);
g_object_unref (item);