app: clean up the new brush outline stuff a bit

This commit is contained in:
Michael Natterer
2011-06-30 09:27:43 +02:00
parent e7ade3f8ec
commit 8b57ef51cc
7 changed files with 21 additions and 17 deletions

View File

@ -77,13 +77,14 @@ typedef enum
GIMP_HANDLE_ANCHOR_EAST
} GimpHandleAnchor;
#define GIMP_TYPE_PATH_STYLE (gimp_path_style_get_type ())
GType gimp_path_style_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_PATH_STYLE_DEFAULT = 0,
GIMP_PATH_STYLE_DEFAULT,
GIMP_PATH_STYLE_VECTORS,
GIMP_PATH_STYLE_OUTLINE
} GimpPathStyle;

View File

@ -313,6 +313,7 @@ gimp_canvas_path_stroke (GimpCanvasItem *item,
gimp_display_shell_set_vectors_fg_style (shell, cr, active);
cairo_stroke (cr);
break;
case GIMP_PATH_STYLE_OUTLINE:
gimp_display_shell_set_outline_bg_style (shell, cr);
cairo_stroke_preserve (cr);
@ -320,6 +321,7 @@ gimp_canvas_path_stroke (GimpCanvasItem *item,
gimp_display_shell_set_outline_fg_style (shell, cr);
cairo_stroke (cr);
break;
case GIMP_PATH_STYLE_DEFAULT:
GIMP_CANVAS_ITEM_CLASS (parent_class)->stroke (item, shell, cr);
break;
@ -329,20 +331,20 @@ gimp_canvas_path_stroke (GimpCanvasItem *item,
GimpCanvasItem *
gimp_canvas_path_new (GimpDisplayShell *shell,
const GimpBezierDesc *bezier,
GimpPathStyle path_style,
gdouble x,
gdouble y,
gboolean filled)
gboolean filled,
GimpPathStyle style)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
return g_object_new (GIMP_TYPE_CANVAS_PATH,
"shell", shell,
"path", bezier,
"path-style", path_style,
"x", x,
"y", y,
"filled", filled,
"path-style", style,
NULL);
}

View File

@ -51,10 +51,10 @@ GType gimp_canvas_path_get_type (void) G_GNUC_CONST;
GimpCanvasItem * gimp_canvas_path_new (GimpDisplayShell *shell,
const GimpBezierDesc *bezier,
GimpPathStyle type,
gdouble x,
gdouble y,
gboolean filled);
gboolean filled,
GimpPathStyle style);
void gimp_canvas_path_set (GimpCanvasItem *path,
const GimpBezierDesc *bezier);

View File

@ -875,9 +875,9 @@ gimp_display_shell_vectors_add_handler (GimpContainer *container,
item = gimp_canvas_path_new (shell,
gimp_vectors_get_bezier (vectors),
GIMP_PATH_STYLE_VECTORS,
0, 0,
FALSE);
FALSE,
GIMP_PATH_STYLE_VECTORS);
gimp_canvas_item_set_visible (item,
gimp_item_get_visible (GIMP_ITEM (vectors)));

View File

@ -322,7 +322,7 @@ gimp_display_shell_set_outline_fg_style (GimpDisplayShell *shell,
cairo_set_line_width (cr, 1.0);
gimp_cairo_set_source_rgba (cr, &outline_fg);
cairo_set_dash(cr, dashes, 2, 0);
cairo_set_dash (cr, dashes, G_N_ELEMENTS (dashes), 0);
}
void

View File

@ -356,7 +356,8 @@ gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
#undef EPSILON
}
return gimp_canvas_path_new (shell, boundary, GIMP_PATH_STYLE_OUTLINE, x, y, FALSE);
return gimp_canvas_path_new (shell, boundary, x, y, FALSE,
GIMP_PATH_STYLE_OUTLINE);
}
else if (draw_fallback)
{

View File

@ -774,7 +774,7 @@ gimp_draw_tool_add_path (GimpDrawTool *draw_tool,
g_return_val_if_fail (desc != NULL, NULL);
item = gimp_canvas_path_new (gimp_display_get_shell (draw_tool->display),
desc, GIMP_PATH_STYLE_DEFAULT, x, y, FALSE);
desc, x, y, FALSE, GIMP_PATH_STYLE_DEFAULT);
gimp_draw_tool_add_item (draw_tool, item);
g_object_unref (item);