Merge a part of SOC 2006's vector layer branch:

2008-10-23  Michael Natterer  <mitch@gimp.org>

	Merge a part of SOC 2006's vector layer branch:

	* app/core/Makefile.am
	* app/core/core-types.h
	* app/core/gimpfilloptions.[ch]: new GimpContext subclass factored
	out of GimpStrokeOptions. Has "style" and "antialias" properties.

	* app/core/gimpstrokeoptions.[ch]: derive from GimpFillOptions
	and remove said properties.

	* app/core/gimpdrawable-stroke.c
	(gimp_drawable_stroke_scan_convert): changed accordingly.


svn path=/trunk/; revision=27378
This commit is contained in:
Michael Natterer 2008-10-23 21:18:39 +00:00 committed by Michael Natterer
parent d3d9724ee1
commit 67a5eaea68
8 changed files with 207 additions and 33 deletions

View file

@ -1,3 +1,18 @@
2008-10-23 Michael Natterer <mitch@gimp.org>
Merge a part of SOC 2006's vector layer branch:
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpfilloptions.[ch]: new GimpContext subclass factored
out of GimpStrokeOptions. Has "style" and "antialias" properties.
* app/core/gimpstrokeoptions.[ch]: derive from GimpFillOptions
and remove said properties.
* app/core/gimpdrawable-stroke.c
(gimp_drawable_stroke_scan_convert): changed accordingly.
2008-10-23 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimppluginprocframe.c
@ -1103,7 +1118,7 @@
2008-10-03 Hans Breuer <hans@breuer.org>
* plug-ins/common/web-browser.c : when ShellExecute() is failing give
the detailed (currently intentionally untranslated) error message via
the detailed (currently intentionally untranslated) error message via
g_message()
* **/makefie.msc gimpdefs.msc app/gimpcore.def : updated

View file

@ -162,6 +162,8 @@ libappcore_a_sources = \
gimpdrawablestack.h \
gimpdrawableundo.c \
gimpdrawableundo.h \
gimpfilloptions.c \
gimpfilloptions.h \
gimpfloatingselundo.c \
gimpfloatingselundo.h \
gimpgradient.c \

View file

@ -77,6 +77,7 @@ typedef struct _GimpToolPresets GimpToolPresets;
/* context objects */
typedef struct _GimpContext GimpContext;
typedef struct _GimpFillOptions GimpFillOptions;
typedef struct _GimpStrokeOptions GimpStrokeOptions;
typedef struct _GimpToolOptions GimpToolOptions;

View file

@ -271,7 +271,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
/* render the stroke into it */
gimp_scan_convert_render (scan_convert, mask,
x + off_x, y + off_y,
options->antialias);
GIMP_FILL_OPTIONS (options)->antialias);
bytes = gimp_drawable_bytes_with_alpha (drawable);
@ -279,7 +279,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
pixel_region_init (&basePR, base, 0, 0, w, h, TRUE);
pixel_region_init (&maskPR, mask, 0, 0, w, h, FALSE);
switch (options->style)
switch (GIMP_FILL_OPTIONS (options)->style)
{
case GIMP_STROKE_STYLE_SOLID:
{

124
app/core/gimpfilloptions.c Normal file
View file

@ -0,0 +1,124 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* gimpfilloptions.c
* Copyright (C) 2003 Simon Budig
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "gimpfilloptions.h"
enum
{
PROP_0,
PROP_STYLE,
PROP_ANTIALIAS
};
static void gimp_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_fill_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpFillOptions, gimp_fill_options, GIMP_TYPE_CONTEXT)
static void
gimp_fill_options_class_init (GimpFillOptionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_fill_options_set_property;
object_class->get_property = gimp_fill_options_get_property;
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE,
"style", NULL,
GIMP_TYPE_STROKE_STYLE,
GIMP_STROKE_STYLE_SOLID,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
"antialias", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
}
static void
gimp_fill_options_init (GimpFillOptions *options)
{
}
static void
gimp_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpFillOptions *options = GIMP_FILL_OPTIONS (object);
switch (property_id)
{
case PROP_STYLE:
options->style = g_value_get_enum (value);
break;
case PROP_ANTIALIAS:
options->antialias = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_fill_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpFillOptions *options = GIMP_FILL_OPTIONS (object);
switch (property_id)
{
case PROP_STYLE:
g_value_set_enum (value, options->style);
break;
case PROP_ANTIALIAS:
g_value_set_boolean (value, options->antialias);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}

View file

@ -0,0 +1,57 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* gimpfilloptions.h
* Copyright (C) 2003 Simon Budig
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_FILL_OPTIONS_H__
#define __GIMP_FILL_OPTIONS_H__
#include "gimpcontext.h"
#define GIMP_TYPE_FILL_OPTIONS (gimp_fill_options_get_type ())
#define GIMP_FILL_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FILL_OPTIONS, GimpFillOptions))
#define GIMP_FILL_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILL_OPTIONS, GimpFillOptionsClass))
#define GIMP_IS_FILL_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FILL_OPTIONS))
#define GIMP_IS_FILL_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILL_OPTIONS))
#define GIMP_FILL_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FILL_OPTIONS, GimpFillOptionsClass))
typedef struct _GimpFillOptionsClass GimpFillOptionsClass;
struct _GimpFillOptions
{
GimpContext parent_instance;
GimpStrokeStyle style;
gboolean antialias;
};
struct _GimpFillOptionsClass
{
GimpContextClass parent_class;
};
GType gimp_fill_options_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_FILL_OPTIONS_H__ */

View file

@ -67,7 +67,7 @@ static void gimp_stroke_options_get_property (GObject *object,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpStrokeOptions, gimp_stroke_options, GIMP_TYPE_CONTEXT)
G_DEFINE_TYPE (GimpStrokeOptions, gimp_stroke_options, GIMP_TYPE_FILL_OPTIONS)
static guint stroke_options_signals[LAST_SIGNAL] = { 0 };
@ -93,11 +93,6 @@ gimp_stroke_options_class_init (GimpStrokeOptionsClass *klass)
G_TYPE_NONE, 1,
GIMP_TYPE_DASH_PRESET);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE,
"style", NULL,
GIMP_TYPE_STROKE_STYLE,
GIMP_STROKE_STYLE_SOLID,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
"width", NULL,
0.0, 2000.0, 6.0,
@ -122,10 +117,6 @@ gimp_stroke_options_class_init (GimpStrokeOptionsClass *klass)
"line-width from the actual join point."),
0.0, 100.0, 10.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
"antialias", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_DASH_OFFSET,
"dash-offset", NULL,
0.0, 2000.0, 0.0,
@ -156,9 +147,6 @@ gimp_stroke_options_set_property (GObject *object,
switch (property_id)
{
case PROP_STYLE:
options->style = g_value_get_enum (value);
break;
case PROP_WIDTH:
options->width = g_value_get_double (value);
break;
@ -174,9 +162,6 @@ gimp_stroke_options_set_property (GObject *object,
case PROP_MITER_LIMIT:
options->miter_limit = g_value_get_double (value);
break;
case PROP_ANTIALIAS:
options->antialias = g_value_get_boolean (value);
break;
case PROP_DASH_OFFSET:
options->dash_offset = g_value_get_double (value);
break;
@ -207,9 +192,6 @@ gimp_stroke_options_get_property (GObject *object,
switch (property_id)
{
case PROP_STYLE:
g_value_set_enum (value, options->style);
break;
case PROP_WIDTH:
g_value_set_double (value, options->width);
break;
@ -225,9 +207,6 @@ gimp_stroke_options_get_property (GObject *object,
case PROP_MITER_LIMIT:
g_value_set_double (value, options->miter_limit);
break;
case PROP_ANTIALIAS:
g_value_set_boolean (value, options->antialias);
break;
case PROP_DASH_OFFSET:
g_value_set_double (value, options->dash_offset);
break;

View file

@ -23,7 +23,7 @@
#define __GIMP_STROKE_OPTIONS_H__
#include "gimpcontext.h"
#include "gimpfilloptions.h"
#define GIMP_TYPE_STROKE_OPTIONS (gimp_stroke_options_get_type ())
@ -38,9 +38,7 @@ typedef struct _GimpStrokeOptionsClass GimpStrokeOptionsClass;
struct _GimpStrokeOptions
{
GimpContext parent_instance;
GimpStrokeStyle style;
GimpFillOptions parent_instance;
gdouble width;
GimpUnit unit;
@ -50,15 +48,13 @@ struct _GimpStrokeOptions
gdouble miter_limit;
gboolean antialias;
gdouble dash_offset;
GArray *dash_info;
};
struct _GimpStrokeOptionsClass
{
GimpContextClass parent_class;
GimpFillOptionsClass parent_class;
void (* dash_info_changed) (GimpStrokeOptions *stroke_options,
GimpDashPreset preset);
@ -72,4 +68,4 @@ void gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
GArray *pattern);
#endif /* __GIMP_STROKE_OPTIONS_H__ */
#endif /* __GIMP_STROKE_OPTIONS_H__ */