app: use gimp_paint_tool_set_draw_circle() in the MyPaint brush tool

This commit is contained in:
Michael Natterer 2014-04-09 15:41:56 +02:00
parent 9629befec6
commit dd767bca37
2 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -40,6 +41,9 @@ G_DEFINE_TYPE (GimpMybrushTool, gimp_mybrush_tool, GIMP_TYPE_PAINT_TOOL)
#define parent_class gimp_mybrush_tool_parent_class
static void gimp_mybrush_tool_draw (GimpDrawTool *draw_tool);
void
gimp_mybrush_tool_register (GimpToolRegisterCallback callback,
gpointer data)
@ -63,6 +67,9 @@ gimp_mybrush_tool_register (GimpToolRegisterCallback callback,
static void
gimp_mybrush_tool_class_init (GimpMybrushToolClass *klass)
{
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
draw_tool_class->draw = gimp_mybrush_tool_draw;
}
static void
@ -75,3 +82,15 @@ gimp_mybrush_tool_init (GimpMybrushTool *mybrush_tool)
gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mybrush_tool),
GIMP_COLOR_PICK_MODE_FOREGROUND);
}
static void
gimp_mybrush_tool_draw (GimpDrawTool *draw_tool)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (draw_tool);
GimpMybrushOptions *options = GIMP_MYBRUSH_TOOL_GET_OPTIONS (draw_tool);
gimp_paint_tool_set_draw_circle (paint_tool, TRUE,
exp (options->radius));
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
}

View File

@ -29,6 +29,8 @@
#define GIMP_IS_MYBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_TOOL))
#define GIMP_MYBRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH_TOOL, GimpMybrushToolClass))
#define GIMP_MYBRUSH_TOOL_GET_OPTIONS(t) (GIMP_MYBRUSH_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpMybrushTool GimpMybrushTool;
typedef struct _GimpMybrushToolClass GimpMybrushToolClass;