app/paint/Makefile.am removed.

2003-07-14  Michael Natterer  <mitch@gimp.org>

	* app/paint/Makefile.am
	* app/paint/gimppencil.[ch]: removed.

	* app/paint/gimppenciloptions.[ch]: new files. Does nothing except
	setting the default value of "hard" to TRUE.

	* app/paint/paint.c
	* app/tools/tool_manager.c: changed accordingly.

	* app/tools/gimppenciltool.c
	* tools/pdbgen/pdb/paint_tools.pdb: use the pintbrush core for
	pencil drawing.

	* app/pdb/paint_tools_cmds.c: regenerated.

	* app/tools/gimppaintoptions-gui.c: show all paintbrush options
	except "Hardness" for the pencil tool.
This commit is contained in:
Michael Natterer 2003-07-14 15:43:21 +00:00 committed by Michael Natterer
parent ae344b1088
commit e1e943b9fa
11 changed files with 227 additions and 302 deletions

View File

@ -1,3 +1,23 @@
2003-07-14 Michael Natterer <mitch@gimp.org>
* app/paint/Makefile.am
* app/paint/gimppencil.[ch]: removed.
* app/paint/gimppenciloptions.[ch]: new files. Does nothing except
setting the default value of "hard" to TRUE.
* app/paint/paint.c
* app/tools/tool_manager.c: changed accordingly.
* app/tools/gimppenciltool.c
* tools/pdbgen/pdb/paint_tools.pdb: use the pintbrush core for
pencil drawing.
* app/pdb/paint_tools_cmds.c: regenerated.
* app/tools/gimppaintoptions-gui.c: show all paintbrush options
except "Hardness" for the pencil tool.
2003-07-14 Michael Natterer <mitch@gimp.org>
* app/paint/gimperaseroptions.[ch]: removed "gboolean hard"

View File

@ -49,8 +49,8 @@ libapppaint_a_sources = \
gimppaintcore-undo.h \
gimppaintoptions.c \
gimppaintoptions.h \
gimppencil.c \
gimppencil.h \
gimppenciloptions.c \
gimppenciloptions.h \
gimppaintbrush.c \
gimppaintbrush.h \
gimpsmudge.c \

View File

@ -1,219 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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 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 "libgimpcolor/gimpcolor.h"
#include "paint-types.h"
#include "base/temp-buf.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "gimppaintoptions.h"
#include "gimppencil.h"
#include "gimp-intl.h"
static void gimp_pencil_class_init (GimpPencilClass *klass);
static void gimp_pencil_init (GimpPencil *pencil);
static void gimp_pencil_paint (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintCoreState paint_state);
static void gimp_pencil_motion (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options);
static GimpPaintCoreClass *parent_class = NULL;
void
gimp_pencil_register (Gimp *gimp,
GimpPaintRegisterCallback callback)
{
(* callback) (gimp,
GIMP_TYPE_PENCIL,
GIMP_TYPE_PAINT_OPTIONS,
_("Pencil"));
}
GType
gimp_pencil_get_type (void)
{
static GType type = 0;
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpPencilClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_pencil_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPencil),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_pencil_init,
};
type = g_type_register_static (GIMP_TYPE_PAINT_CORE,
"GimpPencil",
&info, 0);
}
return type;
}
static void
gimp_pencil_class_init (GimpPencilClass *klass)
{
GimpPaintCoreClass *paint_core_class;
paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
paint_core_class->paint = gimp_pencil_paint;
}
static void
gimp_pencil_init (GimpPencil *pencil)
{
GimpPaintCore *paint_core;
paint_core = GIMP_PAINT_CORE (pencil);
paint_core->flags |= CORE_HANDLES_CHANGING_BRUSH;
}
static void
gimp_pencil_paint (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintCoreState paint_state)
{
switch (paint_state)
{
case MOTION_PAINT:
gimp_pencil_motion (paint_core, drawable, paint_options);
break;
default:
break;
}
}
static void
gimp_pencil_motion (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options)
{
GimpPressureOptions *pressure_options;
GimpContext *context;
GimpImage *gimage;
TempBuf *area;
guchar col[MAX_CHANNELS];
gdouble opacity;
gdouble scale;
GimpPaintApplicationMode paint_appl_mode;
context = GIMP_CONTEXT (paint_options);
pressure_options = paint_options->pressure_options;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
paint_appl_mode = paint_options->application_mode;
if (pressure_options->size)
scale = paint_core->cur_coords.pressure;
else
scale = 1.0;
/* Get a region which can be used to paint to */
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
return;
/* color the pixels */
if (pressure_options->color)
{
GimpRGB color;
gimp_gradient_get_color_at (gimp_context_get_gradient (context),
paint_core->cur_coords.pressure,
&color);
gimp_rgba_get_uchar (&color,
&col[RED_PIX],
&col[GREEN_PIX],
&col[BLUE_PIX],
&col[ALPHA_PIX]);
color_pixels (temp_buf_data (area), col,
area->width * area->height,
area->bytes);
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
}
else if (paint_core->brush && paint_core->brush->pixmap)
{
/* if it's a pixmap, do pixmap stuff */
gimp_paint_core_color_area_with_pixmap (paint_core,
gimage, drawable,
area, scale, GIMP_BRUSH_HARD);
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
}
else
{
gimp_image_get_foreground (gimage, drawable, col);
col[area->bytes - 1] = OPAQUE_OPACITY;
color_pixels (temp_buf_data (area), col,
area->width * area->height,
area->bytes);
}
opacity = gimp_context_get_opacity (context);
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_core->cur_coords.pressure;
/* paste the newly painted canvas to the gimage which is being worked on */
gimp_paint_core_paste_canvas (paint_core, drawable,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
GIMP_BRUSH_HARD,
scale,
paint_appl_mode);
}

View File

@ -1,58 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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 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_PENCIL_H__
#define __GIMP_PENCIL_H__
/* FIXME: This whole core should probably just be a paintbrush core that
* has an option of hard edge. It'll give the "pencil core" all the
* flashy stuff the paintbrush core has, and not duplicate code.
*/
#include "gimppaintcore.h"
#define GIMP_TYPE_PENCIL (gimp_pencil_get_type ())
#define GIMP_PENCIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PENCIL, GimpPencil))
#define GIMP_PENCIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PENCIL, GimpPencilClass))
#define GIMP_IS_PENCIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PENCIL))
#define GIMP_IS_PENCIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PENCIL))
#define GIMP_PENCIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PENCIL, GimpPencilClass))
typedef struct _GimpPencil GimpPencil;
typedef struct _GimpPencilClass GimpPencilClass;
struct _GimpPencil
{
GimpPaintCore parent_instance;
};
struct _GimpPencilClass
{
GimpPaintCoreClass parent_class;
};
void gimp_pencil_register (Gimp *gimp,
GimpPaintRegisterCallback callback);
GType gimp_pencil_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_PENCIL_H__ */

View File

@ -0,0 +1,147 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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 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 "paint-types.h"
#include "config/gimpconfig-params.h"
#include "gimppenciloptions.h"
#define PENCIL_DEFAULT_HARD TRUE
enum
{
PROP_0,
PROP_HARD
};
static void gimp_pencil_options_init (GimpPencilOptions *options);
static void gimp_pencil_options_class_init (GimpPencilOptionsClass *options_class);
static void gimp_pencil_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_pencil_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpPaintOptionsClass *parent_class = NULL;
GType
gimp_pencil_options_get_type (void)
{
static GType type = 0;
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpPencilOptionsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_pencil_options_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPencilOptions),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_pencil_options_init,
};
type = g_type_register_static (GIMP_TYPE_PAINT_OPTIONS,
"GimpPencilOptions",
&info, 0);
}
return type;
}
static void
gimp_pencil_options_class_init (GimpPencilOptionsClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_pencil_options_set_property;
object_class->get_property = gimp_pencil_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HARD,
"hard", NULL,
PENCIL_DEFAULT_HARD,
0);
}
static void
gimp_pencil_options_init (GimpPencilOptions *options)
{
}
static void
gimp_pencil_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpPencilOptions *options;
options = GIMP_PENCIL_OPTIONS (object);
switch (property_id)
{
case PROP_HARD:
options->hard = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_pencil_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpPencilOptions *options;
options = GIMP_PENCIL_OPTIONS (object);
switch (property_id)
{
case PROP_HARD:
g_value_set_boolean (value, options->hard);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}

View File

@ -0,0 +1,41 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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 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_PENCIL_OPTIONS_H__
#define __GIMP_PENCIL_OPTIONS_H__
#include "gimppaintoptions.h"
#define GIMP_TYPE_PENCIL_OPTIONS (gimp_pencil_options_get_type ())
#define GIMP_PENCIL_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PENCIL_OPTIONS, GimpPencilOptions))
#define GIMP_PENCIL_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PENCIL_OPTIONS, GimpPencilOptionsClass))
#define GIMP_IS_PENCIL_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PENCIL_OPTIONS))
#define GIMP_IS_PENCIL_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PENCIL_OPTIONS))
#define GIMP_PENCIL_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PENCIL_OPTIONS, GimpPencilOptionsClass))
typedef struct _GimpPaintOptions GimpPencilOptions;
typedef struct _GimpPaintOptionsClass GimpPencilOptionsClass;
GType gimp_pencil_options_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_PENCIL_OPTIONS_H__ */

View File

@ -33,7 +33,6 @@
#include "gimpdodgeburn.h"
#include "gimperaser.h"
#include "gimppaintbrush.h"
#include "gimppencil.h"
#include "gimpsmudge.h"
@ -58,8 +57,7 @@ paint_init (Gimp *gimp)
gimp_clone_register,
gimp_airbrush_register,
gimp_eraser_register,
gimp_paintbrush_register,
gimp_pencil_register,
gimp_paintbrush_register
};
gint i;
@ -104,12 +102,8 @@ paint_register (Gimp *gimp,
g_return_if_fail (g_type_is_a (paint_type, GIMP_TYPE_PAINT_CORE));
g_return_if_fail (g_type_is_a (paint_options_type, GIMP_TYPE_PAINT_OPTIONS));
g_return_if_fail (blurb != NULL);
if (paint_type == GIMP_TYPE_PENCIL)
{
pdb_string = "gimp_pencil";
}
else if (paint_type == GIMP_TYPE_PAINTBRUSH)
if (paint_type == GIMP_TYPE_PAINTBRUSH)
{
pdb_string = "gimp_paintbrush_default";
}

View File

@ -42,7 +42,7 @@
#include "paint/gimperaseroptions.h"
#include "paint/gimppaintbrush.h"
#include "paint/gimppaintcore-stroke.h"
#include "paint/gimppencil.h"
#include "paint/gimppenciloptions.h"
#include "paint/gimpsmudge.h"
#include "paint/gimpsmudgeoptions.h"
#include "paint/paint-types.h"
@ -1191,10 +1191,10 @@ pencil_invoker (Gimp *gimp,
if (success)
{
options = gimp_paint_options_new (gimp, GIMP_TYPE_PAINT_OPTIONS);
options = gimp_paint_options_new (gimp, GIMP_TYPE_PENCIL_OPTIONS);
success = paint_tools_stroke (gimp,
GIMP_TYPE_PENCIL,
GIMP_TYPE_PAINTBRUSH,
options,
drawable,
num_strokes, strokes);

View File

@ -24,8 +24,8 @@
#include "tools-types.h"
#include "paint/gimppencil.h"
#include "paint/gimppaintoptions.h"
#include "paint/gimppaintbrush.h"
#include "paint/gimppenciloptions.h"
#include "gimppenciltool.h"
#include "gimppaintoptions-gui.h"
@ -48,7 +48,7 @@ gimp_pencil_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_PENCIL_TOOL,
GIMP_TYPE_PAINT_OPTIONS,
GIMP_TYPE_PENCIL_OPTIONS,
gimp_paint_options_gui,
GIMP_PAINT_OPTIONS_CONTEXT_MASK,
"gimp-pencil-tool",
@ -81,16 +81,16 @@ gimp_pencil_tool_get_type (void)
};
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
"GimpPencilTool",
"GimpPencilTool",
&tool_info, 0);
}
return tool_type;
}
static void
static void
gimp_pencil_tool_class_init (GimpPencilToolClass *klass)
{
{
GimpPaintToolClass *paint_tool_class;
paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
@ -111,5 +111,5 @@ gimp_pencil_tool_init (GimpPencilTool *pencil)
gimp_tool_control_set_tool_cursor (tool->control, GIMP_PENCIL_TOOL_CURSOR);
paint_tool->pick_colors = TRUE;
paint_tool->core = g_object_new (GIMP_TYPE_PENCIL, NULL);
paint_tool->core = g_object_new (GIMP_TYPE_PAINTBRUSH, NULL);
}

View File

@ -525,7 +525,7 @@ tool_manager_register_tool (GType tool_type,
if (tool_type == GIMP_TYPE_PENCIL_TOOL)
{
paint_core_name = "GimpPencil";
paint_core_name = "GimpPaintbrush";
}
else if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{

View File

@ -546,14 +546,14 @@ HELP
);
%invoke = (
headers => [ qw("paint/gimppencil.h") ],
headers => [ qw("paint/gimppenciloptions.h") ],
vars => [ "GimpPaintOptions *options" ],
code => <<'CODE'
{
options = gimp_paint_options_new (gimp, GIMP_TYPE_PAINT_OPTIONS);
options = gimp_paint_options_new (gimp, GIMP_TYPE_PENCIL_OPTIONS);
success = paint_tools_stroke (gimp,
GIMP_TYPE_PENCIL,
GIMP_TYPE_PAINTBRUSH,
options,
drawable,
num_strokes, strokes);