[gimp/soc-2009-dynamics] Handle dynamic opacity in GimpSourceCore for all its subclasses
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp/soc-2009-dynamics] Handle dynamic opacity in GimpSourceCore for all its subclasses
- Date: Tue, 13 Oct 2009 19:03:22 +0000 (UTC)
commit 8394a3db681456aef9bec63618bf361e2ed8283f
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 13 21:02:10 2009 +0200
Handle dynamic opacity in GimpSourceCore for all its subclasses
app/paint/gimpclone.c | 16 ++++++++--------
app/paint/gimpheal.c | 13 ++++++++-----
app/paint/gimpsourcecore.c | 12 ++++++++++--
3 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c
index ab87061..f1f0e04 100644
--- a/app/paint/gimpclone.c
+++ b/app/paint/gimpclone.c
@@ -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,
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index b001eb1..4e33173 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -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,
diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c
index 6dedb5f..524b338 100644
--- a/app/paint/gimpsourcecore.c
+++ b/app/paint/gimpsourcecore.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]