2009-07-28 01:22:11 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gegl.h>
|
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
|
|
|
|
2009-10-11 07:19:40 +08:00
|
|
|
#include "core-types.h"
|
2009-07-28 01:22:11 +08:00
|
|
|
|
2009-10-11 19:16:31 +08:00
|
|
|
#include "gimpcurve.h"
|
2009-08-20 09:25:26 +08:00
|
|
|
#include "gimpdynamics.h"
|
2009-10-11 03:05:50 +08:00
|
|
|
#include "gimpdynamics-load.h"
|
2009-10-11 01:46:06 +08:00
|
|
|
#include "gimpdynamics-save.h"
|
2009-10-11 19:53:59 +08:00
|
|
|
#include "gimpdynamicsoutput.h"
|
2009-07-28 01:22:11 +08:00
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
#define DEFAULT_NAME "Nameless dynamics"
|
2009-07-28 01:22:11 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
|
2009-10-11 03:29:04 +08:00
|
|
|
PROP_NAME,
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
PROP_OPACITY_OUTPUT,
|
|
|
|
PROP_SIZE_OUTPUT,
|
|
|
|
PROP_ANGLE_OUTPUT,
|
2010-03-15 00:12:24 +08:00
|
|
|
PROP_COLOR_OUTPUT,
|
2010-04-09 05:44:52 +08:00
|
|
|
PROP_FORCE_OUTPUT,
|
2010-03-15 00:12:24 +08:00
|
|
|
PROP_HARDNESS_OUTPUT,
|
|
|
|
PROP_ASPECT_RATIO_OUTPUT,
|
|
|
|
PROP_SPACING_OUTPUT,
|
|
|
|
PROP_RATE_OUTPUT,
|
2010-03-15 01:09:55 +08:00
|
|
|
PROP_FLOW_OUTPUT,
|
2010-03-15 00:12:24 +08:00
|
|
|
PROP_JITTER_OUTPUT
|
2009-07-28 01:22:11 +08:00
|
|
|
};
|
|
|
|
|
2009-08-08 01:09:53 +08:00
|
|
|
|
2009-10-11 19:53:59 +08:00
|
|
|
static void gimp_dynamics_finalize (GObject *object);
|
|
|
|
static void gimp_dynamics_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_dynamics_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2009-10-12 03:39:46 +08:00
|
|
|
static void
|
|
|
|
gimp_dynamics_dispatch_properties_changed (GObject *object,
|
|
|
|
guint n_pspecs,
|
|
|
|
GParamSpec **pspecs);
|
2009-08-20 06:40:33 +08:00
|
|
|
|
2009-10-11 19:53:59 +08:00
|
|
|
static const gchar * gimp_dynamics_get_extension (GimpData *data);
|
2009-08-20 06:40:33 +08:00
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
static GimpDynamicsOutput *
|
2010-02-22 06:41:55 +08:00
|
|
|
gimp_dynamics_create_output (GimpDynamics *dynamics,
|
|
|
|
const gchar *name,
|
|
|
|
GimpDynamicsOutputType type);
|
2009-10-12 03:25:28 +08:00
|
|
|
static void gimp_dynamics_output_notify (GObject *output,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamics *dynamics);
|
|
|
|
|
2009-08-21 03:46:17 +08:00
|
|
|
|
2009-08-20 09:25:26 +08:00
|
|
|
G_DEFINE_TYPE (GimpDynamics, gimp_dynamics,
|
2009-07-28 01:22:11 +08:00
|
|
|
GIMP_TYPE_DATA)
|
2009-08-08 01:09:53 +08:00
|
|
|
|
2009-08-20 09:25:26 +08:00
|
|
|
#define parent_class gimp_dynamics_parent_class
|
2009-07-28 01:22:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2009-08-20 09:25:26 +08:00
|
|
|
gimp_dynamics_class_init (GimpDynamicsClass *klass)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2009-10-12 03:25:28 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpDataClass *data_class = GIMP_DATA_CLASS (klass);
|
2009-07-28 01:22:11 +08:00
|
|
|
|
2009-10-12 03:39:46 +08:00
|
|
|
object_class->finalize = gimp_dynamics_finalize;
|
|
|
|
object_class->set_property = gimp_dynamics_set_property;
|
|
|
|
object_class->get_property = gimp_dynamics_get_property;
|
|
|
|
object_class->dispatch_properties_changed = gimp_dynamics_dispatch_properties_changed;
|
2009-07-28 01:22:11 +08:00
|
|
|
|
2009-10-12 03:39:46 +08:00
|
|
|
data_class->save = gimp_dynamics_save;
|
|
|
|
data_class->get_extension = gimp_dynamics_get_extension;
|
2009-10-11 01:46:06 +08:00
|
|
|
|
2009-10-12 18:23:36 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_NAME,
|
|
|
|
"name", NULL,
|
|
|
|
DEFAULT_NAME,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2009-10-11 03:29:04 +08:00
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_OPACITY_OUTPUT,
|
|
|
|
"opacity-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
2010-04-09 05:44:52 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_FORCE_OUTPUT,
|
|
|
|
"force-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_HARDNESS_OUTPUT,
|
|
|
|
"hardness-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_RATE_OUTPUT,
|
|
|
|
"rate-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
2010-03-15 01:09:55 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_FLOW_OUTPUT,
|
|
|
|
"flow-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_SIZE_OUTPUT,
|
|
|
|
"size-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_ASPECT_RATIO_OUTPUT,
|
|
|
|
"aspect-ratio-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_COLOR_OUTPUT,
|
|
|
|
"color-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_ANGLE_OUTPUT,
|
|
|
|
"angle-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_JITTER_OUTPUT,
|
|
|
|
"jitter-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
2009-12-13 05:14:14 +08:00
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_SPACING_OUTPUT,
|
|
|
|
"spacing-output", NULL,
|
|
|
|
GIMP_TYPE_DYNAMICS_OUTPUT,
|
|
|
|
GIMP_CONFIG_PARAM_AGGREGATE);
|
2009-07-28 01:22:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-11 03:29:04 +08:00
|
|
|
gimp_dynamics_init (GimpDynamics *dynamics)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->opacity_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"opacity-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_OPACITY);
|
2010-04-09 05:44:52 +08:00
|
|
|
|
|
|
|
dynamics->force_output = gimp_dynamics_create_output (dynamics,
|
|
|
|
"force-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_FORCE);
|
|
|
|
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->hardness_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"hardness-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_HARDNESS);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->rate_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"rate-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_RATE);
|
2010-03-15 01:09:55 +08:00
|
|
|
dynamics->flow_output = gimp_dynamics_create_output (dynamics,
|
|
|
|
"flow-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_RATE);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->size_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"size-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_SIZE);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->aspect_ratio_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"aspect-ratio-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->color_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"color-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_COLOR);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->angle_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"angle-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_ANGLE);
|
2009-10-12 20:45:12 +08:00
|
|
|
dynamics->jitter_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"jitter-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_JITTER);
|
2009-12-13 05:14:14 +08:00
|
|
|
dynamics->spacing_output = gimp_dynamics_create_output (dynamics,
|
2010-02-22 06:41:55 +08:00
|
|
|
"spacing-output",
|
|
|
|
GIMP_DYNAMICS_OUTPUT_SPACING);
|
2009-07-28 01:22:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-20 09:25:26 +08:00
|
|
|
gimp_dynamics_finalize (GObject *object)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2009-10-11 03:29:04 +08:00
|
|
|
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
|
2009-07-28 01:22:11 +08:00
|
|
|
|
2009-10-12 20:45:12 +08:00
|
|
|
g_object_unref (dynamics->opacity_output);
|
2010-04-09 05:44:52 +08:00
|
|
|
g_object_unref (dynamics->force_output);
|
2009-10-12 20:45:12 +08:00
|
|
|
g_object_unref (dynamics->hardness_output);
|
|
|
|
g_object_unref (dynamics->rate_output);
|
2010-03-15 01:09:55 +08:00
|
|
|
g_object_unref (dynamics->flow_output);
|
2009-10-12 20:45:12 +08:00
|
|
|
g_object_unref (dynamics->size_output);
|
|
|
|
g_object_unref (dynamics->aspect_ratio_output);
|
|
|
|
g_object_unref (dynamics->color_output);
|
|
|
|
g_object_unref (dynamics->angle_output);
|
|
|
|
g_object_unref (dynamics->jitter_output);
|
2009-12-13 05:14:14 +08:00
|
|
|
g_object_unref (dynamics->spacing_output);
|
2009-10-04 16:40:26 +08:00
|
|
|
|
2009-07-28 01:22:11 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-20 09:25:26 +08:00
|
|
|
gimp_dynamics_set_property (GObject *object,
|
2009-08-26 02:28:24 +08:00
|
|
|
guint property_id,
|
2009-08-23 22:56:03 +08:00
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2009-10-12 03:25:28 +08:00
|
|
|
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
|
|
|
|
GimpDynamicsOutput *src_output = NULL;
|
|
|
|
GimpDynamicsOutput *dest_output = NULL;
|
2009-07-28 01:22:11 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
2009-10-11 03:29:04 +08:00
|
|
|
case PROP_NAME:
|
2009-10-11 07:19:40 +08:00
|
|
|
gimp_object_set_name (GIMP_OBJECT (dynamics), g_value_get_string (value));
|
2009-10-11 03:29:04 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_OPACITY_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->opacity_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2010-04-09 05:44:52 +08:00
|
|
|
case PROP_FORCE_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
|
|
|
dest_output = dynamics->force_output;
|
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_HARDNESS_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->hardness_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_RATE_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->rate_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2010-03-15 01:09:55 +08:00
|
|
|
case PROP_FLOW_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
|
|
|
dest_output = dynamics->flow_output;
|
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_SIZE_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->size_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_ASPECT_RATIO_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->aspect_ratio_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_COLOR_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->color_output;
|
2009-10-04 16:40:26 +08:00
|
|
|
break;
|
2009-08-20 03:41:08 +08:00
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_ANGLE_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->angle_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_JITTER_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
2009-10-12 20:45:12 +08:00
|
|
|
dest_output = dynamics->jitter_output;
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-12-13 05:14:14 +08:00
|
|
|
case PROP_SPACING_OUTPUT:
|
|
|
|
src_output = g_value_get_object (value);
|
|
|
|
dest_output = dynamics->spacing_output;
|
|
|
|
break;
|
|
|
|
|
2009-07-28 01:22:11 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2009-10-12 03:25:28 +08:00
|
|
|
|
|
|
|
if (src_output && dest_output)
|
|
|
|
{
|
|
|
|
gimp_config_copy (GIMP_CONFIG (src_output),
|
|
|
|
GIMP_CONFIG (dest_output),
|
|
|
|
GIMP_CONFIG_PARAM_SERIALIZE);
|
|
|
|
}
|
2009-07-28 01:22:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-20 09:25:26 +08:00
|
|
|
gimp_dynamics_get_property (GObject *object,
|
2009-10-11 07:19:40 +08:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2009-10-12 03:25:28 +08:00
|
|
|
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
|
2009-07-28 01:22:11 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
2009-10-11 03:29:04 +08:00
|
|
|
case PROP_NAME:
|
|
|
|
g_value_set_string (value, gimp_object_get_name (dynamics));
|
|
|
|
break;
|
2009-07-28 01:22:11 +08:00
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_OPACITY_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->opacity_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2010-04-09 05:44:52 +08:00
|
|
|
case PROP_FORCE_OUTPUT:
|
|
|
|
g_value_set_object (value, dynamics->force_output);
|
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_HARDNESS_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->hardness_output);
|
2009-10-04 16:40:26 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_RATE_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->rate_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2010-03-15 01:09:55 +08:00
|
|
|
case PROP_FLOW_OUTPUT:
|
|
|
|
g_value_set_object (value, dynamics->flow_output);
|
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_SIZE_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->size_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_ASPECT_RATIO_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->aspect_ratio_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_COLOR_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->color_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_ANGLE_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->angle_output);
|
2009-07-28 01:22:11 +08:00
|
|
|
break;
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
case PROP_JITTER_OUTPUT:
|
2009-10-12 20:45:12 +08:00
|
|
|
g_value_set_object (value, dynamics->jitter_output);
|
2009-10-04 16:40:26 +08:00
|
|
|
break;
|
|
|
|
|
2009-12-13 05:14:14 +08:00
|
|
|
case PROP_SPACING_OUTPUT:
|
|
|
|
g_value_set_object (value, dynamics->spacing_output);
|
|
|
|
break;
|
|
|
|
|
2009-07-28 01:22:11 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-12 03:39:46 +08:00
|
|
|
static void
|
|
|
|
gimp_dynamics_dispatch_properties_changed (GObject *object,
|
|
|
|
guint n_pspecs,
|
|
|
|
GParamSpec **pspecs)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispatch_properties_changed (object,
|
|
|
|
n_pspecs, pspecs);
|
|
|
|
|
|
|
|
for (i = 0; i < n_pspecs; i++)
|
|
|
|
{
|
|
|
|
if (pspecs[i]->flags & GIMP_CONFIG_PARAM_SERIALIZE)
|
|
|
|
{
|
|
|
|
gimp_data_dirty (GIMP_DATA (object));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
static const gchar *
|
|
|
|
gimp_dynamics_get_extension (GimpData *data)
|
|
|
|
{
|
|
|
|
return GIMP_DYNAMICS_FILE_EXTENSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2009-08-08 10:21:56 +08:00
|
|
|
GimpData *
|
2010-04-11 01:55:42 +08:00
|
|
|
gimp_dynamics_new (GimpContext *context,
|
|
|
|
const gchar *name)
|
2009-07-28 01:22:11 +08:00
|
|
|
{
|
2010-04-11 01:55:42 +08:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
g_return_val_if_fail (name[0] != '\0', NULL);
|
|
|
|
|
2009-10-11 07:19:40 +08:00
|
|
|
return g_object_new (GIMP_TYPE_DYNAMICS,
|
|
|
|
"name", name,
|
|
|
|
NULL);
|
2009-07-28 01:22:11 +08:00
|
|
|
}
|
|
|
|
|
2009-08-18 10:47:26 +08:00
|
|
|
GimpData *
|
2010-04-05 19:24:54 +08:00
|
|
|
gimp_dynamics_get_standard (GimpContext *context)
|
2009-08-18 10:47:26 +08:00
|
|
|
{
|
|
|
|
static GimpData *standard_dynamics = NULL;
|
|
|
|
|
|
|
|
if (! standard_dynamics)
|
|
|
|
{
|
2010-04-11 01:55:42 +08:00
|
|
|
standard_dynamics = gimp_dynamics_new (context, "Standard dynamics");
|
2009-08-18 10:47:26 +08:00
|
|
|
|
2009-11-01 01:48:38 +08:00
|
|
|
gimp_data_clean (standard_dynamics);
|
|
|
|
gimp_data_make_internal (standard_dynamics, "gimp-dynamics-standard");
|
2009-08-18 10:47:26 +08:00
|
|
|
|
2010-06-24 18:46:45 +08:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (standard_dynamics),
|
|
|
|
(gpointer *) &standard_dynamics);
|
2009-08-18 10:47:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return standard_dynamics;
|
|
|
|
}
|
|
|
|
|
2010-02-22 06:41:55 +08:00
|
|
|
GimpDynamicsOutput *
|
|
|
|
gimp_dynamics_get_output (GimpDynamics *dynamics,
|
|
|
|
GimpDynamicsOutputType type_id)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (type_id)
|
|
|
|
{
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_OPACITY:
|
|
|
|
return dynamics->opacity_output;
|
|
|
|
break;
|
|
|
|
|
2010-04-09 05:44:52 +08:00
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_FORCE:
|
|
|
|
return dynamics->force_output;
|
|
|
|
break;
|
|
|
|
|
2010-02-22 06:41:55 +08:00
|
|
|
case GIMP_DYNAMICS_OUTPUT_HARDNESS:
|
|
|
|
return dynamics->hardness_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_RATE:
|
|
|
|
return dynamics->rate_output;
|
|
|
|
break;
|
|
|
|
|
2010-03-15 01:09:55 +08:00
|
|
|
case GIMP_DYNAMICS_OUTPUT_FLOW:
|
|
|
|
return dynamics->flow_output;
|
|
|
|
break;
|
|
|
|
|
2010-02-22 06:41:55 +08:00
|
|
|
case GIMP_DYNAMICS_OUTPUT_SIZE:
|
|
|
|
return dynamics->size_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO:
|
|
|
|
return dynamics->aspect_ratio_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_COLOR:
|
|
|
|
return dynamics->color_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_ANGLE:
|
|
|
|
return dynamics->angle_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_JITTER:
|
|
|
|
return dynamics->jitter_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_DYNAMICS_OUTPUT_SPACING:
|
|
|
|
return dynamics->spacing_output;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-12 03:25:28 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static GimpDynamicsOutput *
|
2010-02-22 15:52:32 +08:00
|
|
|
gimp_dynamics_create_output (GimpDynamics *dynamics,
|
|
|
|
const gchar *name,
|
|
|
|
GimpDynamicsOutputType type)
|
2009-10-12 03:25:28 +08:00
|
|
|
{
|
2010-02-22 06:41:55 +08:00
|
|
|
GimpDynamicsOutput *output = gimp_dynamics_output_new (name, type);
|
2009-10-12 03:25:28 +08:00
|
|
|
|
|
|
|
g_signal_connect (output, "notify",
|
|
|
|
G_CALLBACK (gimp_dynamics_output_notify),
|
|
|
|
dynamics);
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_output_notify (GObject *output,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamics *dynamics)
|
|
|
|
{
|
|
|
|
g_object_notify (G_OBJECT (dynamics), gimp_object_get_name (output));
|
|
|
|
}
|