[gimp/soc-2009-dynamics] Write dynamics objects separately. Needs debug.
- From: zhenfeng zhao <zhenfengz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp/soc-2009-dynamics] Write dynamics objects separately. Needs debug.
- Date: Tue, 21 Jul 2009 10:35:04 +0000 (UTC)
commit 8e0a214121a62293f23f92f4ed61d2332923727b
Author: zhenfeng zhao <zhzzf_0808 hotmail com>
Date: Sun Jul 5 15:03:34 2009 -0300
Write dynamics objects separately. Needs debug.
app/paint/gimpdynamicsoptions.c | 1647 ---------------------------------------
app/paint/gimpdynamicsoptions.h | 117 ---
app/paint/gimppaintoptions.c | 1517 +-----------------------------------
app/paint/gimppaintoptions.h | 53 --
4 files changed, 4 insertions(+), 3330 deletions(-)
---
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index a4ab651..9b8e065 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -34,7 +34,6 @@
#include "gimp-intl.h"
-#include "core/gimpcoords.h"
#define DEFAULT_BRUSH_SCALE 1.0
#define DEFAULT_BRUSH_ASPECT_RATIO 1.0
@@ -43,68 +42,6 @@
#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
#define DEFAULT_HARD FALSE
-#define DEFAULT_DYNAMICS_EXPANDED FALSE
-
-#define DEFAULT_PRESSURE_OPACITY TRUE
-#define DEFAULT_PRESSURE_HARDNESS FALSE
-#define DEFAULT_PRESSURE_RATE FALSE
-#define DEFAULT_PRESSURE_SIZE FALSE
-#define DEFAULT_PRESSURE_INVERSE_SIZE FALSE
-#define DEFAULT_PRESSURE_ASPECT_RATIO FALSE
-#define DEFAULT_PRESSURE_COLOR FALSE
-#define DEFAULT_PRESSURE_ANGLE FALSE
-#define DEFAULT_PRESSURE_PRESCALE 1.0
-
-#define DEFAULT_VELOCITY_OPACITY FALSE
-#define DEFAULT_VELOCITY_HARDNESS FALSE
-#define DEFAULT_VELOCITY_RATE FALSE
-#define DEFAULT_VELOCITY_SIZE FALSE
-#define DEFAULT_VELOCITY_INVERSE_SIZE FALSE
-#define DEFAULT_VELOCITY_ASPECT_RATIO FALSE
-#define DEFAULT_VELOCITY_COLOR FALSE
-#define DEFAULT_VELOCITY_ANGLE FALSE
-#define DEFAULT_VELOCITY_PRESCALE 1.0
-
-#define DEFAULT_DIRECTION_OPACITY FALSE
-#define DEFAULT_DIRECTION_HARDNESS FALSE
-#define DEFAULT_DIRECTION_RATE FALSE
-#define DEFAULT_DIRECTION_SIZE FALSE
-#define DEFAULT_DIRECTION_INVERSE_SIZE FALSE
-#define DEFAULT_DIRECTION_ASPECT_RATIO FALSE
-#define DEFAULT_DIRECTION_COLOR FALSE
-#define DEFAULT_DIRECTION_ANGLE FALSE
-#define DEFAULT_DIRECTION_PRESCALE 1.0
-
-#define DEFAULT_TILT_OPACITY FALSE
-#define DEFAULT_TILT_HARDNESS FALSE
-#define DEFAULT_TILT_RATE FALSE
-#define DEFAULT_TILT_SIZE FALSE
-#define DEFAULT_TILT_INVERSE_SIZE FALSE
-#define DEFAULT_TILT_ASPECT_RATIO FALSE
-#define DEFAULT_TILT_COLOR FALSE
-#define DEFAULT_TILT_ANGLE FALSE
-#define DEFAULT_TILT_PRESCALE 1.0
-
-#define DEFAULT_RANDOM_OPACITY FALSE
-#define DEFAULT_RANDOM_HARDNESS FALSE
-#define DEFAULT_RANDOM_RATE FALSE
-#define DEFAULT_RANDOM_SIZE FALSE
-#define DEFAULT_RANDOM_INVERSE_SIZE FALSE
-#define DEFAULT_RANDOM_ASPECT_RATIO FALSE
-#define DEFAULT_RANDOM_COLOR FALSE
-#define DEFAULT_RANDOM_ANGLE FALSE
-#define DEFAULT_RANDOM_PRESCALE 1.0
-
-#define DEFAULT_FADING_OPACITY FALSE
-#define DEFAULT_FADING_HARDNESS FALSE
-#define DEFAULT_FADING_RATE FALSE
-#define DEFAULT_FADING_SIZE FALSE
-#define DEFAULT_FADING_INVERSE_SIZE FALSE
-#define DEFAULT_FADING_ASPECT_RATIO FALSE
-#define DEFAULT_FADING_COLOR FALSE
-#define DEFAULT_FADING_ANGLE FALSE
-#define DEFAULT_FADING_PRESCALE 1.0
-
#define DEFAULT_USE_FADE FALSE
#define DEFAULT_FADE_LENGTH 100.0
#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
@@ -132,68 +69,6 @@ enum
PROP_APPLICATION_MODE,
PROP_HARD,
- PROP_DYNAMICS_EXPANDED,
-
- PROP_PRESSURE_OPACITY,
- PROP_PRESSURE_HARDNESS,
- PROP_PRESSURE_RATE,
- PROP_PRESSURE_SIZE,
- PROP_PRESSURE_INVERSE_SIZE,
- PROP_PRESSURE_ASPECT_RATIO,
- PROP_PRESSURE_COLOR,
- PROP_PRESSURE_ANGLE,
- PROP_PRESSURE_PRESCALE,
-
- PROP_VELOCITY_OPACITY,
- PROP_VELOCITY_HARDNESS,
- PROP_VELOCITY_RATE,
- PROP_VELOCITY_SIZE,
- PROP_VELOCITY_INVERSE_SIZE,
- PROP_VELOCITY_ASPECT_RATIO,
- PROP_VELOCITY_COLOR,
- PROP_VELOCITY_ANGLE,
- PROP_VELOCITY_PRESCALE,
-
- PROP_DIRECTION_OPACITY,
- PROP_DIRECTION_HARDNESS,
- PROP_DIRECTION_RATE,
- PROP_DIRECTION_SIZE,
- PROP_DIRECTION_INVERSE_SIZE,
- PROP_DIRECTION_ASPECT_RATIO,
- PROP_DIRECTION_COLOR,
- PROP_DIRECTION_ANGLE,
- PROP_DIRECTION_PRESCALE,
-
- PROP_TILT_OPACITY,
- PROP_TILT_HARDNESS,
- PROP_TILT_RATE,
- PROP_TILT_SIZE,
- PROP_TILT_INVERSE_SIZE,
- PROP_TILT_ASPECT_RATIO,
- PROP_TILT_COLOR,
- PROP_TILT_ANGLE,
- PROP_TILT_PRESCALE,
-
- PROP_RANDOM_OPACITY,
- PROP_RANDOM_HARDNESS,
- PROP_RANDOM_RATE,
- PROP_RANDOM_SIZE,
- PROP_RANDOM_INVERSE_SIZE,
- PROP_RANDOM_ASPECT_RATIO,
- PROP_RANDOM_COLOR,
- PROP_RANDOM_ANGLE,
- PROP_RANDOM_PRESCALE,
-
- PROP_FADING_OPACITY,
- PROP_FADING_HARDNESS,
- PROP_FADING_RATE,
- PROP_FADING_SIZE,
- PROP_FADING_INVERSE_SIZE,
- PROP_FADING_ASPECT_RATIO,
- PROP_FADING_COLOR,
- PROP_FADING_ANGLE,
- PROP_FADING_PRESCALE,
-
PROP_USE_FADE,
PROP_FADE_LENGTH,
PROP_FADE_UNIT,
@@ -228,18 +103,6 @@ static void gimp_paint_options_get_property (GObject *object,
static void gimp_paint_options_notify (GObject *object,
GParamSpec *pspec);
-static gdouble gimp_paint_options_get_dynamics_mix (gdouble mix1,
- gdouble mix1_scale,
- gdouble mix2,
- gdouble mix2_scale,
- gdouble mix3,
- gdouble mix3_scale,
- gdouble mix4,
- gdouble mix4_scale,
- gdouble mix5,
- gdouble mix5_scale,
- gdouble mix6,
- gdouble mix6_scale);
G_DEFINE_TYPE (GimpPaintOptions, gimp_paint_options, GIMP_TYPE_TOOL_OPTIONS)
@@ -288,225 +151,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
DEFAULT_HARD,
GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DYNAMICS_EXPANDED,
- "dynamics-expanded", NULL,
- DEFAULT_DYNAMICS_EXPANDED,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_OPACITY,
- "pressure-opacity", NULL,
- DEFAULT_PRESSURE_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_HARDNESS,
- "pressure-hardness", NULL,
- DEFAULT_PRESSURE_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_RATE,
- "pressure-rate", NULL,
- DEFAULT_PRESSURE_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_SIZE,
- "pressure-size", NULL,
- DEFAULT_PRESSURE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_COLOR,
- "pressure-color", NULL,
- DEFAULT_PRESSURE_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_ANGLE,
- "pressure-angle", NULL,
- DEFAULT_PRESSURE_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_INVERSE_SIZE,
- "pressure-inverse-size", NULL,
- DEFAULT_PRESSURE_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_ASPECT_RATIO,
- "pressure-aspect-ratio", NULL,
- DEFAULT_PRESSURE_ASPECT_RATIO,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PRESSURE_PRESCALE,
- "pressure-prescale", NULL,
- 0.0, 1.0, DEFAULT_PRESSURE_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_OPACITY,
- "velocity-opacity", NULL,
- DEFAULT_VELOCITY_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_HARDNESS,
- "velocity-hardness", NULL,
- DEFAULT_VELOCITY_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_RATE,
- "velocity-rate", NULL,
- DEFAULT_VELOCITY_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_SIZE,
- "velocity-size", NULL,
- DEFAULT_VELOCITY_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_COLOR,
- "velocity-color", NULL,
- DEFAULT_VELOCITY_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_ANGLE,
- "velocity-angle", NULL,
- DEFAULT_VELOCITY_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_INVERSE_SIZE,
- "velocity-inverse-size", NULL,
- DEFAULT_VELOCITY_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_ASPECT_RATIO,
- "velocity-aspect-ratio", NULL,
- DEFAULT_VELOCITY_ASPECT_RATIO,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_VELOCITY_PRESCALE,
- "velocity-prescale", NULL,
- 0.0, 1.0, DEFAULT_VELOCITY_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_OPACITY,
- "direction-opacity", NULL,
- DEFAULT_DIRECTION_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_HARDNESS,
- "direction-hardness", NULL,
- DEFAULT_DIRECTION_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_RATE,
- "direction-rate", NULL,
- DEFAULT_DIRECTION_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_SIZE,
- "direction-size", NULL,
- DEFAULT_DIRECTION_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_COLOR,
- "direction-color", NULL,
- DEFAULT_DIRECTION_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_ANGLE,
- "direction-angle", NULL,
- DEFAULT_DIRECTION_ANGLE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_INVERSE_SIZE,
- "direction-inverse-size", NULL,
- DEFAULT_DIRECTION_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_ASPECT_RATIO,
- "direction-aspect-ratio", NULL,
- DEFAULT_DIRECTION_ASPECT_RATIO,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_DIRECTION_PRESCALE,
- "direction-prescale", NULL,
- 0.0, 1.0, DEFAULT_DIRECTION_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_OPACITY,
- "tilt-opacity", NULL,
- DEFAULT_TILT_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_HARDNESS,
- "tilt-hardness", NULL,
- DEFAULT_TILT_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_RATE,
- "tilt-rate", NULL,
- DEFAULT_TILT_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_SIZE,
- "tilt-size", NULL,
- DEFAULT_TILT_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_COLOR,
- "tilt-color", NULL,
- DEFAULT_TILT_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_ANGLE,
- "tilt-angle", NULL,
- DEFAULT_TILT_ANGLE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_INVERSE_SIZE,
- "tilt-inverse-size", NULL,
- DEFAULT_TILT_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_ASPECT_RATIO,
- "tilt-aspect-ratio", NULL,
- DEFAULT_TILT_ASPECT_RATIO,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_PRESCALE,
- "tilt-prescale", NULL,
- 0.0, 1.0, DEFAULT_TILT_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_OPACITY,
- "random-opacity", NULL,
- DEFAULT_RANDOM_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_HARDNESS,
- "random-hardness", NULL,
- DEFAULT_RANDOM_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_RATE,
- "random-rate", NULL,
- DEFAULT_RANDOM_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_SIZE,
- "random-size", NULL,
- DEFAULT_RANDOM_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_COLOR,
- "random-color", NULL,
- DEFAULT_RANDOM_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_ANGLE,
- "random-angle", NULL,
- DEFAULT_RANDOM_ANGLE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_INVERSE_SIZE,
- "random-inverse-size", NULL,
- DEFAULT_RANDOM_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_RANDOM_PRESCALE,
- "random-prescale", NULL,
- 0.0, 1.0, DEFAULT_RANDOM_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_OPACITY,
- "fading-opacity", NULL,
- DEFAULT_FADING_OPACITY,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_HARDNESS,
- "fading-hardness", NULL,
- DEFAULT_FADING_HARDNESS,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_RATE,
- "fading-rate", NULL,
- DEFAULT_FADING_RATE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_SIZE,
- "fading-size", NULL,
- DEFAULT_FADING_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_COLOR,
- "fading-color", NULL,
- DEFAULT_FADING_COLOR,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_ANGLE,
- "fading-angle", NULL,
- DEFAULT_FADING_ANGLE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_INVERSE_SIZE,
- "fading-inverse-size", NULL,
- DEFAULT_FADING_INVERSE_SIZE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FADING_PRESCALE,
- "fading-prescale", NULL,
- 0.0, 1.0, DEFAULT_FADING_PRESCALE,
- GIMP_PARAM_STATIC_STRINGS);
-
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_FADE,
"use-fade", NULL,
DEFAULT_USE_FADE,
@@ -600,12 +244,6 @@ gimp_paint_options_init (GimpPaintOptions *options)
{
options->application_mode_save = DEFAULT_APPLICATION_MODE;
- options->pressure_options = g_slice_new0 (GimpDynamicOptions);
- options->velocity_options = g_slice_new0 (GimpDynamicOptions);
- options->direction_options = g_slice_new0 (GimpDynamicOptions);
- options->tilt_options = g_slice_new0 (GimpDynamicOptions);
- options->random_options = g_slice_new0 (GimpDynamicOptions);
- options->fading_options = g_slice_new0 (GimpDynamicOptions);
options->fade_options = g_slice_new0 (GimpFadeOptions);
options->jitter_options = g_slice_new0 (GimpJitterOptions);
options->gradient_options = g_slice_new0 (GimpGradientOptions);
@@ -619,12 +257,6 @@ gimp_paint_options_finalize (GObject *object)
if (options->paint_info)
g_object_unref (options->paint_info);
- g_slice_free (GimpDynamicOptions, options->pressure_options);
- g_slice_free (GimpDynamicOptions, options->velocity_options);
- g_slice_free (GimpDynamicOptions, options->direction_options);
- g_slice_free (GimpDynamicOptions, options->tilt_options);
- g_slice_free (GimpDynamicOptions, options->random_options);
- g_slice_free (GimpDynamicOptions, options->fading_options);
g_slice_free (GimpFadeOptions, options->fade_options);
g_slice_free (GimpJitterOptions, options->jitter_options);
g_slice_free (GimpGradientOptions, options->gradient_options);
@@ -639,12 +271,6 @@ gimp_paint_options_set_property (GObject *object,
GParamSpec *pspec)
{
GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
- GimpDynamicOptions *pressure_options = options->pressure_options;
- GimpDynamicOptions *velocity_options = options->velocity_options;
- GimpDynamicOptions *direction_options = options->direction_options;
- GimpDynamicOptions *tilt_options = options->tilt_options;
- GimpDynamicOptions *random_options = options->random_options;
- GimpDynamicOptions *fading_options = options->fading_options;
GimpFadeOptions *fade_options = options->fade_options;
GimpJitterOptions *jitter_options = options->jitter_options;
GimpGradientOptions *gradient_options = options->gradient_options;
@@ -675,226 +301,6 @@ gimp_paint_options_set_property (GObject *object,
options->hard = g_value_get_boolean (value);
break;
- case PROP_DYNAMICS_EXPANDED:
- options->dynamics_expanded = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_OPACITY:
- pressure_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_HARDNESS:
- pressure_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_RATE:
- pressure_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_SIZE:
- pressure_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_INVERSE_SIZE:
- pressure_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_ASPECT_RATIO:
- pressure_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_COLOR:
- pressure_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_ANGLE:
- pressure_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_PRESSURE_PRESCALE:
- pressure_options->prescale = g_value_get_double (value);
- break;
-
- case PROP_VELOCITY_OPACITY:
- velocity_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_HARDNESS:
- velocity_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_RATE:
- velocity_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_SIZE:
- velocity_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_INVERSE_SIZE:
- velocity_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_ASPECT_RATIO:
- velocity_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_COLOR:
- velocity_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_ANGLE:
- velocity_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_VELOCITY_PRESCALE:
- velocity_options->prescale = g_value_get_double (value);
- break;
-
- case PROP_DIRECTION_OPACITY:
- direction_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_HARDNESS:
- direction_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_RATE:
- direction_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_SIZE:
- direction_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_INVERSE_SIZE:
- direction_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_ASPECT_RATIO:
- direction_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_COLOR:
- direction_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_ANGLE:
- direction_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_DIRECTION_PRESCALE:
- direction_options->prescale = g_value_get_double (value);
- break;
-
- case PROP_TILT_OPACITY:
- tilt_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_HARDNESS:
- tilt_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_RATE:
- tilt_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_SIZE:
- tilt_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_INVERSE_SIZE:
- tilt_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_ASPECT_RATIO:
- tilt_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_COLOR:
- tilt_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_ANGLE:
- tilt_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_TILT_PRESCALE:
- tilt_options->prescale = g_value_get_double (value);
- break;
-
- case PROP_RANDOM_OPACITY:
- random_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_HARDNESS:
- random_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_RATE:
- random_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_SIZE:
- random_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_INVERSE_SIZE:
- random_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_ASPECT_RATIO:
- random_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_COLOR:
- random_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_ANGLE:
- random_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_RANDOM_PRESCALE:
- random_options->prescale = g_value_get_double (value);
- break;
-/*Fading*/
- case PROP_FADING_OPACITY:
- fading_options->opacity = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_HARDNESS:
- fading_options->hardness = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_RATE:
- fading_options->rate = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_SIZE:
- fading_options->size = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_INVERSE_SIZE:
- fading_options->inverse_size = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_ASPECT_RATIO:
- fading_options->aspect_ratio = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_COLOR:
- fading_options->color = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_ANGLE:
- fading_options->angle = g_value_get_boolean (value);
- break;
-
- case PROP_FADING_PRESCALE:
- fading_options->prescale = g_value_get_double (value);
- break;
-
case PROP_USE_FADE:
fade_options->use_fade = g_value_get_boolean (value);
break;
@@ -972,12 +378,6 @@ gimp_paint_options_get_property (GObject *object,
GParamSpec *pspec)
{
GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
- GimpDynamicOptions *pressure_options = options->pressure_options;
- GimpDynamicOptions *velocity_options = options->velocity_options;
- GimpDynamicOptions *direction_options = options->direction_options;
- GimpDynamicOptions *tilt_options = options->tilt_options;
- GimpDynamicOptions *random_options = options->random_options;
- GimpDynamicOptions *fading_options = options->fading_options;
GimpFadeOptions *fade_options = options->fade_options;
GimpJitterOptions *jitter_options = options->jitter_options;
GimpGradientOptions *gradient_options = options->gradient_options;
@@ -1008,293 +408,6 @@ gimp_paint_options_get_property (GObject *object,
g_value_set_boolean (value, options->hard);
break;
- case PROP_DYNAMICS_EXPANDED:
- g_value_set_boolean (value, options->dynamics_expanded);
- break;
-
- case PROP_PRESSURE_OPACITY:
- g_value_set_boolean (value, pressure_options->opacity);
- break;
-
- case PROP_PRESSURE_HARDNESS:
- g_value_set_boolean (value, pressure_options->hardness);
- break;
-
- case PROP_PRESSURE_RATE:
- g_value_set_boolean (value, pressure_options->rate);
- break;
-
- case PROP_PRESSURE_SIZE:
- g_value_set_boolean (value, pressure_options->size);
- break;
-
- case PROP_PRESSURE_INVERSE_SIZE:
- g_value_set_boolean (value, pressure_options->inverse_size);
- break;
-
- case PROP_PRESSURE_ASPECT_RATIO:
- g_value_set_boolean (value, pressure_options->aspect_ratio);
- break;
-
- case PROP_PRESSURE_COLOR:
- g_value_set_boolean (value, pressure_options->color);
- break;
-
- case PROP_PRESSURE_ANGLE:
- g_value_set_boolean (value, pressure_options->angle);
- break;
-
- case PROP_PRESSURE_PRESCALE:
- g_value_set_double (value, pressure_options->prescale);
- break;
-
- case PROP_VELOCITY_OPACITY:
- g_value_set_boolean (value, velocity_options->opacity);
- break;
-
- case PROP_VELOCITY_HARDNESS:
- g_value_set_boolean (value, velocity_options->hardness);
- break;
-
- case PROP_VELOCITY_RATE:
- g_value_set_boolean (value, velocity_options->rate);
- break;
-
- case PROP_VELOCITY_SIZE:
- g_value_set_boolean (value, velocity_options->size);
- break;
-
- case PROP_VELOCITY_INVERSE_SIZE:
- g_value_set_boolean (value, velocity_options->inverse_size);
- break;
-
- case PROP_VELOCITY_ASPECT_RATIO:
- g_value_set_boolean (value, velocity_options->aspect_ratio);
- break;
-
- case PROP_VELOCITY_COLOR:
- g_value_set_boolean (value, velocity_options->color);
- break;
-
- case PROP_VELOCITY_ANGLE:
- g_value_set_boolean (value, velocity_options->angle);
- break;
-
- case PROP_VELOCITY_PRESCALE:
- g_value_set_double (value, velocity_options->prescale);
- break;
-
- case PROP_DIRECTION_OPACITY:
- g_value_set_boolean (value, direction_options->opacity);
- break;
-
- case PROP_DIRECTION_HARDNESS:
- g_value_set_boolean (value, direction_options->hardness);
- break;
-
- case PROP_DIRECTION_RATE:
- g_value_set_boolean (value, direction_options->rate);
- break;
-
- case PROP_DIRECTION_SIZE:
- g_value_set_boolean (value, direction_options->size);
- break;
-
- case PROP_DIRECTION_INVERSE_SIZE:
- g_value_set_boolean (value, direction_options->inverse_size);
- break;
-
- case PROP_DIRECTION_ASPECT_RATIO:
- g_value_set_boolean (value, direction_options->aspect_ratio);
- break;
-
- case PROP_DIRECTION_COLOR:
- g_value_set_boolean (value, direction_options->color);
- break;
-
- case PROP_DIRECTION_ANGLE:
- g_value_set_boolean (value, direction_options->angle);
- break;
-
- case PROP_DIRECTION_PRESCALE:
- g_value_set_double (value, direction_options->prescale);
- break;
-
-
- case PROP_TILT_OPACITY:
- g_value_set_boolean (value, tilt_options->opacity);
- break;
-
- case PROP_TILT_HARDNESS:
- g_value_set_boolean (value, tilt_options->hardness);
- break;
-
- case PROP_TILT_RATE:
- g_value_set_boolean (value, tilt_options->rate);
- break;
-
- case PROP_TILT_SIZE:
- g_value_set_boolean (value, tilt_options->size);
- break;
-
- case PROP_TILT_INVERSE_SIZE:
- g_value_set_boolean (value, tilt_options->inverse_size);
- break;
-
- case PROP_TILT_ASPECT_RATIO:
- g_value_set_boolean (value, tilt_options->aspect_ratio);
- break;
-
- case PROP_TILT_COLOR:
- g_value_set_boolean (value, tilt_options->color);
- break;
-
- case PROP_TILT_ANGLE:
- g_value_set_boolean (value, tilt_options->angle);
- break;
-
- case PROP_TILT_PRESCALE:
- g_value_set_double (value, tilt_options->prescale);
- break;
-
- case PROP_RANDOM_OPACITY:
- g_value_set_boolean (value, random_options->opacity);
- break;
-
- case PROP_RANDOM_HARDNESS:
- g_value_set_boolean (value, random_options->hardness);
- break;
-
- case PROP_RANDOM_RATE:
- g_value_set_boolean (value, random_options->rate);
- break;
-
- case PROP_RANDOM_SIZE:
- g_value_set_boolean (value, random_options->size);
- break;
-
- case PROP_RANDOM_INVERSE_SIZE:
- g_value_set_boolean (value, random_options->inverse_size);
- break;
-
- case PROP_RANDOM_ASPECT_RATIO:
- g_value_set_boolean (value, random_options->aspect_ratio);
- break;
-
- case PROP_RANDOM_COLOR:
- g_value_set_boolean (value, random_options->color);
- break;
-
- case PROP_RANDOM_ANGLE:
- g_value_set_boolean (value, random_options->angle);
- break;
-
- case PROP_RANDOM_PRESCALE:
- g_value_set_double (value, random_options->prescale);
- break;
-
-/*fading*/
-
- case PROP_FADING_OPACITY:
- g_value_set_boolean (value, fading_options->opacity);
- break;
-
- case PROP_FADING_HARDNESS:
- g_value_set_boolean (value, fading_options->hardness);
- break;
-
- case PROP_FADING_RATE:
- g_value_set_boolean (value, fading_options->rate);
- break;
-
- case PROP_FADING_SIZE:
- g_value_set_boolean (value, fading_options->size);
- break;
-
- case PROP_FADING_INVERSE_SIZE:
- g_value_set_boolean (value, fading_options->inverse_size);
- break;
-
- case PROP_FADING_ASPECT_RATIO:
- g_value_set_boolean (value, fading_options->aspect_ratio);
- break;
-
- case PROP_FADING_COLOR:
- g_value_set_boolean (value, fading_options->color);
- break;
-
- case PROP_FADING_ANGLE:
- g_value_set_boolean (value, fading_options->angle);
- break;
-
- case PROP_FADING_PRESCALE:
- g_value_set_double (value, fading_options->prescale);
- break;
-
- case PROP_USE_FADE:
- g_value_set_boolean (value, fade_options->use_fade);
- break;
-
- case PROP_FADE_LENGTH:
- g_value_set_double (value, fade_options->fade_length);
- break;
-
- case PROP_FADE_UNIT:
- g_value_set_int (value, fade_options->fade_unit);
- break;
-
- case PROP_USE_JITTER:
- g_value_set_boolean (value, jitter_options->use_jitter);
- break;
-
- case PROP_JITTER_AMOUNT:
- g_value_set_double (value, jitter_options->jitter_amount);
- break;
-
- case PROP_USE_GRADIENT:
- g_value_set_boolean (value, gradient_options->use_gradient);
- break;
-
- case PROP_GRADIENT_REVERSE:
- g_value_set_boolean (value, gradient_options->gradient_reverse);
- break;
-
- case PROP_GRADIENT_REPEAT:
- g_value_set_enum (value, gradient_options->gradient_repeat);
- break;
-
- case PROP_GRADIENT_LENGTH:
- g_value_set_double (value, gradient_options->gradient_length);
- break;
-
- case PROP_GRADIENT_UNIT:
- g_value_set_int (value, gradient_options->gradient_unit);
- break;
-
- case PROP_BRUSH_VIEW_TYPE:
- g_value_set_enum (value, options->brush_view_type);
- break;
-
- case PROP_BRUSH_VIEW_SIZE:
- g_value_set_int (value, options->brush_view_size);
- break;
-
- case PROP_PATTERN_VIEW_TYPE:
- g_value_set_enum (value, options->pattern_view_type);
- break;
-
- case PROP_PATTERN_VIEW_SIZE:
- g_value_set_int (value, options->pattern_view_size);
- break;
-
- case PROP_GRADIENT_VIEW_TYPE:
- g_value_set_enum (value, options->gradient_view_type);
- break;
-
- case PROP_GRADIENT_VIEW_SIZE:
- g_value_set_int (value, options->gradient_view_size);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1384,13 +497,7 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
MAX (xres, yres) / unit_factor);
}
break;
-
-
- //printf("fade_out: %f", fade_out);
- //printf("pixel_dist: %f", pixel_dist);
}
- //printf("fade_out: %f", fade_out);
- //printf("pixel_dist: %f", pixel_dist);
/* factor in the fade out value */
if (fade_out > 0.0)
@@ -1399,7 +506,7 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
/* Model the amount of paint left as a gaussian curve */
x = pixel_dist / fade_out;
- z = exp (- x * x * 5.541);
+ z = exp (- x * x * 5.541);
return z; /* ln (1/255) */
}
@@ -1443,7 +550,7 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
gradient_options = paint_options->gradient_options;
gradient = gimp_context_get_gradient (GIMP_CONTEXT (paint_options));
-
+/*
if (paint_options->pressure_options->color ||
paint_options->velocity_options->color ||
paint_options->direction_options->color ||
@@ -1458,6 +565,8 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
return TRUE;
}
+*/
+
else if (gradient_options->use_gradient)
{
gdouble gradient_length = 0.0;
@@ -1531,622 +640,4 @@ gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options)
}
-/* Calculates dynamics mix to be used for same parameter
- * (velocity/pressure/direction/tilt/random) mix Needed in may places and tools.
- *
- * Added one parameter: fading, the 6th driving factor.
- * (velocity/pressure/direction/tilt/random/fading)
- */
-static gdouble
-gimp_paint_options_get_dynamics_mix (gdouble mix1,
- gdouble mix1_scale,
- gdouble mix2,
- gdouble mix2_scale,
- gdouble mix3,
- gdouble mix3_scale,
- gdouble mix4,
- gdouble mix4_scale,
- gdouble mix5,
- gdouble mix5_scale,
- gdouble mix6,
- gdouble mix6_scale)
-{
- gdouble scale_sum = 0.0;
- gdouble result = 1.0;
-
- if (mix1 > -1.0)
- {
- scale_sum += fabs (mix1_scale);
- }
- else mix1 = 0.0;
-
- if (mix2 > -1.0)
- {
- scale_sum += fabs (mix2_scale);
- }
- else mix2 = 0.0;
- if (mix3 > -1.0)
- {
- scale_sum += fabs (mix3_scale);
- }
- else mix3 = 0.0;
-
- if (mix4 > -1.0)
- {
- scale_sum += fabs (mix4_scale);
- }
- else mix4 = 0.0;
-
- if (mix5 > -1.0)
- {
- scale_sum += fabs (mix5_scale);
- }
- else mix5 = 0.0;
-
- if (mix6 > -1.0)
- {
- scale_sum += fabs (mix6_scale);
- }
- else mix6 = 0.0;
-
- if (scale_sum > 0.0)
- {
- result = (mix1 * mix1_scale) / scale_sum +
- (mix2 * mix2_scale) / scale_sum +
- (mix3 * mix3_scale) / scale_sum +
- (mix4 * mix4_scale) / scale_sum +
- (mix5 * mix5_scale) / scale_sum +
- (mix6 * mix6_scale) / scale_sum;
- }
-
- if (result < 0.0)
- result = 1.0 + result;
-
- return MAX (0.0, result);
-}
-
-gdouble
-gimp_paint_options_get_dynamic_opacity (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble opacity = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->opacity ||
- paint_options->velocity_options->opacity ||
- paint_options->direction_options->opacity ||
- paint_options->tilt_options->opacity ||
- paint_options->random_options->opacity||
- paint_options->fading_options->opacity)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble tilt = -1.0;
- gdouble random = -1.0;
- gdouble fading = -1.0;
-
-
- if (paint_options->pressure_options->opacity)
- pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
-
- if (paint_options->velocity_options->opacity)
- velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
- //printf("velocity: %f", velocity);
-
- if (paint_options->random_options->opacity)
- random = g_random_double_range (0.0, 1.0);
- //printf("%f", random);
-
- if (paint_options->tilt_options->opacity)
- tilt = 1.0 - sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
-
- if (paint_options->direction_options->opacity)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
- if (paint_options->fading_options->opacity)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- /*
- printf("fade_out: %f", fade_out);
- printf("pixel_dist: %f", pixel_dist);
- printf("fading value: %f", fading);
- */
- //printf("fading-cor: %f", coords->fading);
-
- }
-
- opacity = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- }
-
- return opacity;
-}
-
-gdouble
-gimp_paint_options_get_dynamic_size (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gboolean use_dynamics,
- gdouble pixel_dist)
-{
- gdouble scale = 1.0;
-
- if (use_dynamics)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble random = -1.0;
- gdouble tilt = -1.0;
- gdouble fading = -1.0;
-
- if (paint_options->pressure_options->size)
- {
- pressure = coords->pressure;
- }
- else if (paint_options->pressure_options->inverse_size)
- {
- pressure = 1.0 - 0.9 * coords->pressure;
- }
-
- if (paint_options->velocity_options->size)
- {
- velocity = 1.0 - sqrt (coords->velocity);
- }
- else if (paint_options->velocity_options->inverse_size)
- {
- velocity = sqrt (coords->velocity);
- }
-
- if (paint_options->random_options->size)
- {
- random = 1.0 - g_random_double_range (0.0, 1.0);
- }
- else if (paint_options->random_options->inverse_size)
- {
- random = g_random_double_range (0.0, 1.0);
- }
-
- if (paint_options->tilt_options->size)
- {
- tilt = 1.0 - sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
- }
- else if (paint_options->tilt_options->inverse_size)
- {
- tilt = sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
- }
-
- if (paint_options->direction_options->size)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
-
- if (paint_options->fading_options->size ||
- paint_options->fading_options->inverse_size)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- scale = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
-
- if (scale < 1 / 64.0)
- scale = 1 / 8.0;
- else
- scale = sqrt (scale);
- }
-
- scale *= paint_options->brush_scale;
-
- return scale;
-}
-
-gdouble
-gimp_paint_options_get_dynamic_aspect_ratio (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble aspect_ratio = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->aspect_ratio ||
- paint_options->velocity_options->aspect_ratio ||
- paint_options->direction_options->aspect_ratio ||
- paint_options->tilt_options->aspect_ratio ||
- paint_options->random_options->aspect_ratio ||
- paint_options->fading_options->aspect_ratio)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble tilt = -1.0;
- gdouble random = -1.0;
- gdouble fading = -1.0;
-
-
- if (paint_options->pressure_options->aspect_ratio)
- pressure = 2 * coords->pressure;
-
- if (paint_options->velocity_options->aspect_ratio)
- velocity = 2 * coords->velocity;
-
- if (paint_options->random_options->aspect_ratio)
- {
- random = g_random_double_range (0.0, 1.0);
- if (random <= 0.5)
- {
- random = 1 / (random / 0.5 * (2.0 - 1.0) + 1.0);
- }
- else
- {
- random = (random - 0.5) / (1.0 - 0.5) * (2.0 - 1.0) + 1.0;
- }
- }
-
- if (paint_options->tilt_options->aspect_ratio)
- {
- tilt = sqrt ((1 - fabs (coords->xtilt)) / (1 - fabs (coords->ytilt)));
- }
-
- if (paint_options->direction_options->aspect_ratio)
- {
- direction = fmod (1 + coords->direction, 0.5) / 0.25;
-
- if ((coords->direction > 0.0) && (coords->direction < 0.5))
- direction = 1 / direction;
- }
-
- if (paint_options->fading_options->aspect_ratio)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- aspect_ratio = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- }
-
- return paint_options->brush_aspect_ratio * aspect_ratio;
-}
-
-gdouble
-gimp_paint_options_get_dynamic_rate (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble rate = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->rate ||
- paint_options->velocity_options->rate ||
- paint_options->direction_options->rate ||
- paint_options->tilt_options->rate ||
- paint_options->random_options->rate)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble random = -1.0;
- gdouble tilt = -1.0;
- gdouble fading = -1.0;
-
- if (paint_options->pressure_options->rate)
- pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
-
- if (paint_options->velocity_options->rate)
- velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
-
- if (paint_options->random_options->rate)
- random = g_random_double_range (0.0, 1.0);
-
- if (paint_options->tilt_options->rate)
- tilt = 1.0 - sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
-
- if (paint_options->direction_options->rate)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
- if (paint_options->fading_options->rate)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- rate = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- }
-
- return rate;
-}
-
-
-gdouble
-gimp_paint_options_get_dynamic_color (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble color = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->color ||
- paint_options->velocity_options->color ||
- paint_options->direction_options->color ||
- paint_options->tilt_options->color ||
- paint_options->random_options->color ||
- paint_options->fading_options->color)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble random = -1.0;
- gdouble tilt = -1.0;
- gdouble fading = -1.0;
-
- if (paint_options->pressure_options->color)
- pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
-
- if (paint_options->velocity_options->color)
- velocity = GIMP_PAINT_VELOCITY_SCALE * coords->velocity;
-
- if (paint_options->random_options->color)
- random = g_random_double_range (0.0, 1.0);
-
- if (paint_options->tilt_options->color)
- tilt = 1.0 - sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
-
- if (paint_options->direction_options->color)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
- if (paint_options->fading_options->color)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- color = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- }
-
- return color;
-}
-
-gdouble
-gimp_paint_options_get_dynamic_hardness (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble hardness = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->hardness ||
- paint_options->velocity_options->hardness ||
- paint_options->direction_options->hardness ||
- paint_options->tilt_options->hardness ||
- paint_options->random_options->hardness ||
- paint_options->fading_options->hardness)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble random = -1.0;
- gdouble tilt = -1.0;
- gdouble fading = -1.0;
-
- if (paint_options->pressure_options->hardness)
- pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
-
- if (paint_options->velocity_options->hardness)
- velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
-
- if (paint_options->random_options->hardness)
- random = g_random_double_range (0.0, 1.0);
-
- if (paint_options->tilt_options->hardness)
- tilt = 1.0 - sqrt (SQR (coords->xtilt) + SQR (coords->ytilt));
-
- if (paint_options->direction_options->hardness)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
- if (paint_options->fading_options->hardness)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- hardness = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- }
-
- return hardness;
-}
-
-gdouble
-gimp_paint_options_get_dynamic_angle (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist)
-{
- gdouble angle = 1.0;
-
- g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
- g_return_val_if_fail (coords != NULL, 1.0);
-
- if (paint_options->pressure_options->angle ||
- paint_options->velocity_options->angle ||
- paint_options->direction_options->angle ||
- paint_options->tilt_options->angle ||
- paint_options->random_options->angle ||
- paint_options->fading_options->angle)
- {
- gdouble pressure = -1.0;
- gdouble velocity = -1.0;
- gdouble direction = -1.0;
- gdouble random = -1.0;
- gdouble tilt = -1.0;
- gdouble fading = -1.0;
- if (paint_options->pressure_options->angle)
- pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
-
- if (paint_options->velocity_options->angle)
- velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
-
- if (paint_options->random_options->angle)
- random = g_random_double_range (0.0, 1.0);
-
- /* For tilt to make sense, it needs to be converted to an angle, not just vector */
- if (paint_options->tilt_options->angle)
- {
- gdouble tilt_x = coords->xtilt;
- gdouble tilt_y = coords->ytilt;
-
- if (tilt_x == 0.0)
- {
- if (tilt_y >= 0.0)
- tilt = 0.5;
- else if (tilt_y < 0.0)
- tilt = 0.0;
- else tilt = -1.0;
- }
- else
- {
- tilt = atan ((- 1.0 * tilt_y) /
- tilt_x) / (2 * G_PI);
-
- if (tilt_x > 0.0)
- tilt = tilt + 0.5;
- }
-
- tilt = tilt + 0.5; /* correct the angle, its wrong by 180 degrees */
-
- while (tilt > 1.0)
- tilt -= 1.0;
-
- while (tilt < 0.0)
- tilt += 1.0;
- }
-
- if (paint_options->direction_options->angle)
- direction = coords->direction + 0.5; /* mixer does not mix negative angles right so we shift */
-
- if (paint_options->fading_options->rate)
- {
- gdouble p;
- gdouble fade_out;
-
- fade_out = DEFAULT_FADE_LENGTH;
- p = pixel_dist / fade_out;
- fading = exp (- p * p * 5.541);
- }
-
- angle = gimp_paint_options_get_dynamics_mix (pressure,
- paint_options->pressure_options->prescale,
- velocity,
- paint_options->velocity_options->prescale,
- random,
- paint_options->random_options->prescale,
- tilt,
- paint_options->tilt_options->prescale,
- direction,
- paint_options->direction_options->prescale,
- fading,
- paint_options->fading_options->prescale);
- angle = angle - 0.5;
- }
-
- return angle + paint_options->brush_angle;
-}
diff --git a/app/paint/gimppaintoptions.h b/app/paint/gimppaintoptions.h
index bb70952..de173d3 100644
--- a/app/paint/gimppaintoptions.h
+++ b/app/paint/gimppaintoptions.h
@@ -29,23 +29,10 @@
GIMP_CONTEXT_BRUSH_MASK
-typedef struct _GimpDynamicOptions GimpDynamicOptions;
typedef struct _GimpFadeOptions GimpFadeOptions;
typedef struct _GimpJitterOptions GimpJitterOptions;
typedef struct _GimpGradientOptions GimpGradientOptions;
-struct _GimpDynamicOptions
-{
- gboolean opacity;
- gboolean hardness;
- gboolean rate;
- gboolean size;
- gboolean inverse_size;
- gboolean aspect_ratio;
- gboolean color;
- gboolean angle;
- gdouble prescale;
-};
struct _GimpFadeOptions
{
@@ -77,8 +64,6 @@ struct _GimpGradientOptions
#define GIMP_IS_PAINT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_OPTIONS))
#define GIMP_PAINT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAINT_OPTIONS, GimpPaintOptionsClass))
-#define GIMP_PAINT_PRESSURE_SCALE 1.5
-#define GIMP_PAINT_VELOCITY_SCALE 1.0
typedef struct _GimpPaintOptionsClass GimpPaintOptionsClass;
@@ -97,14 +82,6 @@ struct _GimpPaintOptions
gboolean hard;
- gboolean dynamics_expanded;
- GimpDynamicOptions *pressure_options;
- GimpDynamicOptions *velocity_options;
- GimpDynamicOptions *direction_options;
- GimpDynamicOptions *tilt_options;
- GimpDynamicOptions *random_options;
- GimpDynamicOptions *fading_options;
-
GimpFadeOptions *fade_options;
GimpJitterOptions *jitter_options;
GimpGradientOptions *gradient_options;
@@ -144,35 +121,5 @@ GimpBrushApplicationMode
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options);
-gdouble gimp_paint_options_get_dynamic_opacity (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_size (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gboolean use_dynamics,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_aspect_ratio
- (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_rate (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_color (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_angle (GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
-gdouble gimp_paint_options_get_dynamic_hardness(GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- gdouble pixel_dist);
-
#endif /* __GIMP_PAINT_OPTIONS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]