removed "gdouble scale" parameter and added "GimpPaintOptions" in
2004-05-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: removed "gdouble scale" parameter and added "GimpPaintOptions" in GimpPaintCore::get_paint_area(). Check if virtual functions exist befoe calling them. * app/paint/gimpbrushcore.[ch]: added "gdouble scale" to GimpBrushCore and "gboolean use_scale" to GimpBrushCoreClass (defaults to TRUE). Set scale from paint_options in GimpPaintCore::get_paint_area(). Removed "scale" parameter from gimp_brush_core_paste_canvas() and _replace_canvas(). * app/paint/gimpsmudge.c (gimp_smudge_class_init): set use_scale to FALSE. * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c: removed all scale calculations and simply pass paint_options to GimpPaintCore::get_paint_area().
This commit is contained in:
parent
080b503fd0
commit
1bdb42bc53
12 changed files with 112 additions and 96 deletions
22
ChangeLog
22
ChangeLog
|
|
@ -1,3 +1,25 @@
|
|||
2004-05-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/paint/gimppaintcore.[ch]: removed "gdouble scale" parameter
|
||||
and added "GimpPaintOptions" in GimpPaintCore::get_paint_area().
|
||||
Check if virtual functions exist befoe calling them.
|
||||
|
||||
* app/paint/gimpbrushcore.[ch]: added "gdouble scale" to GimpBrushCore
|
||||
and "gboolean use_scale" to GimpBrushCoreClass (defaults to TRUE).
|
||||
Set scale from paint_options in GimpPaintCore::get_paint_area().
|
||||
Removed "scale" parameter from gimp_brush_core_paste_canvas()
|
||||
and _replace_canvas().
|
||||
|
||||
* app/paint/gimpsmudge.c (gimp_smudge_class_init): set use_scale
|
||||
to FALSE.
|
||||
|
||||
* app/paint/gimpclone.c
|
||||
* app/paint/gimpconvolve.c
|
||||
* app/paint/gimpdodgeburn.c
|
||||
* app/paint/gimperaser.c
|
||||
* app/paint/gimppaintbrush.c: removed all scale calculations and
|
||||
simply pass paint_options to GimpPaintCore::get_paint_area().
|
||||
|
||||
2004-05-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimppainttool.c (gimp_paint_tool_button_press): check
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "gimpbrushcore.h"
|
||||
#include "gimpbrushcore-kernels.h"
|
||||
#include "gimppaintoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
|
@ -64,7 +65,7 @@ static void gimp_brush_core_interpolate (GimpPaintCore *core,
|
|||
|
||||
static TempBuf *gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale);
|
||||
GimpPaintOptions *paint_options);
|
||||
|
||||
static void gimp_brush_core_calc_brush_size (GimpBrushCore *core,
|
||||
MaskBuf *mask,
|
||||
|
|
@ -158,6 +159,8 @@ gimp_brush_core_class_init (GimpBrushCoreClass *klass)
|
|||
paint_core_class->pre_paint = gimp_brush_core_pre_paint;
|
||||
paint_core_class->interpolate = gimp_brush_core_interpolate;
|
||||
paint_core_class->get_paint_area = gimp_brush_core_get_paint_area;
|
||||
|
||||
klass->use_scale = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -166,6 +169,8 @@ gimp_brush_core_init (GimpBrushCore *core)
|
|||
gint i, j;
|
||||
|
||||
core->brush = NULL;
|
||||
core->spacing = 1.0;
|
||||
core->scale = 1.0;
|
||||
|
||||
core->pressure_brush = NULL;
|
||||
|
||||
|
|
@ -622,9 +627,9 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
|
|||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale)
|
||||
gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
GimpBrushCore *core = GIMP_BRUSH_CORE (paint_core);
|
||||
gint x, y;
|
||||
|
|
@ -635,9 +640,19 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
|
|||
|
||||
bytes = gimp_drawable_bytes_with_alpha (drawable);
|
||||
|
||||
if (GIMP_BRUSH_CORE_GET_CLASS (core)->use_scale)
|
||||
{
|
||||
GimpPressureOptions *pressure_options = paint_options->pressure_options;
|
||||
|
||||
if (pressure_options->size)
|
||||
core->scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
core->scale = 1.0;
|
||||
}
|
||||
|
||||
gimp_brush_core_calc_brush_size (core,
|
||||
core->brush->mask,
|
||||
scale,
|
||||
core->scale,
|
||||
&bwidth, &bheight);
|
||||
|
||||
/* adjust the x and y coordinates to the upper left corner of the brush */
|
||||
|
|
@ -670,12 +685,11 @@ gimp_brush_core_paste_canvas (GimpBrushCore *core,
|
|||
gdouble image_opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GimpBrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
GimpPaintApplicationMode mode)
|
||||
{
|
||||
MaskBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
|
||||
brush_hardness,
|
||||
brush_scale);
|
||||
core->scale);
|
||||
|
||||
if (brush_mask)
|
||||
gimp_paint_core_paste (GIMP_PAINT_CORE (core), brush_mask, drawable,
|
||||
|
|
@ -694,12 +708,11 @@ gimp_brush_core_replace_canvas (GimpBrushCore *core,
|
|||
gdouble brush_opacity,
|
||||
gdouble image_opacity,
|
||||
GimpBrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
GimpPaintApplicationMode mode)
|
||||
{
|
||||
MaskBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
|
||||
brush_hardness,
|
||||
brush_scale);
|
||||
core->scale);
|
||||
|
||||
if (brush_mask)
|
||||
gimp_paint_core_replace (GIMP_PAINT_CORE (core), brush_mask, drawable,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct _GimpBrushCore
|
|||
|
||||
GimpBrush *brush;
|
||||
gdouble spacing;
|
||||
gdouble scale;
|
||||
|
||||
/* brush buffers */
|
||||
MaskBuf *pressure_brush;
|
||||
|
|
@ -75,6 +76,8 @@ struct _GimpBrushCore
|
|||
struct _GimpBrushCoreClass
|
||||
{
|
||||
GimpPaintCoreClass parent_class;
|
||||
|
||||
gboolean use_scale;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -86,14 +89,12 @@ void gimp_brush_core_paste_canvas (GimpBrushCore *core,
|
|||
gdouble image_opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GimpBrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
GimpPaintApplicationMode mode);
|
||||
void gimp_brush_core_replace_canvas (GimpBrushCore *core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble brush_opacity,
|
||||
gdouble image_opacity,
|
||||
GimpBrushApplicationMode brush_hardness,
|
||||
gdouble brush_scale,
|
||||
GimpPaintApplicationMode mode);
|
||||
|
||||
void gimp_brush_core_color_area_with_pixmap
|
||||
|
|
|
|||
|
|
@ -279,7 +279,6 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
PixelRegion srcPR, destPR;
|
||||
GimpPattern *pattern = NULL;
|
||||
gdouble opacity;
|
||||
gdouble scale;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
|
|
@ -307,13 +306,8 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
has_alpha = gimp_drawable_has_alpha (clone->src_drawable);
|
||||
}
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
/* Get a region which can be used to paint to */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
switch (options->clone_type)
|
||||
|
|
@ -431,13 +425,11 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
if (pressure_options->opacity)
|
||||
opacity *= PRESSURE_SCALE * paint_core->cur_coords.pressure;
|
||||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_context_get_paint_mode (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
GIMP_PAINT_CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
|
|||
PixelRegion srcPR;
|
||||
PixelRegion destPR;
|
||||
gdouble opacity;
|
||||
gdouble scale;
|
||||
gdouble rate;
|
||||
ConvolveClipType area_hclip = CONVOLVE_NOT_CLIPPED;
|
||||
ConvolveClipType area_vclip = CONVOLVE_NOT_CLIPPED;
|
||||
|
|
@ -220,12 +219,8 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
|
|||
if (opacity == 0.0)
|
||||
return;
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
/* configure the source pixel region */
|
||||
|
|
@ -435,7 +430,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
|
|||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
GIMP_PAINT_INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
GimpDodgeBurn *dodgeburn = GIMP_DODGE_BURN (paint_core);
|
||||
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpPressureOptions *pressure_options = paint_options->pressure_options;
|
||||
GimpImage *gimage;
|
||||
|
|
@ -202,7 +201,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
PixelRegion srcPR, destPR, tempPR;
|
||||
guchar *temp_data;
|
||||
gdouble opacity;
|
||||
gdouble scale;
|
||||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
|
|
@ -214,13 +212,8 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
if (opacity == 0.0)
|
||||
return;
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
/* Get a region which can be used to paint to */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
/* Constant painting --get a copy of the orig drawable (with no
|
||||
|
|
@ -291,7 +284,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
GIMP_PAINT_CONSTANT);
|
||||
|
||||
g_free (temp_data);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
gdouble opacity;
|
||||
TempBuf *area;
|
||||
guchar col[MAX_CHANNELS];
|
||||
gdouble scale;
|
||||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
|
|
@ -147,17 +146,12 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
if (opacity == 0.0)
|
||||
return;
|
||||
|
||||
gimp_image_get_background (gimage, drawable, context, col);
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
/* Get a region which can be used to paint to */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
gimp_image_get_background (gimage, drawable, context, col);
|
||||
|
||||
/* set the alpha channel */
|
||||
col[area->bytes - 1] = OPAQUE_OPACITY;
|
||||
|
||||
|
|
@ -174,6 +168,5 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
(options->anti_erase ?
|
||||
GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
paint_options->application_mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
|||
GimpRGB gradient_color;
|
||||
TempBuf *area;
|
||||
guchar col[MAX_CHANNELS];
|
||||
gdouble scale;
|
||||
GimpPaintApplicationMode paint_appl_mode;
|
||||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
|
@ -153,13 +152,8 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
|||
|
||||
paint_appl_mode = paint_options->application_mode;
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
/* Get a region which can be used to paint to */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
if (gimp_paint_options_get_gradient_color (paint_options, gimage,
|
||||
|
|
@ -186,7 +180,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
|||
/* if it's a pixmap, do pixmap stuff */
|
||||
gimp_brush_core_color_area_with_pixmap (brush_core, gimage, drawable,
|
||||
area,
|
||||
scale,
|
||||
brush_core->scale,
|
||||
gimp_paint_options_get_brush_mode (paint_options));
|
||||
|
||||
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
|
||||
|
|
@ -208,6 +202,5 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
|||
gimp_context_get_opacity (context),
|
||||
gimp_context_get_paint_mode (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
paint_appl_mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,18 +159,26 @@ gimp_paint_core_paint (GimpPaintCore *core,
|
|||
GimpPaintOptions *paint_options,
|
||||
GimpPaintCoreState paint_state)
|
||||
{
|
||||
GimpPaintCoreClass *core_class;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PAINT_CORE (core));
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options));
|
||||
|
||||
if (GIMP_PAINT_CORE_GET_CLASS (core)->pre_paint (core, drawable,
|
||||
paint_options,
|
||||
paint_state))
|
||||
core_class = GIMP_PAINT_CORE_GET_CLASS (core);
|
||||
|
||||
if (! core_class->pre_paint ||
|
||||
core_class->pre_paint (core, drawable,
|
||||
paint_options,
|
||||
paint_state))
|
||||
{
|
||||
/* Save coordinates for gimp_paint_core_interpolate() */
|
||||
core->last_paint.x = core->cur_coords.x;
|
||||
core->last_paint.y = core->cur_coords.y;
|
||||
if (paint_state == MOTION_PAINT)
|
||||
{
|
||||
/* Save coordinates for gimp_paint_core_interpolate() */
|
||||
core->last_paint.x = core->cur_coords.x;
|
||||
core->last_paint.y = core->cur_coords.y;
|
||||
}
|
||||
|
||||
GIMP_PAINT_CORE_GET_CLASS (core)->paint (core, drawable,
|
||||
paint_options,
|
||||
|
|
@ -184,7 +192,8 @@ gimp_paint_core_start (GimpPaintCore *core,
|
|||
GimpPaintOptions *paint_options,
|
||||
GimpCoords *coords)
|
||||
{
|
||||
GimpItem *item;
|
||||
GimpPaintCoreClass *core_class;
|
||||
GimpItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
|
@ -196,9 +205,10 @@ gimp_paint_core_start (GimpPaintCore *core,
|
|||
|
||||
core->cur_coords = *coords;
|
||||
|
||||
if (! GIMP_PAINT_CORE_GET_CLASS (core)->start (core, drawable,
|
||||
paint_options,
|
||||
coords))
|
||||
core_class = GIMP_PAINT_CORE_GET_CLASS (core);
|
||||
|
||||
if (core_class->start &&
|
||||
! core_class->start (core, drawable, paint_options, coords))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -431,13 +441,19 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
|
|||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
GimpPaintCoreClass *core_class;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PAINT_CORE (core));
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options));
|
||||
|
||||
GIMP_PAINT_CORE_GET_CLASS (core)->interpolate (core, drawable,
|
||||
paint_options);
|
||||
core_class = GIMP_PAINT_CORE_GET_CLASS (core);
|
||||
|
||||
if (core_class->interpolate)
|
||||
core_class->interpolate (core, drawable, paint_options);
|
||||
else
|
||||
core_class->paint (core, drawable, paint_options, MOTION_PAINT);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -446,14 +462,15 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
|
|||
TempBuf *
|
||||
gimp_paint_core_get_paint_area (GimpPaintCore *core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale)
|
||||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), NULL);
|
||||
|
||||
return GIMP_PAINT_CORE_GET_CLASS (core)->get_paint_area (core, drawable,
|
||||
scale);
|
||||
paint_options);
|
||||
}
|
||||
|
||||
TempBuf *
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ struct _GimpPaintCoreClass
|
|||
GimpPaintOptions *paint_options);
|
||||
|
||||
TempBuf * (* get_paint_area) (GimpPaintCore *core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale);
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ void gimp_paint_core_interpolate (GimpPaintCore *core,
|
|||
|
||||
TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
|
||||
GimpDrawable *drawable,
|
||||
gdouble scale);
|
||||
GimpPaintOptions *options);
|
||||
TempBuf * gimp_paint_core_get_orig_image (GimpPaintCore *core,
|
||||
GimpDrawable *drawable,
|
||||
gint x1,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ static void gimp_smudge_paint (GimpPaintCore *paint_core,
|
|||
GimpPaintOptions *paint_options,
|
||||
GimpPaintCoreState paint_state);
|
||||
static gboolean gimp_smudge_start (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable);
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options);
|
||||
static void gimp_smudge_motion (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options);
|
||||
|
|
@ -108,12 +109,15 @@ gimp_smudge_class_init (GimpSmudgeClass *klass)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
|
||||
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_smudge_finalize;
|
||||
object_class->finalize = gimp_smudge_finalize;
|
||||
|
||||
paint_core_class->paint = gimp_smudge_paint;
|
||||
paint_core_class->paint = gimp_smudge_paint;
|
||||
|
||||
brush_core_class->use_scale = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -150,7 +154,8 @@ gimp_smudge_paint (GimpPaintCore *paint_core,
|
|||
case MOTION_PAINT:
|
||||
/* initialization fails if the user starts outside the drawable */
|
||||
if (! smudge->initialized)
|
||||
smudge->initialized = gimp_smudge_start (paint_core, drawable);
|
||||
smudge->initialized = gimp_smudge_start (paint_core, drawable,
|
||||
paint_options);
|
||||
|
||||
if (smudge->initialized)
|
||||
gimp_smudge_motion (paint_core, drawable, paint_options);
|
||||
|
|
@ -173,8 +178,9 @@ gimp_smudge_paint (GimpPaintCore *paint_core,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_smudge_start (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable)
|
||||
gimp_smudge_start (GimpPaintCore *paint_core,
|
||||
GimpDrawable *drawable,
|
||||
GimpPaintOptions *paint_options)
|
||||
{
|
||||
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
||||
GimpImage *gimage;
|
||||
|
|
@ -187,7 +193,8 @@ gimp_smudge_start (GimpPaintCore *paint_core,
|
|||
if (gimp_drawable_is_indexed (drawable))
|
||||
return FALSE;
|
||||
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, 1.0)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return FALSE;
|
||||
|
||||
/* adjust the x and y coordinates to the upper left corner of the brush */
|
||||
|
|
@ -276,7 +283,8 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||
gimp_smudge_nonclipped_painthit_coords (paint_core, &x, &y, &w, &h);
|
||||
|
||||
/* Get the paint area (Smudge won't scale!) */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, 1.0)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
/* srcPR will be the pixels under the current painthit from the drawable */
|
||||
|
|
@ -345,7 +353,6 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
1.0,
|
||||
GIMP_PAINT_INCREMENTAL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,6 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
PixelRegion srcPR, destPR;
|
||||
GimpPattern *pattern = NULL;
|
||||
gdouble opacity;
|
||||
gdouble scale;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
|
|
@ -307,13 +306,8 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
has_alpha = gimp_drawable_has_alpha (clone->src_drawable);
|
||||
}
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
/* Get a region which can be used to paint to */
|
||||
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
|
||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
||||
if (! area)
|
||||
return;
|
||||
|
||||
switch (options->clone_type)
|
||||
|
|
@ -431,13 +425,11 @@ gimp_clone_motion (GimpPaintCore *paint_core,
|
|||
if (pressure_options->opacity)
|
||||
opacity *= PRESSURE_SCALE * paint_core->cur_coords.pressure;
|
||||
|
||||
/* paste the newly painted canvas to the gimage which is being worked on */
|
||||
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_context_get_paint_mode (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
scale,
|
||||
GIMP_PAINT_CONSTANT);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue