mirror of https://github.com/GNOME/gimp.git
app/core/Makefile.am app/core/core-types.h remove this mis-engineered
2008-10-24 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimpstrokedesc.[ch]: remove this mis-engineered abstraction... * app/core/gimpstrokeoptions.[ch]: ...and add its properties and API here. * app/core/gimpitem.[ch]: GimpItem::stroke() take a GimpStrokeOptions instead of a GimpStrokeDesc. * app/core/gimpchannel.c * app/core/gimpselection.c * app/vectors/gimpvectors.c * app/actions/select-commands.c * app/actions/vectors-commands.c * app/dialogs/stroke-dialog.c * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/paths.pdb: changed accordingly. * app/pdb/edit-cmds.c * app/pdb/paths-cmds.c: regenerated. svn path=/trunk/; revision=27388
This commit is contained in:
parent
4260576f0e
commit
1a453c37df
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2008-10-24 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/Makefile.am
|
||||
* app/core/core-types.h
|
||||
* app/core/gimpstrokedesc.[ch]: remove this mis-engineered
|
||||
abstraction...
|
||||
|
||||
* app/core/gimpstrokeoptions.[ch]: ...and add its properties and
|
||||
API here.
|
||||
|
||||
* app/core/gimpitem.[ch]: GimpItem::stroke() take a
|
||||
GimpStrokeOptions instead of a GimpStrokeDesc.
|
||||
|
||||
* app/core/gimpchannel.c
|
||||
* app/core/gimpselection.c
|
||||
* app/vectors/gimpvectors.c
|
||||
* app/actions/select-commands.c
|
||||
* app/actions/vectors-commands.c
|
||||
* app/dialogs/stroke-dialog.c
|
||||
* tools/pdbgen/pdb/edit.pdb
|
||||
* tools/pdbgen/pdb/paths.pdb: changed accordingly.
|
||||
|
||||
* app/pdb/edit-cmds.c
|
||||
* app/pdb/paths-cmds.c: regenerated.
|
||||
|
||||
2008-10-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpdialogfactory.c (gimp_dialog_factories_toggle):
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "core/gimpchannel-select.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpselection.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
|
@ -345,12 +345,12 @@ void
|
|||
select_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeDesc *desc;
|
||||
GError *error = NULL;
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeOptions *options;
|
||||
GError *error = NULL;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_context (context, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
@ -364,15 +364,15 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||
return;
|
||||
}
|
||||
|
||||
desc = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-desc");
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-options");
|
||||
|
||||
if (desc)
|
||||
g_object_ref (desc);
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
desc = gimp_stroke_desc_new (image->gimp, context);
|
||||
options = gimp_stroke_options_new (image->gimp, context);
|
||||
|
||||
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||
drawable, context, desc, FALSE, NULL, &error))
|
||||
drawable, context, options, FALSE, NULL, &error))
|
||||
{
|
||||
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
error->message);
|
||||
|
@ -383,7 +383,7 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "core/gimpitemundo.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimpprogress.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "pdb/gimppdb.h"
|
||||
|
@ -394,13 +394,13 @@ void
|
|||
vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpVectors *vectors;
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeDesc *desc;
|
||||
GError *error = NULL;
|
||||
GimpImage *image;
|
||||
GimpVectors *vectors;
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeOptions *options;
|
||||
GError *error = NULL;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
return_if_no_context (context, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
@ -415,14 +415,14 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||
}
|
||||
|
||||
|
||||
desc = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-desc");
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-options");
|
||||
|
||||
if (desc)
|
||||
g_object_ref (desc);
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
desc = gimp_stroke_desc_new (image->gimp, context);
|
||||
options = gimp_stroke_options_new (image->gimp, context);
|
||||
|
||||
if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, desc, FALSE,
|
||||
if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, options, FALSE,
|
||||
NULL, &error))
|
||||
{
|
||||
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
|
@ -434,7 +434,7 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -309,8 +309,6 @@ libappcore_a_sources = \
|
|||
gimpscanconvert.h \
|
||||
gimpselection.c \
|
||||
gimpselection.h \
|
||||
gimpstrokedesc.c \
|
||||
gimpstrokedesc.h \
|
||||
gimpstrokeoptions.c \
|
||||
gimpstrokeoptions.h \
|
||||
gimpsubprogress.c \
|
||||
|
|
|
@ -148,7 +148,6 @@ typedef struct _GimpParasiteList GimpParasiteList;
|
|||
typedef struct _GimpPdbProgress GimpPdbProgress;
|
||||
typedef struct _GimpProjection GimpProjection;
|
||||
typedef struct _GimpSubProgress GimpSubProgress;
|
||||
typedef struct _GimpStrokeDesc GimpStrokeDesc;
|
||||
/* typedef struct _GimpTemplate GimpTemplate; in config-types.h */
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "gimpmarshal.h"
|
||||
#include "gimppaintinfo.h"
|
||||
#include "gimppickable.h"
|
||||
#include "gimpstrokedesc.h"
|
||||
#include "gimpstrokeoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -74,148 +74,148 @@ GeglNode * gegl_node_add_child (GeglNode *self,
|
|||
|
||||
static void gimp_channel_pickable_iface_init (GimpPickableInterface *iface);
|
||||
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
|
||||
static gint64 gimp_channel_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
static gint64 gimp_channel_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
static gchar * gimp_channel_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
static gchar * gimp_channel_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
||||
static gboolean gimp_channel_is_attached (GimpItem *item);
|
||||
static GimpItem * gimp_channel_duplicate (GimpItem *item,
|
||||
GType new_type);
|
||||
static void gimp_channel_convert (GimpItem *item,
|
||||
GimpImage *dest_image);
|
||||
static void gimp_channel_translate (GimpItem *item,
|
||||
gint off_x,
|
||||
gint off_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
static gboolean gimp_channel_is_attached (GimpItem *item);
|
||||
static GimpItem * gimp_channel_duplicate (GimpItem *item,
|
||||
GType new_type);
|
||||
static void gimp_channel_convert (GimpItem *item,
|
||||
GimpImage *dest_image);
|
||||
static void gimp_channel_translate (GimpItem *item,
|
||||
gint off_x,
|
||||
gint off_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
GimpInterpolationType interp_type,
|
||||
GimpProgress *progress);
|
||||
static void gimp_channel_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint offx,
|
||||
gint offy);
|
||||
static void gimp_channel_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress);
|
||||
static void gimp_channel_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint offx,
|
||||
gint offy);
|
||||
static void gimp_channel_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis,
|
||||
gboolean flip_result);
|
||||
static void gimp_channel_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType flip_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean flip_result);
|
||||
static void gimp_channel_transform (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gdouble axis,
|
||||
gboolean flip_result);
|
||||
static void gimp_channel_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType flip_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean flip_result);
|
||||
static void gimp_channel_transform (GimpItem *item,
|
||||
GimpContext *context,
|
||||
const GimpMatrix3 *matrix,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interpolation_type,
|
||||
gint recursion_level,
|
||||
gint recursion_level,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
static gboolean gimp_channel_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
GimpProgress *progress);
|
||||
static gboolean gimp_channel_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
||||
static void gimp_channel_invalidate_boundary (GimpDrawable *drawable);
|
||||
static void gimp_channel_get_active_components (const GimpDrawable *drawable,
|
||||
gboolean *active);
|
||||
|
||||
static void gimp_channel_apply_region (GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
static void gimp_channel_apply_region (GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gimp_channel_replace_region (GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gimp_channel_set_tiles (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
TileManager *tiles,
|
||||
GimpImageType type,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
static GeglNode * gimp_channel_get_node (GimpDrawable *drawable);
|
||||
static void gimp_channel_swap_pixels (GimpDrawable *drawable,
|
||||
TileManager *tiles,
|
||||
gboolean sparse,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
TileManager *src1_tiles,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gimp_channel_replace_region (GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
gdouble opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gimp_channel_set_tiles (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
TileManager *tiles,
|
||||
GimpImageType type,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
static GeglNode * gimp_channel_get_node (GimpDrawable *drawable);
|
||||
static void gimp_channel_swap_pixels (GimpDrawable *drawable,
|
||||
TileManager *tiles,
|
||||
gboolean sparse,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static gint gimp_channel_get_opacity_at (GimpPickable *pickable,
|
||||
gint x,
|
||||
gint y);
|
||||
static gint gimp_channel_get_opacity_at (GimpPickable *pickable,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
|
||||
const BoundSeg **segs_in,
|
||||
const BoundSeg **segs_out,
|
||||
gint *num_segs_in,
|
||||
gint *num_segs_out,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
static gboolean gimp_channel_real_bounds (GimpChannel *channel,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
|
||||
static void gimp_channel_real_feather (GimpChannel *channel,
|
||||
gdouble radius_x,
|
||||
gdouble radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_sharpen (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_clear (GimpChannel *channel,
|
||||
const gchar *undo_desc,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_all (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_invert (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_shrink (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
|
||||
const BoundSeg **segs_in,
|
||||
const BoundSeg **segs_out,
|
||||
gint *num_segs_in,
|
||||
gint *num_segs_out,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
static gboolean gimp_channel_real_bounds (GimpChannel *channel,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
|
||||
static void gimp_channel_real_feather (GimpChannel *channel,
|
||||
gdouble radius_x,
|
||||
gdouble radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_sharpen (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_clear (GimpChannel *channel,
|
||||
const gchar *undo_desc,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_all (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_invert (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_shrink (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
|
||||
static void gimp_channel_validate_tile (TileManager *tm,
|
||||
Tile *tile);
|
||||
static void gimp_channel_validate_tile (TileManager *tm,
|
||||
Tile *tile);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE,
|
||||
|
@ -696,11 +696,11 @@ gimp_channel_transform (GimpItem *item,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_channel_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
gimp_channel_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
GimpChannel *channel = GIMP_CHANNEL (item);
|
||||
|
@ -722,11 +722,11 @@ gimp_channel_stroke (GimpItem *item,
|
|||
|
||||
gimp_item_offsets (GIMP_ITEM (channel), &offset_x, &offset_y);
|
||||
|
||||
switch (stroke_desc->method)
|
||||
switch (stroke_options->method)
|
||||
{
|
||||
case GIMP_STROKE_METHOD_LIBART:
|
||||
gimp_drawable_stroke_boundary (drawable,
|
||||
stroke_desc->stroke_options,
|
||||
stroke_options,
|
||||
segs_in, n_segs_in,
|
||||
offset_x, offset_y);
|
||||
retval = TRUE;
|
||||
|
@ -734,13 +734,16 @@ gimp_channel_stroke (GimpItem *item,
|
|||
|
||||
case GIMP_STROKE_METHOD_PAINT_CORE:
|
||||
{
|
||||
GimpPaintInfo *paint_info;
|
||||
GimpPaintCore *core;
|
||||
|
||||
core = g_object_new (stroke_desc->paint_info->paint_type, NULL);
|
||||
paint_info = gimp_context_get_paint_info (GIMP_CONTEXT (stroke_options));
|
||||
|
||||
core = g_object_new (paint_info->paint_type, NULL);
|
||||
|
||||
retval = gimp_paint_core_stroke_boundary (core, drawable,
|
||||
stroke_desc->paint_options,
|
||||
stroke_desc->emulate_dynamics,
|
||||
stroke_options->paint_options,
|
||||
stroke_options->emulate_dynamics,
|
||||
segs_in, n_segs_in,
|
||||
offset_x, offset_y,
|
||||
error);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "gimpmarshal.h"
|
||||
#include "gimpparasitelist.h"
|
||||
#include "gimpprogress.h"
|
||||
#include "gimpstrokedesc.h"
|
||||
#include "gimpstrokeoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -1004,13 +1004,13 @@ gimp_item_transform (GimpItem *item,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_item_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
gboolean use_default_values,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
gimp_item_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
gboolean use_default_values,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GimpItemClass *item_class;
|
||||
gboolean retval = FALSE;
|
||||
|
@ -1020,7 +1020,7 @@ gimp_item_stroke (GimpItem *item,
|
|||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_STROKE_DESC (stroke_desc), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_STROKE_OPTIONS (stroke_options), FALSE);
|
||||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
|
@ -1030,16 +1030,17 @@ gimp_item_stroke (GimpItem *item,
|
|||
{
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
|
||||
gimp_stroke_desc_prepare (stroke_desc, context, use_default_values);
|
||||
gimp_stroke_options_prepare (stroke_options, context, use_default_values);
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_PAINT,
|
||||
item_class->stroke_desc);
|
||||
|
||||
retval = item_class->stroke (item, drawable, stroke_desc, progress, error);
|
||||
retval = item_class->stroke (item, drawable, stroke_options, progress,
|
||||
error);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
gimp_stroke_desc_finish (stroke_desc);
|
||||
gimp_stroke_options_finish (stroke_options);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
|
|
@ -110,7 +110,7 @@ struct _GimpItemClass
|
|||
GimpProgress *progress);
|
||||
gboolean (* stroke) (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
||||
|
@ -213,7 +213,7 @@ void gimp_item_transform (GimpItem *item,
|
|||
gboolean gimp_item_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
gboolean use_default_values,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
|
|
@ -44,85 +44,85 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static gboolean gimp_selection_is_attached (GimpItem *item);
|
||||
static void gimp_selection_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
static gboolean gimp_selection_is_attached (GimpItem *item);
|
||||
static void gimp_selection_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
GimpInterpolationType interp_type,
|
||||
GimpProgress *progress);
|
||||
static void gimp_selection_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint off_x,
|
||||
gint off_y);
|
||||
static void gimp_selection_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress);
|
||||
static void gimp_selection_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint off_x,
|
||||
gint off_y);
|
||||
static void gimp_selection_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
static void gimp_selection_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType rotation_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean clip_result);
|
||||
static gboolean gimp_selection_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
static void gimp_selection_invalidate_boundary (GimpDrawable *drawable);
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
static void gimp_selection_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType rotation_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean clip_result);
|
||||
static gboolean gimp_selection_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
static void gimp_selection_invalidate_boundary (GimpDrawable *drawable);
|
||||
|
||||
static gboolean gimp_selection_boundary (GimpChannel *channel,
|
||||
const BoundSeg **segs_in,
|
||||
const BoundSeg **segs_out,
|
||||
gint *num_segs_in,
|
||||
gint *num_segs_out,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
static gboolean gimp_selection_bounds (GimpChannel *channel,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
static gboolean gimp_selection_is_empty (GimpChannel *channel);
|
||||
static void gimp_selection_feather (GimpChannel *channel,
|
||||
gdouble radius_x,
|
||||
gdouble radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_sharpen (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_clear (GimpChannel *channel,
|
||||
const gchar *undo_desc,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_all (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_invert (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_shrink (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static gboolean gimp_selection_boundary (GimpChannel *channel,
|
||||
const BoundSeg **segs_in,
|
||||
const BoundSeg **segs_out,
|
||||
gint *num_segs_in,
|
||||
gint *num_segs_out,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
static gboolean gimp_selection_bounds (GimpChannel *channel,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
static gboolean gimp_selection_is_empty (GimpChannel *channel);
|
||||
static void gimp_selection_feather (GimpChannel *channel,
|
||||
gdouble radius_x,
|
||||
gdouble radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_sharpen (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_clear (GimpChannel *channel,
|
||||
const gchar *undo_desc,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_all (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_invert (GimpChannel *channel,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_shrink (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean edge_lock,
|
||||
gboolean push_undo);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
|
||||
|
@ -253,11 +253,11 @@ gimp_selection_rotate (GimpItem *item,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_selection_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
gimp_selection_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GimpSelection *selection = GIMP_SELECTION (item);
|
||||
const BoundSeg *dummy_in;
|
||||
|
@ -278,7 +278,8 @@ gimp_selection_stroke (GimpItem *item,
|
|||
|
||||
selection->stroking = TRUE;
|
||||
|
||||
retval = GIMP_ITEM_CLASS (parent_class)->stroke (item, drawable, stroke_desc,
|
||||
retval = GIMP_ITEM_CLASS (parent_class)->stroke (item, drawable,
|
||||
stroke_options,
|
||||
progress, error);
|
||||
|
||||
selection->stroking = FALSE;
|
||||
|
|
|
@ -1,405 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpstrokedesc.c
|
||||
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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 "config/gimpcoreconfig.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimppaintinfo.h"
|
||||
#include "gimpstrokedesc.h"
|
||||
#include "gimpstrokeoptions.h"
|
||||
|
||||
#include "paint/gimppaintoptions.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_GIMP,
|
||||
PROP_METHOD,
|
||||
PROP_STROKE_OPTIONS,
|
||||
PROP_PAINT_INFO,
|
||||
PROP_EMULATE_DYNAMICS,
|
||||
PROP_PAINT_OPTIONS
|
||||
};
|
||||
|
||||
|
||||
static void gimp_stroke_desc_config_iface_init (gpointer iface,
|
||||
gpointer iface_data);
|
||||
|
||||
static GObject * gimp_stroke_desc_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_stroke_desc_finalize (GObject *object);
|
||||
static void gimp_stroke_desc_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_stroke_desc_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static GimpConfig * gimp_stroke_desc_duplicate (GimpConfig *config);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpStrokeDesc, gimp_stroke_desc, GIMP_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||
gimp_stroke_desc_config_iface_init))
|
||||
|
||||
#define parent_class gimp_stroke_desc_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_class_init (GimpStrokeDescClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->constructor = gimp_stroke_desc_constructor;
|
||||
object_class->finalize = gimp_stroke_desc_finalize;
|
||||
object_class->set_property = gimp_stroke_desc_set_property;
|
||||
object_class->get_property = gimp_stroke_desc_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_METHOD,
|
||||
"method", NULL,
|
||||
GIMP_TYPE_STROKE_METHOD,
|
||||
GIMP_STROKE_METHOD_LIBART,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_STROKE_OPTIONS,
|
||||
"stroke-options", NULL,
|
||||
GIMP_TYPE_STROKE_OPTIONS,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_AGGREGATE);
|
||||
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_PAINT_INFO,
|
||||
"paint-info", NULL,
|
||||
GIMP_TYPE_PAINT_INFO,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_EMULATE_DYNAMICS,
|
||||
"emulate-brush-dynamics", NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_PAINT_OPTIONS,
|
||||
"paint-options", NULL,
|
||||
GIMP_TYPE_PAINT_OPTIONS,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_config_iface_init (gpointer iface,
|
||||
gpointer iface_data)
|
||||
{
|
||||
GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
|
||||
|
||||
config_iface->duplicate = gimp_stroke_desc_duplicate;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_init (GimpStrokeDesc *desc)
|
||||
{
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_stroke_desc_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GObject *object;
|
||||
GimpStrokeDesc *desc;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
desc = GIMP_STROKE_DESC (object);
|
||||
|
||||
g_assert (GIMP_IS_GIMP (desc->gimp));
|
||||
|
||||
desc->stroke_options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
|
||||
"gimp", desc->gimp,
|
||||
NULL);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_finalize (GObject *object)
|
||||
{
|
||||
GimpStrokeDesc *desc = GIMP_STROKE_DESC (object);
|
||||
|
||||
if (desc->stroke_options)
|
||||
{
|
||||
g_object_unref (desc->stroke_options);
|
||||
desc->stroke_options = NULL;
|
||||
}
|
||||
|
||||
if (desc->paint_info)
|
||||
{
|
||||
g_object_unref (desc->paint_info);
|
||||
desc->paint_info = NULL;
|
||||
}
|
||||
|
||||
if (desc->paint_options)
|
||||
{
|
||||
g_object_unref (desc->paint_options);
|
||||
desc->paint_options = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpStrokeDesc *desc = GIMP_STROKE_DESC (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
desc->gimp = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_METHOD:
|
||||
desc->method = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_STROKE_OPTIONS:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (desc->stroke_options), 0);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_INFO:
|
||||
if (desc->paint_info)
|
||||
g_object_unref (desc->paint_info);
|
||||
desc->paint_info = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
case PROP_EMULATE_DYNAMICS:
|
||||
desc->emulate_dynamics = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_OPTIONS:
|
||||
if (desc->paint_options)
|
||||
g_object_unref (desc->paint_options);
|
||||
desc->paint_options = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_desc_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpStrokeDesc *desc = GIMP_STROKE_DESC (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, desc->gimp);
|
||||
break;
|
||||
|
||||
case PROP_METHOD:
|
||||
g_value_set_enum (value, desc->method);
|
||||
break;
|
||||
|
||||
case PROP_STROKE_OPTIONS:
|
||||
g_value_set_object (value, desc->stroke_options);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_INFO:
|
||||
g_value_set_object (value, desc->paint_info);
|
||||
break;
|
||||
|
||||
case PROP_EMULATE_DYNAMICS:
|
||||
g_value_set_boolean (value, desc->emulate_dynamics);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_OPTIONS:
|
||||
g_value_set_object (value, desc->paint_options);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GimpConfig *
|
||||
gimp_stroke_desc_duplicate (GimpConfig *config)
|
||||
{
|
||||
GimpStrokeDesc *desc = GIMP_STROKE_DESC (config);
|
||||
GimpStrokeDesc *new_desc;
|
||||
|
||||
new_desc = gimp_stroke_desc_new (desc->gimp,
|
||||
GIMP_CONTEXT (desc->stroke_options));
|
||||
|
||||
gimp_config_sync (G_OBJECT (desc->stroke_options),
|
||||
G_OBJECT (new_desc->stroke_options), 0);
|
||||
gimp_config_sync (G_OBJECT (desc->paint_info),
|
||||
G_OBJECT (new_desc->paint_info), 0);
|
||||
|
||||
if (desc->paint_options)
|
||||
{
|
||||
GObject *options;
|
||||
|
||||
options = gimp_config_duplicate (GIMP_CONFIG (desc->paint_options));
|
||||
g_object_set (new_desc, "paint-options", options, NULL);
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
return GIMP_CONFIG (new_desc);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpStrokeDesc *
|
||||
gimp_stroke_desc_new (Gimp *gimp,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpPaintInfo *paint_info = NULL;
|
||||
GimpStrokeDesc *desc;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||
|
||||
if (context)
|
||||
paint_info = gimp_context_get_paint_info (context);
|
||||
|
||||
if (! paint_info)
|
||||
paint_info = gimp_paint_info_get_standard (gimp);
|
||||
|
||||
desc = g_object_new (GIMP_TYPE_STROKE_DESC,
|
||||
"gimp", gimp,
|
||||
"paint-info", paint_info,
|
||||
NULL);
|
||||
|
||||
gimp_context_define_properties (GIMP_CONTEXT (desc->stroke_options),
|
||||
GIMP_CONTEXT_FOREGROUND_MASK |
|
||||
GIMP_CONTEXT_PATTERN_MASK,
|
||||
FALSE);
|
||||
|
||||
if (context)
|
||||
gimp_context_set_parent (GIMP_CONTEXT (desc->stroke_options), context);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_desc_prepare (GimpStrokeDesc *desc,
|
||||
GimpContext *context,
|
||||
gboolean use_default_values)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE_DESC (desc));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
switch (desc->method)
|
||||
{
|
||||
case GIMP_STROKE_METHOD_LIBART:
|
||||
break;
|
||||
|
||||
case GIMP_STROKE_METHOD_PAINT_CORE:
|
||||
{
|
||||
GimpPaintInfo *paint_info = desc->paint_info;
|
||||
GimpPaintOptions *paint_options;
|
||||
|
||||
if (use_default_values)
|
||||
{
|
||||
paint_options = gimp_paint_options_new (paint_info);
|
||||
|
||||
/* undefine the paint-relevant context properties and get them
|
||||
* from the passed context
|
||||
*/
|
||||
gimp_context_define_properties (GIMP_CONTEXT (paint_options),
|
||||
GIMP_CONTEXT_PAINT_PROPS_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (GIMP_CONTEXT (paint_options), context);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpCoreConfig *config = context->gimp->config;
|
||||
GimpContextPropMask global_props = 0;
|
||||
|
||||
paint_options =
|
||||
gimp_config_duplicate (GIMP_CONFIG (paint_info->paint_options));
|
||||
|
||||
/* FG and BG are always shared between all tools */
|
||||
global_props |= GIMP_CONTEXT_FOREGROUND_MASK;
|
||||
global_props |= GIMP_CONTEXT_BACKGROUND_MASK;
|
||||
|
||||
if (config->global_brush)
|
||||
global_props |= GIMP_CONTEXT_BRUSH_MASK;
|
||||
if (config->global_pattern)
|
||||
global_props |= GIMP_CONTEXT_PATTERN_MASK;
|
||||
if (config->global_palette)
|
||||
global_props |= GIMP_CONTEXT_PALETTE_MASK;
|
||||
if (config->global_gradient)
|
||||
global_props |= GIMP_CONTEXT_GRADIENT_MASK;
|
||||
if (config->global_font)
|
||||
global_props |= GIMP_CONTEXT_FONT_MASK;
|
||||
|
||||
gimp_context_copy_properties (context,
|
||||
GIMP_CONTEXT (paint_options),
|
||||
global_props);
|
||||
}
|
||||
|
||||
g_object_set (desc, "paint-options", paint_options, NULL);
|
||||
g_object_unref (paint_options);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_desc_finish (GimpStrokeDesc *desc)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE_DESC (desc));
|
||||
|
||||
g_object_set (desc, "paint-options", NULL, NULL);
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpstrokedesc.h
|
||||
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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_STROKE_DESC_H__
|
||||
#define __GIMP_STROKE_DESC_H__
|
||||
|
||||
|
||||
#include "gimpcontext.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_STROKE_DESC (gimp_stroke_desc_get_type ())
|
||||
#define GIMP_STROKE_DESC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_STROKE_DESC, GimpStrokeDesc))
|
||||
#define GIMP_STROKE_DESC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_STROKE_DESC, GimpStrokeDescClass))
|
||||
#define GIMP_IS_STROKE_DESC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_STROKE_DESC))
|
||||
#define GIMP_IS_STROKE_DESC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_STROKE_DESC))
|
||||
#define GIMP_STROKE_DESC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_STROKE_DESC, GimpStrokeDescClass))
|
||||
|
||||
|
||||
typedef struct _GimpStrokeDescClass GimpStrokeDescClass;
|
||||
|
||||
struct _GimpStrokeDesc
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
Gimp *gimp;
|
||||
|
||||
GimpStrokeMethod method;
|
||||
|
||||
GimpStrokeOptions *stroke_options;
|
||||
GimpPaintInfo *paint_info;
|
||||
gboolean emulate_dynamics;
|
||||
|
||||
GimpPaintOptions *paint_options;
|
||||
};
|
||||
|
||||
struct _GimpStrokeDescClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_stroke_desc_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpStrokeDesc * gimp_stroke_desc_new (Gimp *gimp,
|
||||
GimpContext *context);
|
||||
void gimp_stroke_desc_prepare (GimpStrokeDesc *desc,
|
||||
GimpContext *context,
|
||||
gboolean use_default_values);
|
||||
void gimp_stroke_desc_finish (GimpStrokeDesc *desc);
|
||||
|
||||
|
||||
#endif /* __GIMP_STROKE_DESC_H__ */
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* gimpstrokeoptions.c
|
||||
* Copyright (C) 2003 Simon Budig
|
||||
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -28,16 +29,26 @@
|
|||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdashpattern.h"
|
||||
#include "gimpmarshal.h"
|
||||
#include "gimppaintinfo.h"
|
||||
#include "gimpstrokeoptions.h"
|
||||
|
||||
#include "paint/gimppaintoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_METHOD,
|
||||
|
||||
PROP_STYLE,
|
||||
PROP_WIDTH,
|
||||
PROP_UNIT,
|
||||
|
@ -47,7 +58,10 @@ enum
|
|||
PROP_ANTIALIAS,
|
||||
PROP_DASH_UNIT,
|
||||
PROP_DASH_OFFSET,
|
||||
PROP_DASH_INFO
|
||||
PROP_DASH_INFO,
|
||||
|
||||
PROP_PAINT_OPTIONS,
|
||||
PROP_EMULATE_DYNAMICS
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -57,17 +71,28 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_stroke_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_stroke_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_stroke_options_config_iface_init (gpointer iface,
|
||||
gpointer iface_data);
|
||||
|
||||
static void gimp_stroke_options_finalize (GObject *object);
|
||||
static void gimp_stroke_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_stroke_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static GimpConfig * gimp_stroke_options_duplicate (GimpConfig *config);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpStrokeOptions, gimp_stroke_options, GIMP_TYPE_FILL_OPTIONS)
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpStrokeOptions, gimp_stroke_options,
|
||||
GIMP_TYPE_FILL_OPTIONS,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||
gimp_stroke_options_config_iface_init))
|
||||
|
||||
#define parent_class gimp_stroke_options_parent_class
|
||||
|
||||
static guint stroke_options_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
@ -78,6 +103,7 @@ gimp_stroke_options_class_init (GimpStrokeOptionsClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *array_spec;
|
||||
|
||||
object_class->finalize = gimp_stroke_options_finalize;
|
||||
object_class->set_property = gimp_stroke_options_set_property;
|
||||
object_class->get_property = gimp_stroke_options_get_property;
|
||||
|
||||
|
@ -93,22 +119,32 @@ gimp_stroke_options_class_init (GimpStrokeOptionsClass *klass)
|
|||
G_TYPE_NONE, 1,
|
||||
GIMP_TYPE_DASH_PRESET);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_METHOD,
|
||||
"method", NULL,
|
||||
GIMP_TYPE_STROKE_METHOD,
|
||||
GIMP_STROKE_METHOD_LIBART,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
|
||||
"width", NULL,
|
||||
0.0, 2000.0, 6.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
|
||||
"unit", NULL,
|
||||
TRUE, FALSE, GIMP_UNIT_PIXEL,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CAP_STYLE,
|
||||
"cap-style", NULL,
|
||||
GIMP_TYPE_CAP_STYLE, GIMP_CAP_BUTT,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_JOIN_STYLE,
|
||||
"join-style", NULL,
|
||||
GIMP_TYPE_JOIN_STYLE, GIMP_JOIN_MITER,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MITER_LIMIT,
|
||||
"miter-limit",
|
||||
_("Convert a mitered join to a bevelled "
|
||||
|
@ -117,6 +153,7 @@ 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_DOUBLE (object_class, PROP_DASH_OFFSET,
|
||||
"dash-offset", NULL,
|
||||
0.0, 2000.0, 0.0,
|
||||
|
@ -130,6 +167,25 @@ gimp_stroke_options_class_init (GimpStrokeOptionsClass *klass)
|
|||
array_spec,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_FLAGS));
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_PAINT_OPTIONS,
|
||||
"paint-options", NULL,
|
||||
GIMP_TYPE_PAINT_OPTIONS,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_EMULATE_DYNAMICS,
|
||||
"emulate-brush-dynamics", NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_options_config_iface_init (gpointer iface,
|
||||
gpointer iface_data)
|
||||
{
|
||||
GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
|
||||
|
||||
config_iface->duplicate = gimp_stroke_options_duplicate;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -137,6 +193,20 @@ gimp_stroke_options_init (GimpStrokeOptions *options)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_options_finalize (GObject *object)
|
||||
{
|
||||
GimpStrokeOptions *options = GIMP_STROKE_OPTIONS (object);
|
||||
|
||||
if (options->paint_options)
|
||||
{
|
||||
g_object_unref (options->paint_options);
|
||||
options->paint_options = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
|
@ -147,6 +217,10 @@ gimp_stroke_options_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_METHOD:
|
||||
options->method = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
options->width = g_value_get_double (value);
|
||||
break;
|
||||
|
@ -176,6 +250,15 @@ gimp_stroke_options_set_property (GObject *object,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_PAINT_OPTIONS:
|
||||
if (options->paint_options)
|
||||
g_object_unref (options->paint_options);
|
||||
options->paint_options = g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_EMULATE_DYNAMICS:
|
||||
options->emulate_dynamics = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -192,6 +275,10 @@ gimp_stroke_options_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_METHOD:
|
||||
g_value_set_enum (value, options->method);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
g_value_set_double (value, options->width);
|
||||
break;
|
||||
|
@ -219,12 +306,75 @@ gimp_stroke_options_get_property (GObject *object,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_PAINT_OPTIONS:
|
||||
g_value_set_object (value, options->paint_options);
|
||||
break;
|
||||
case PROP_EMULATE_DYNAMICS:
|
||||
g_value_set_boolean (value, options->emulate_dynamics);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GimpConfig *
|
||||
gimp_stroke_options_duplicate (GimpConfig *config)
|
||||
{
|
||||
GimpStrokeOptions *options = GIMP_STROKE_OPTIONS (config);
|
||||
GimpStrokeOptions *new_options;
|
||||
|
||||
new_options = gimp_stroke_options_new (GIMP_CONTEXT (options)->gimp,
|
||||
GIMP_CONTEXT (options));
|
||||
|
||||
if (options->paint_options)
|
||||
{
|
||||
GObject *paint_options;
|
||||
|
||||
paint_options = gimp_config_duplicate (GIMP_CONFIG (options->paint_options));
|
||||
g_object_set (new_options, "paint-options", paint_options, NULL);
|
||||
g_object_unref (paint_options);
|
||||
}
|
||||
|
||||
return GIMP_CONFIG (new_options);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpStrokeOptions *
|
||||
gimp_stroke_options_new (Gimp *gimp,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpPaintInfo *paint_info = NULL;
|
||||
GimpStrokeOptions *options;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||
|
||||
if (context)
|
||||
paint_info = gimp_context_get_paint_info (context);
|
||||
|
||||
if (! paint_info)
|
||||
paint_info = gimp_paint_info_get_standard (gimp);
|
||||
|
||||
options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
|
||||
"gimp", gimp,
|
||||
"paint-info", paint_info,
|
||||
NULL);
|
||||
|
||||
gimp_context_define_properties (GIMP_CONTEXT (options),
|
||||
GIMP_CONTEXT_FOREGROUND_MASK |
|
||||
GIMP_CONTEXT_PATTERN_MASK,
|
||||
FALSE);
|
||||
|
||||
if (context)
|
||||
gimp_context_set_parent (GIMP_CONTEXT (options), context);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_stroke_options_take_dash_pattern:
|
||||
* @options: a #GimpStrokeOptions object
|
||||
|
@ -257,3 +407,79 @@ gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
|
|||
g_signal_emit (options, stroke_options_signals [DASH_INFO_CHANGED], 0,
|
||||
preset);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_options_prepare (GimpStrokeOptions *options,
|
||||
GimpContext *context,
|
||||
gboolean use_default_values)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
switch (options->method)
|
||||
{
|
||||
case GIMP_STROKE_METHOD_LIBART:
|
||||
break;
|
||||
|
||||
case GIMP_STROKE_METHOD_PAINT_CORE:
|
||||
{
|
||||
GimpPaintInfo *paint_info = GIMP_CONTEXT (options)->paint_info;
|
||||
GimpPaintOptions *paint_options;
|
||||
|
||||
if (use_default_values)
|
||||
{
|
||||
paint_options = gimp_paint_options_new (paint_info);
|
||||
|
||||
/* undefine the paint-relevant context properties and get them
|
||||
* from the passed context
|
||||
*/
|
||||
gimp_context_define_properties (GIMP_CONTEXT (paint_options),
|
||||
GIMP_CONTEXT_PAINT_PROPS_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (GIMP_CONTEXT (paint_options), context);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpCoreConfig *config = context->gimp->config;
|
||||
GimpContextPropMask global_props = 0;
|
||||
|
||||
paint_options =
|
||||
gimp_config_duplicate (GIMP_CONFIG (paint_info->paint_options));
|
||||
|
||||
/* FG and BG are always shared between all tools */
|
||||
global_props |= GIMP_CONTEXT_FOREGROUND_MASK;
|
||||
global_props |= GIMP_CONTEXT_BACKGROUND_MASK;
|
||||
|
||||
if (config->global_brush)
|
||||
global_props |= GIMP_CONTEXT_BRUSH_MASK;
|
||||
if (config->global_pattern)
|
||||
global_props |= GIMP_CONTEXT_PATTERN_MASK;
|
||||
if (config->global_palette)
|
||||
global_props |= GIMP_CONTEXT_PALETTE_MASK;
|
||||
if (config->global_gradient)
|
||||
global_props |= GIMP_CONTEXT_GRADIENT_MASK;
|
||||
if (config->global_font)
|
||||
global_props |= GIMP_CONTEXT_FONT_MASK;
|
||||
|
||||
gimp_context_copy_properties (context,
|
||||
GIMP_CONTEXT (paint_options),
|
||||
global_props);
|
||||
}
|
||||
|
||||
g_object_set (options, "paint-options", paint_options, NULL);
|
||||
g_object_unref (paint_options);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_options_finish (GimpStrokeOptions *options)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE_OPTIONS (options));
|
||||
|
||||
g_object_set (options, "paint-options", NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -38,34 +38,48 @@ typedef struct _GimpStrokeOptionsClass GimpStrokeOptionsClass;
|
|||
|
||||
struct _GimpStrokeOptions
|
||||
{
|
||||
GimpFillOptions parent_instance;
|
||||
GimpFillOptions parent_instance;
|
||||
|
||||
gdouble width;
|
||||
GimpUnit unit;
|
||||
GimpStrokeMethod method;
|
||||
|
||||
GimpCapStyle cap_style;
|
||||
GimpJoinStyle join_style;
|
||||
/* options for medhod == LIBART */
|
||||
gdouble width;
|
||||
GimpUnit unit;
|
||||
|
||||
gdouble miter_limit;
|
||||
GimpCapStyle cap_style;
|
||||
GimpJoinStyle join_style;
|
||||
|
||||
gdouble dash_offset;
|
||||
GArray *dash_info;
|
||||
gdouble miter_limit;
|
||||
|
||||
gdouble dash_offset;
|
||||
GArray *dash_info;
|
||||
|
||||
/* options for method == PAINT_TOOL */
|
||||
GimpPaintOptions *paint_options;
|
||||
gboolean emulate_dynamics;
|
||||
};
|
||||
|
||||
struct _GimpStrokeOptionsClass
|
||||
{
|
||||
GimpFillOptionsClass parent_class;
|
||||
GimpFillOptionsClass parent_class;
|
||||
|
||||
void (* dash_info_changed) (GimpStrokeOptions *stroke_options,
|
||||
GimpDashPreset preset);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_stroke_options_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_stroke_options_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
|
||||
GimpDashPreset preset,
|
||||
GArray *pattern);
|
||||
GimpStrokeOptions * gimp_stroke_options_new (Gimp *gimp,
|
||||
GimpContext *context);
|
||||
void gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
|
||||
GimpDashPreset preset,
|
||||
GArray *pattern);
|
||||
|
||||
void gimp_stroke_options_prepare (GimpStrokeOptions *options,
|
||||
GimpContext *context,
|
||||
gboolean use_default_values);
|
||||
void gimp_stroke_options_finish (GimpStrokeOptions *options);
|
||||
|
||||
|
||||
#endif /* __GIMP_STROKE_OPTIONS_H__ */
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimppaintinfo.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
|
@ -57,7 +56,7 @@ static void stroke_dialog_response (GtkWidget *widget,
|
|||
static void stroke_dialog_paint_info_selected (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
GimpStrokeDesc *desc);
|
||||
GimpStrokeOptions *options);
|
||||
|
||||
|
||||
/* public function */
|
||||
|
@ -70,16 +69,16 @@ stroke_dialog_new (GimpItem *item,
|
|||
const gchar *help_id,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpStrokeDesc *desc;
|
||||
GimpStrokeDesc *saved_desc;
|
||||
GimpImage *image;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *libart_radio;
|
||||
GtkWidget *paint_radio;
|
||||
GSList *group;
|
||||
GtkWidget *frame;
|
||||
GimpStrokeOptions *options;
|
||||
GimpStrokeOptions *saved_options;
|
||||
GimpImage *image;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *radio_box;
|
||||
GtkWidget *libart_radio;
|
||||
GtkWidget *paint_radio;
|
||||
GSList *group;
|
||||
GtkWidget *frame;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
@ -89,13 +88,13 @@ stroke_dialog_new (GimpItem *item,
|
|||
|
||||
image = gimp_item_get_image (item);
|
||||
|
||||
desc = gimp_stroke_desc_new (context->gimp, context);
|
||||
options = gimp_stroke_options_new (context->gimp, context);
|
||||
|
||||
saved_desc = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-desc");
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-options");
|
||||
|
||||
if (saved_desc)
|
||||
gimp_config_sync (G_OBJECT (saved_desc), G_OBJECT (desc), 0);
|
||||
if (saved_options)
|
||||
gimp_config_sync (G_OBJECT (saved_options), G_OBJECT (options), 0);
|
||||
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item), context,
|
||||
title, "gimp-stroke-options",
|
||||
|
@ -124,7 +123,7 @@ stroke_dialog_new (GimpItem *item,
|
|||
dialog);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp-item", item);
|
||||
g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-desc", desc,
|
||||
g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-options", options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
|
@ -132,7 +131,8 @@ stroke_dialog_new (GimpItem *item,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
radio_box = gimp_prop_enum_radio_box_new (G_OBJECT (desc), "method", -1, -1);
|
||||
radio_box = gimp_prop_enum_radio_box_new (G_OBJECT (options), "method",
|
||||
-1, -1);
|
||||
|
||||
group = gtk_radio_button_get_group (g_object_get_data (G_OBJECT (radio_box),
|
||||
"radio-button"));
|
||||
|
@ -181,12 +181,12 @@ stroke_dialog_new (GimpItem *item,
|
|||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
|
||||
stroke_editor = gimp_stroke_editor_new (desc->stroke_options, yres);
|
||||
stroke_editor = gimp_stroke_editor_new (options, yres);
|
||||
gtk_container_add (GTK_CONTAINER (frame), stroke_editor);
|
||||
gtk_widget_show (stroke_editor);
|
||||
|
||||
gtk_widget_set_sensitive (stroke_editor,
|
||||
desc->method == GIMP_STROKE_METHOD_LIBART);
|
||||
options->method == GIMP_STROKE_METHOD_LIBART);
|
||||
g_object_set_data (G_OBJECT (libart_radio), "set_sensitive", stroke_editor);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ stroke_dialog_new (GimpItem *item,
|
|||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_widget_set_sensitive (vbox,
|
||||
desc->method == GIMP_STROKE_METHOD_PAINT_CORE);
|
||||
options->method == GIMP_STROKE_METHOD_PAINT_CORE);
|
||||
g_object_set_data (G_OBJECT (paint_radio), "set_sensitive", vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
|
@ -231,18 +231,17 @@ stroke_dialog_new (GimpItem *item,
|
|||
context,
|
||||
16, 0);
|
||||
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (combo),
|
||||
GIMP_VIEWABLE (desc->paint_info));
|
||||
GIMP_VIEWABLE (GIMP_CONTEXT (options)->paint_info));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
||||
gtk_widget_show (combo);
|
||||
|
||||
g_signal_connect (combo, "select-item",
|
||||
G_CALLBACK (stroke_dialog_paint_info_selected),
|
||||
desc);
|
||||
|
||||
options);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp-tool-menu", combo);
|
||||
|
||||
button = gimp_prop_check_button_new (G_OBJECT (desc),
|
||||
button = gimp_prop_check_button_new (G_OBJECT (options),
|
||||
"emulate-brush-dynamics",
|
||||
_("_Emulate brush dynamics"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
@ -260,13 +259,13 @@ stroke_dialog_response (GtkWidget *widget,
|
|||
gint response_id,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpStrokeDesc *desc;
|
||||
GimpItem *item;
|
||||
GimpImage *image;
|
||||
GimpContext *context;
|
||||
GimpStrokeOptions *options;
|
||||
GimpItem *item;
|
||||
GimpImage *image;
|
||||
GimpContext *context;
|
||||
|
||||
item = g_object_get_data (G_OBJECT (dialog), "gimp-item");
|
||||
desc = g_object_get_data (G_OBJECT (dialog), "gimp-stroke-desc");
|
||||
options = g_object_get_data (G_OBJECT (dialog), "gimp-stroke-options");
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
context = GIMP_VIEWABLE_DIALOG (dialog)->context;
|
||||
|
@ -279,7 +278,7 @@ stroke_dialog_response (GtkWidget *widget,
|
|||
GtkWidget *combo = g_object_get_data (G_OBJECT (dialog),
|
||||
"gimp-tool-menu");;
|
||||
|
||||
gimp_config_reset (GIMP_CONFIG (desc));
|
||||
gimp_config_reset (GIMP_CONFIG (options));
|
||||
|
||||
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (combo),
|
||||
GIMP_VIEWABLE (tool_info->paint_info));
|
||||
|
@ -289,9 +288,9 @@ stroke_dialog_response (GtkWidget *widget,
|
|||
|
||||
case GTK_RESPONSE_OK:
|
||||
{
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpStrokeDesc *saved_desc;
|
||||
GError *error = NULL;
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpStrokeOptions *saved_options;
|
||||
GError *error = NULL;
|
||||
|
||||
if (! drawable)
|
||||
{
|
||||
|
@ -302,21 +301,21 @@ stroke_dialog_response (GtkWidget *widget,
|
|||
return;
|
||||
}
|
||||
|
||||
saved_desc = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-desc");
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-options");
|
||||
|
||||
if (saved_desc)
|
||||
g_object_ref (saved_desc);
|
||||
if (saved_options)
|
||||
g_object_ref (saved_options);
|
||||
else
|
||||
saved_desc = gimp_stroke_desc_new (context->gimp, context);
|
||||
saved_options = gimp_stroke_options_new (context->gimp, context);
|
||||
|
||||
gimp_config_sync (G_OBJECT (desc), G_OBJECT (saved_desc), 0);
|
||||
gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (context->gimp), "saved-stroke-desc",
|
||||
saved_desc,
|
||||
g_object_set_data_full (G_OBJECT (context->gimp), "saved-stroke-options",
|
||||
saved_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
if (! gimp_item_stroke (item, drawable, context, desc, FALSE, NULL,
|
||||
if (! gimp_item_stroke (item, drawable, context, options, FALSE, NULL,
|
||||
&error))
|
||||
{
|
||||
gimp_message (context->gimp, G_OBJECT (widget),
|
||||
|
@ -340,7 +339,7 @@ static void
|
|||
stroke_dialog_paint_info_selected (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
GimpStrokeDesc *desc)
|
||||
GimpStrokeOptions *options)
|
||||
{
|
||||
g_object_set (desc, "paint-info", viewable, NULL);
|
||||
g_object_set (options, "paint-info", viewable, NULL);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "core/gimplayer.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimpprogress.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "gimppdb.h"
|
||||
|
@ -746,16 +746,18 @@ edit_stroke_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -785,15 +787,17 @@ edit_stroke_vectors_invoker (GimpProcedure *procedure,
|
|||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||
{
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (vectors),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
#include "vectors/gimpanchor.h"
|
||||
#include "vectors/gimpbezierstroke.h"
|
||||
#include "vectors/gimpvectors-compat.h"
|
||||
|
@ -333,15 +333,17 @@ path_stroke_current_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (vectors && drawable)
|
||||
{
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (vectors),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "core/gimpimage-undo-push.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimppaintinfo.h"
|
||||
#include "core/gimpstrokedesc.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "paint/gimppaintcore-stroke.h"
|
||||
#include "paint/gimppaintoptions.h"
|
||||
|
@ -59,57 +59,57 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_vectors_finalize (GObject *object);
|
||||
static void gimp_vectors_finalize (GObject *object);
|
||||
|
||||
static gint64 gimp_vectors_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
static gint64 gimp_vectors_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
static gboolean gimp_vectors_is_attached (GimpItem *item);
|
||||
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
|
||||
GType new_type);
|
||||
static void gimp_vectors_convert (GimpItem *item,
|
||||
GimpImage *dest_image);
|
||||
static void gimp_vectors_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_vectors_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
static gboolean gimp_vectors_is_attached (GimpItem *item);
|
||||
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
|
||||
GType new_type);
|
||||
static void gimp_vectors_convert (GimpItem *item,
|
||||
GimpImage *dest_image);
|
||||
static void gimp_vectors_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_vectors_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint new_offset_x,
|
||||
gint new_offset_y,
|
||||
GimpInterpolationType interp_type,
|
||||
GimpProgress *progress);
|
||||
static void gimp_vectors_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
static void gimp_vectors_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress);
|
||||
static void gimp_vectors_resize (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
static void gimp_vectors_flip (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
static void gimp_vectors_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType rotate_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean clip_result);
|
||||
static void gimp_vectors_transform (GimpItem *item,
|
||||
GimpContext *context,
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
static void gimp_vectors_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType rotate_type,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gboolean clip_result);
|
||||
static void gimp_vectors_transform (GimpItem *item,
|
||||
GimpContext *context,
|
||||
const GimpMatrix3 *matrix,
|
||||
GimpTransformDirection direction,
|
||||
GimpInterpolationType interp_type,
|
||||
gint recursion_level,
|
||||
gint recursion_level,
|
||||
GimpTransformResize clip_result,
|
||||
GimpProgress *progress);
|
||||
static gboolean gimp_vectors_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
GimpProgress *progress);
|
||||
static gboolean gimp_vectors_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
||||
static void gimp_vectors_real_thaw (GimpVectors *vectors);
|
||||
static void gimp_vectors_real_stroke_add (GimpVectors *vectors,
|
||||
|
@ -492,11 +492,11 @@ gimp_vectors_transform (GimpItem *item,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_vectors_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeDesc *stroke_desc,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
gimp_vectors_stroke (GimpItem *item,
|
||||
GimpDrawable *drawable,
|
||||
GimpStrokeOptions *stroke_options,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GimpVectors *vectors = GIMP_VECTORS (item);
|
||||
gboolean retval = FALSE;
|
||||
|
@ -505,24 +505,27 @@ gimp_vectors_stroke (GimpItem *item,
|
|||
if (! vectors->strokes)
|
||||
return TRUE;
|
||||
|
||||
switch (stroke_desc->method)
|
||||
switch (stroke_options->method)
|
||||
{
|
||||
case GIMP_STROKE_METHOD_LIBART:
|
||||
gimp_drawable_stroke_vectors (drawable,
|
||||
stroke_desc->stroke_options,
|
||||
stroke_options,
|
||||
vectors);
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
case GIMP_STROKE_METHOD_PAINT_CORE:
|
||||
{
|
||||
GimpPaintInfo *paint_info;
|
||||
GimpPaintCore *core;
|
||||
|
||||
core = g_object_new (stroke_desc->paint_info->paint_type, NULL);
|
||||
paint_info = gimp_context_get_paint_info (GIMP_CONTEXT (stroke_options));
|
||||
|
||||
core = g_object_new (paint_info->paint_type, NULL);
|
||||
|
||||
retval = gimp_paint_core_stroke_vectors (core, drawable,
|
||||
stroke_desc->paint_options,
|
||||
stroke_desc->emulate_dynamics,
|
||||
stroke_options->paint_options,
|
||||
stroke_options->emulate_dynamics,
|
||||
vectors, error);
|
||||
|
||||
g_object_unref (core);
|
||||
|
|
|
@ -827,21 +827,23 @@ HELP
|
|||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("core/gimpstrokedesc.h") ],
|
||||
headers => [ qw("core/gimpstrokeoptions.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -868,21 +870,23 @@ HELP
|
|||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("core/gimpstrokedesc.h") ],
|
||||
headers => [ qw("core/gimpstrokeoptions.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||
{
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (vectors),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
|
@ -260,7 +260,7 @@ sub path_stroke_current {
|
|||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("core/gimpstrokedesc.h") ],
|
||||
headers => [ qw("core/gimpstrokeoptions.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
GimpVectors *vectors = gimp_image_get_active_vectors (image);
|
||||
|
@ -268,15 +268,17 @@ sub path_stroke_current {
|
|||
|
||||
if (vectors && drawable)
|
||||
{
|
||||
GimpStrokeDesc *desc = gimp_stroke_desc_new (gimp, context);
|
||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
||||
|
||||
g_object_set (desc, "method", GIMP_STROKE_METHOD_PAINT_CORE, NULL);
|
||||
g_object_set (options,
|
||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||
NULL);
|
||||
|
||||
success = gimp_item_stroke (GIMP_ITEM (vectors),
|
||||
drawable, context, desc, TRUE, progress,
|
||||
drawable, context, options, TRUE, progress,
|
||||
error);
|
||||
|
||||
g_object_unref (desc);
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
Loading…
Reference in New Issue