gimp r27378 - in trunk: . app/core



Author: mitch
Date: Thu Oct 23 21:18:39 2008
New Revision: 27378
URL: http://svn.gnome.org/viewvc/gimp?rev=27378&view=rev

Log:
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.



Added:
   trunk/app/core/gimpfilloptions.c
   trunk/app/core/gimpfilloptions.h
Modified:
   trunk/ChangeLog
   trunk/app/core/Makefile.am
   trunk/app/core/core-types.h
   trunk/app/core/gimpdrawable-stroke.c
   trunk/app/core/gimpstrokeoptions.c
   trunk/app/core/gimpstrokeoptions.h

Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am	(original)
+++ trunk/app/core/Makefile.am	Thu Oct 23 21:18:39 2008
@@ -162,6 +162,8 @@
 	gimpdrawablestack.h			\
 	gimpdrawableundo.c			\
 	gimpdrawableundo.h			\
+	gimpfilloptions.c			\
+	gimpfilloptions.h			\
 	gimpfloatingselundo.c			\
 	gimpfloatingselundo.h			\
 	gimpgradient.c				\

Modified: trunk/app/core/core-types.h
==============================================================================
--- trunk/app/core/core-types.h	(original)
+++ trunk/app/core/core-types.h	Thu Oct 23 21:18:39 2008
@@ -77,6 +77,7 @@
 /*  context objects  */
 
 typedef struct _GimpContext         GimpContext;
+typedef struct _GimpFillOptions     GimpFillOptions;
 typedef struct _GimpStrokeOptions   GimpStrokeOptions;
 typedef struct _GimpToolOptions     GimpToolOptions;
 

Modified: trunk/app/core/gimpdrawable-stroke.c
==============================================================================
--- trunk/app/core/gimpdrawable-stroke.c	(original)
+++ trunk/app/core/gimpdrawable-stroke.c	Thu Oct 23 21:18:39 2008
@@ -271,7 +271,7 @@
   /* 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 @@
   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:
       {

Added: trunk/app/core/gimpfilloptions.c
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpfilloptions.c	Thu Oct 23 21:18:39 2008
@@ -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;
+    }
+}

Added: trunk/app/core/gimpfilloptions.h
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpfilloptions.h	Thu Oct 23 21:18:39 2008
@@ -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__ */

Modified: trunk/app/core/gimpstrokeoptions.c
==============================================================================
--- trunk/app/core/gimpstrokeoptions.c	(original)
+++ trunk/app/core/gimpstrokeoptions.c	Thu Oct 23 21:18:39 2008
@@ -67,7 +67,7 @@
                                                  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 @@
                   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 @@
                                      "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 @@
 
   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 @@
     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 @@
 
   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 @@
     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;

Modified: trunk/app/core/gimpstrokeoptions.h
==============================================================================
--- trunk/app/core/gimpstrokeoptions.h	(original)
+++ trunk/app/core/gimpstrokeoptions.h	Thu Oct 23 21:18:39 2008
@@ -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 @@
 
 struct _GimpStrokeOptions
 {
-  GimpContext      parent_instance;
-
-  GimpStrokeStyle  style;
+  GimpFillOptions  parent_instance;
 
   gdouble          width;
   GimpUnit         unit;
@@ -50,15 +48,13 @@
 
   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 @@
                                               GArray            *pattern);
 
 
-#endif  /*  __GIMP_STROKE_OPTIONS_H__  */
+#endif /* __GIMP_STROKE_OPTIONS_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]