Merge commit 'origin/soc-2009-dynamics' into soc-2009-dynamics

This commit is contained in:
zhenfeng zhao 2009-08-20 12:52:21 -03:00
commit 54e0b15b46
4 changed files with 58 additions and 61 deletions

View File

@ -2487,7 +2487,7 @@ gimp_context_real_set_brush (GimpContext *context,
/* dynamics *****************************************************************/
GimpDynamicsOptions *
GimpDynamics *
gimp_context_get_dynamics (GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@ -2497,7 +2497,7 @@ gimp_context_get_dynamics (GimpContext *context)
void
gimp_context_set_dynamics (GimpContext *context,
GimpDynamicsOptions *dynamics)
GimpDynamics *dynamics)
{
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (! dynamics || GIMP_IS_DYNAMICS (dynamics));
@ -2547,10 +2547,10 @@ static void gimp_context_dynamics_list_thaw (GimpContainer *container,
GimpContext *context)
{
GimpDynamicsOptions *dynamics;
/*
/*
if (! context->dynamics_name)
context->dynamics_name = g_strdup (context->gimp->config->default_dynamics);
*/
*/
dynamics = gimp_context_find_object (context, container,
context->dynamics_name,
gimp_dynamics_get_standard ());

View File

@ -114,7 +114,7 @@ struct _GimpContextClass
void (* brush_changed) (GimpContext *context,
GimpBrush *brush);
void (* dynamics_changed) (GimpContext *context,
GimpDynamicsOptions *dynamics);
GimpDynamics *dynamics);
void (* pattern_changed) (GimpContext *context,
GimpPattern *pattern);
void (* gradient_changed) (GimpContext *context,
@ -263,9 +263,9 @@ void gimp_context_set_brush (GimpContext *context,
void gimp_context_brush_changed (GimpContext *context);
/* dynamics */
GimpDynamicsOptions * gimp_context_get_dynamics (GimpContext *context);
GimpDynamics * gimp_context_get_dynamics (GimpContext *context);
void gimp_context_set_dynamics (GimpContext *context,
GimpDynamicsOptions *dynamics);
GimpDynamics *dynamics);
void gimp_context_dynamics_changed (GimpContext *context);

View File

@ -149,18 +149,18 @@ static void gimp_dynamics_notify (GObject *object,
GParamSpec *pspec);
static void gimp_dynamics_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dynamics_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dynamics_curves_init (GimpDynamicsOutput *dynamics);
static GimpDynamicsOutput* gimp_dynamics_output_init ();
static void gimp_dynamics_curves_finalize (GimpDynamicsOutput *dynamics);
static void gimp_dynamics_output_finalize (GimpDynamicsOutput *dynamics);
/*
@ -185,15 +185,6 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
object_class->get_property = gimp_dynamics_get_property;
object_class->notify = gimp_dynamics_notify;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_ASPECT_RATIO,
"random-aspect-ratio", NULL,
DEFAULT_RANDOM_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_ASPECT_RATIO,
"fading-aspect-ratio", NULL,
DEFAULT_FADING_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_OPACITY,
"pressure-opacity", NULL,
DEFAULT_PRESSURE_OPACITY,
@ -334,6 +325,10 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
"random-angle", NULL,
DEFAULT_RANDOM_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_ASPECT_RATIO,
"random-aspect-ratio", NULL,
DEFAULT_RANDOM_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_OPACITY,
"fading-opacity", NULL,
@ -359,33 +354,29 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
"fading-angle", NULL,
DEFAULT_FADING_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_ASPECT_RATIO,
"fading-aspect-ratio", NULL,
DEFAULT_FADING_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
}
static void
gimp_dynamics_init (GimpDynamics *options)
{
options->opacity_dynamics = gimp_dynamics_output_init();
options->opacity_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->opacity_dynamics);
options->hardness_dynamics = gimp_dynamics_output_init();
options->hardness_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->hardness_dynamics);
options->rate_dynamics = gimp_dynamics_output_init();
options->rate_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->rate_dynamics);
options->size_dynamics = gimp_dynamics_output_init();
options->size_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->size_dynamics);
options->aspect_ratio_dynamics = gimp_dynamics_output_init();
options->aspect_ratio_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->aspect_ratio_dynamics);
options->color_dynamics = gimp_dynamics_output_init();
options->color_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->color_dynamics);
options->angle_dynamics = g_slice_new0 (GimpDynamicsOutput);
gimp_dynamics_curves_init(options->angle_dynamics);
options->angle_dynamics = gimp_dynamics_output_init();
}
@ -395,34 +386,28 @@ gimp_dynamics_finalize (GObject *object)
{
GimpDynamics *options = GIMP_DYNAMICS (object);
gimp_dynamics_curves_finalize (options->opacity_dynamics);
g_slice_free (GimpDynamicsOutput, options->opacity_dynamics);
gimp_dynamics_output_finalize (options->opacity_dynamics);
gimp_dynamics_curves_finalize (options->hardness_dynamics);
g_slice_free (GimpDynamicsOutput, options->hardness_dynamics);
gimp_dynamics_output_finalize (options->hardness_dynamics);
gimp_dynamics_curves_finalize (options->rate_dynamics);
g_slice_free (GimpDynamicsOutput, options->rate_dynamics);
gimp_dynamics_output_finalize (options->rate_dynamics);
gimp_dynamics_curves_finalize (options->size_dynamics);
g_slice_free (GimpDynamicsOutput, options->size_dynamics);
gimp_dynamics_output_finalize (options->size_dynamics);
gimp_dynamics_curves_finalize (options->aspect_ratio_dynamics);
g_slice_free (GimpDynamicsOutput, options->aspect_ratio_dynamics);
gimp_dynamics_output_finalize (options->aspect_ratio_dynamics);
gimp_dynamics_curves_finalize (options->color_dynamics);
g_slice_free (GimpDynamicsOutput, options->color_dynamics);
gimp_dynamics_curves_finalize (options->angle_dynamics);
g_slice_free (GimpDynamicsOutput, options->angle_dynamics);
gimp_dynamics_output_finalize (options->color_dynamics);
gimp_dynamics_output_finalize (options->angle_dynamics);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_dynamics_curves_init (GimpDynamicsOutput *dynamics)
static GimpDynamicsOutput*
gimp_dynamics_output_init()
{
GimpDynamicsOutput * dynamics = g_slice_new0 (GimpDynamicsOutput);
dynamics->pressure_curve = g_object_new (GIMP_TYPE_CURVE,
"name", "Pressure curve",
NULL);
@ -441,10 +426,11 @@ gimp_dynamics_curves_init (GimpDynamicsOutput *dynamics)
dynamics->fade_curve = g_object_new (GIMP_TYPE_CURVE,
"name", "Fade curve",
NULL);
return dynamics;
}
static void
gimp_dynamics_curves_finalize (GimpDynamicsOutput *dynamics)
gimp_dynamics_output_finalize (GimpDynamicsOutput *dynamics)
{
g_object_unref(dynamics->pressure_curve);
@ -458,6 +444,8 @@ gimp_dynamics_curves_finalize (GimpDynamicsOutput *dynamics)
g_object_unref(dynamics->fade_curve);
g_slice_free (GimpDynamicsOutput, dynamics);
}
@ -480,7 +468,6 @@ gimp_dynamics_set_property (GObject *object,
switch (property_id)
{
case PROP_PRESSURE_OPACITY:
opacity_dynamics->pressure = g_value_get_boolean (value);
break;
@ -918,7 +905,7 @@ gimp_dynamics_get_standard (void)
gdouble
gimp_dynamics_get_output_val (GimpDynamicsOutput *output, GimpCoords *coords)
{
printf("Dynamics queried...");
printf("Dynamics queried...\n");
return 1;
}

View File

@ -377,7 +377,10 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
GimpBrushCore *core = GIMP_BRUSH_CORE (paint_core);
GimpBrush *brush;
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
core->dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (core->main_brush != brush)
gimp_brush_core_set_brush (core, brush);
@ -394,6 +397,12 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
core->scale = paint_options->brush_scale;/* gimp_paint_options_get_dynamic_size (paint_options, coords,
TRUE,
paint_core->pixel_dist);*/
if (core->dynamics)
{
core->scale *= gimp_dynamics_get_output_val(core->dynamics->size_dynamics, coords);
printf("PAss GO 2\n");
}
else printf("Go to jail\n");
core->angle = paint_options->brush_angle;/* gimp_paint_options_get_dynamic_angle (paint_options, coords,
paint_core->pixel_dist);*/
@ -746,6 +755,7 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
if (core->dynamics)
{
core->scale *= gimp_dynamics_get_output_val(core->dynamics->size_dynamics, coords);
printf("PAssing go1\n");
}
core->angle = paint_options->brush_angle; /* gimp_paint_options_get_dynamic_angle (paint_options, coords,
@ -826,7 +836,7 @@ gimp_brush_core_real_set_brush (GimpBrushCore *core,
static void
gimp_brush_core_real_set_dynamics (GimpBrushCore *core,
GimpDynamics *dynamics)
GimpDynamics *dynamics)
{
if (core->dynamics)
{