Handle dynamic opacity in GimpSourceCore for all its subclasses

This commit is contained in:
Michael Natterer 2009-10-13 21:02:10 +02:00
parent de3bfcd25c
commit 8394a3db68
3 changed files with 26 additions and 15 deletions

View File

@ -168,21 +168,18 @@ gimp_clone_motion (GimpSourceCore *source_core,
GimpCloneOptions *options = GIMP_CLONE_OPTIONS (paint_options);
GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpImage *src_image = NULL;
GimpImageType src_type = 0;
GimpImageType dest_type;
GimpImage *image;
gpointer pr = NULL;
gint y;
PixelRegion destPR;
GimpPattern *pattern = NULL;
gdouble fade_point;
gdouble hardness;
gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
paint_core->pixel_dist);
image = gimp_item_get_image (GIMP_ITEM (drawable));
switch (options->clone_type)
{
case GIMP_IMAGE_CLONE:
@ -243,9 +240,12 @@ gimp_clone_motion (GimpSourceCore *source_core,
}
}
opacity *= gimp_dynamics_output_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics->opacity_output, *coords, fade_point);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
hardness = gimp_dynamics_output_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics->hardness_output, *coords, fade_point);
hardness = gimp_dynamics_output_get_linear_value (dynamics->hardness_output,
*coords,
fade_point);
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,

View File

@ -432,6 +432,8 @@ gimp_heal_motion (GimpSourceCore *source_core,
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
TempBuf *src;
TempBuf *temp;
PixelRegion origPR;
@ -439,12 +441,15 @@ gimp_heal_motion (GimpSourceCore *source_core,
PixelRegion destPR;
GimpImageType src_type;
TempBuf *mask_buf;
gdouble fade_point;
gdouble hardness;
gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
paint_core->pixel_dist);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
hardness = gimp_dynamics_output_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics->hardness_output, *coords, fade_point);
hardness = gimp_dynamics_output_get_linear_value (dynamics->hardness_output,
*coords,
fade_point);
mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
coords,
@ -552,8 +557,6 @@ gimp_heal_motion (GimpSourceCore *source_core,
temp_buf_free (temp);
opacity *= gimp_dynamics_output_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics->opacity_output, *coords, fade_point);
/* replace the canvas with our healed data */
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,

View File

@ -29,6 +29,8 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
@ -345,6 +347,7 @@ gimp_source_core_motion (GimpSourceCore *source_core,
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpSourceOptions *options = GIMP_SOURCE_OPTIONS (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpPickable *src_pickable = NULL;
PixelRegion srcPR;
@ -355,10 +358,15 @@ gimp_source_core_motion (GimpSourceCore *source_core,
gint paint_area_offset_y;
gint paint_area_width;
gint paint_area_height;
gdouble fade_point;
gdouble opacity;
opacity = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (dynamics->opacity_output,
*coords,
fade_point);
if (opacity == 0.0)
return;