mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 12:32:37 +00:00
This still is very much in progress. I just want to commit this to avoid
2003-09-27 Simon Budig <simon@gimp.org> This still is very much in progress. I just want to commit this to avoid lossage. It kind of works but there definitely is code in the wrong place now. * app/gui/stroke-dialog.[ch]: New files implementing a dialog containing Svens GimpStrokeEditor-Widget. * app/gui/Makefile.am: changed accordingly. * app/gui/vectors-commands.c: Open the StrokeOptions-Dialog when the "stroke" menu entry gets selected. * app/vectors/gimpvectors.c: Remove bad #ifdef hacks and use Libart/Paintcore-Stroking depending on the type of the stroke_desc Parameter. * app/core/gimpstrokeoptions.c: Proper handle the Enum-Properties. * app/core/gimpscanconvert.[ch]: make the antialias-parameter to gimp_scan_convert_new a gboolean. * app/tools/gimpiscissorstool.c * app/core/gimpdrawable-stroke.c * app/core/gimpimage-mask-select.c: Changed accordingly.
This commit is contained in:
parent
a411575e18
commit
3f76868aee
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,30 @@
|
|||
2003-09-27 Simon Budig <simon@gimp.org>
|
||||
|
||||
This still is very much in progress. I just want to commit this
|
||||
to avoid lossage. It kind of works but there definitely is
|
||||
code in the wrong place now.
|
||||
|
||||
* app/gui/stroke-dialog.[ch]: New files implementing a dialog
|
||||
containing Svens GimpStrokeEditor-Widget.
|
||||
|
||||
* app/gui/Makefile.am: changed accordingly.
|
||||
|
||||
* app/gui/vectors-commands.c: Open the StrokeOptions-Dialog when
|
||||
the "stroke" menu entry gets selected.
|
||||
|
||||
* app/vectors/gimpvectors.c: Remove bad #ifdef hacks and use
|
||||
Libart/Paintcore-Stroking depending on the type of the stroke_desc
|
||||
Parameter.
|
||||
|
||||
* app/core/gimpstrokeoptions.c: Proper handle the Enum-Properties.
|
||||
|
||||
* app/core/gimpscanconvert.[ch]: make the antialias-parameter
|
||||
to gimp_scan_convert_new a gboolean.
|
||||
|
||||
* app/tools/gimpiscissorstool.c
|
||||
* app/core/gimpdrawable-stroke.c
|
||||
* app/core/gimpimage-mask-select.c: Changed accordingly.
|
||||
|
||||
2003-09-26 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
#include "stroke-dialog.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
|
@ -186,6 +187,7 @@ vectors_stroke_cmd_callback (GtkWidget *widget,
|
|||
GimpVectors *active_vectors;
|
||||
GimpDrawable *active_drawable;
|
||||
GimpToolInfo *tool_info;
|
||||
GtkWidget *dialog;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
active_drawable = gimp_image_active_drawable (gimage);
|
||||
|
@ -196,11 +198,19 @@ vectors_stroke_cmd_callback (GtkWidget *widget,
|
|||
return;
|
||||
}
|
||||
|
||||
dialog = stroke_dialog_new (active_drawable,
|
||||
GIMP_ITEM (active_vectors),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
/*
|
||||
tool_info = gimp_context_get_tool (gimp_get_current_context (gimage->gimp));
|
||||
|
||||
gimp_item_stroke (GIMP_ITEM (active_vectors), active_drawable,
|
||||
GIMP_OBJECT (tool_info->paint_info));
|
||||
gimp_image_flush (gimage);
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -167,11 +167,9 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
|
|||
else
|
||||
gimp_channel_push_undo (selection, undo_desc);
|
||||
|
||||
#define SUPERSAMPLE 3
|
||||
|
||||
scan_convert = gimp_scan_convert_new (gimage->width,
|
||||
gimage->height,
|
||||
antialias ? SUPERSAMPLE : 1);
|
||||
antialias);
|
||||
|
||||
gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE);
|
||||
|
||||
|
@ -179,8 +177,6 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
|
|||
|
||||
gimp_scan_convert_free (scan_convert);
|
||||
|
||||
#undef SUPERSAMPLE
|
||||
|
||||
if (mask)
|
||||
{
|
||||
if (feather)
|
||||
|
@ -227,13 +223,9 @@ gimp_image_mask_select_vectors (GimpImage *gimage,
|
|||
else
|
||||
gimp_channel_push_undo (selection, undo_desc);
|
||||
|
||||
#define SUPERSAMPLE 3
|
||||
|
||||
scan_convert = gimp_scan_convert_new (gimage->width,
|
||||
gimage->height,
|
||||
antialias ? SUPERSAMPLE : 1);
|
||||
|
||||
#undef SUPERSAMPLE
|
||||
antialias);
|
||||
|
||||
for (stroke = vectors->strokes; stroke; stroke = stroke->next)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
|
|||
|
||||
gimp_item_offsets (GIMP_ITEM (drawable), &x2, &y2);
|
||||
|
||||
scan_convert = gimp_scan_convert_new (w, h, antialias ? 1 : 0);
|
||||
scan_convert = gimp_scan_convert_new (w, h, antialias);
|
||||
|
||||
/* For each Stroke in the vector, interpolate it, and add it to the
|
||||
* ScanConvert */
|
||||
|
|
|
@ -167,11 +167,9 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
|
|||
else
|
||||
gimp_channel_push_undo (selection, undo_desc);
|
||||
|
||||
#define SUPERSAMPLE 3
|
||||
|
||||
scan_convert = gimp_scan_convert_new (gimage->width,
|
||||
gimage->height,
|
||||
antialias ? SUPERSAMPLE : 1);
|
||||
antialias);
|
||||
|
||||
gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE);
|
||||
|
||||
|
@ -179,8 +177,6 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
|
|||
|
||||
gimp_scan_convert_free (scan_convert);
|
||||
|
||||
#undef SUPERSAMPLE
|
||||
|
||||
if (mask)
|
||||
{
|
||||
if (feather)
|
||||
|
@ -227,13 +223,9 @@ gimp_image_mask_select_vectors (GimpImage *gimage,
|
|||
else
|
||||
gimp_channel_push_undo (selection, undo_desc);
|
||||
|
||||
#define SUPERSAMPLE 3
|
||||
|
||||
scan_convert = gimp_scan_convert_new (gimage->width,
|
||||
gimage->height,
|
||||
antialias ? SUPERSAMPLE : 1);
|
||||
|
||||
#undef SUPERSAMPLE
|
||||
antialias);
|
||||
|
||||
for (stroke = vectors->strokes; stroke; stroke = stroke->next)
|
||||
{
|
||||
|
|
|
@ -65,17 +65,16 @@ static void gimp_scan_convert_close_add_points (GimpScanConvert *sc);
|
|||
GimpScanConvert *
|
||||
gimp_scan_convert_new (guint width,
|
||||
guint height,
|
||||
guint antialias)
|
||||
gboolean antialias)
|
||||
{
|
||||
GimpScanConvert *sc;
|
||||
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail (antialias > 0, NULL);
|
||||
|
||||
sc = g_new0 (GimpScanConvert, 1);
|
||||
|
||||
sc->antialias = (antialias != 0 ? TRUE : FALSE);
|
||||
sc->antialias = antialias;
|
||||
sc->width = width;
|
||||
sc->height = height;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef struct _GimpScanConvert GimpScanConvert;
|
|||
*/
|
||||
GimpScanConvert * gimp_scan_convert_new (guint width,
|
||||
guint height,
|
||||
guint antialias);
|
||||
gboolean antialias);
|
||||
|
||||
void gimp_scan_convert_free (GimpScanConvert *scan_converter);
|
||||
|
||||
|
|
|
@ -185,10 +185,10 @@ gimp_stroke_options_set_property (GObject *object,
|
|||
options->width = g_value_get_double (value);
|
||||
break;
|
||||
case PROP_CAP_STYLE:
|
||||
options->cap_style = g_value_get_int (value);
|
||||
options->cap_style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_JOIN_STYLE:
|
||||
options->join_style = g_value_get_int (value);
|
||||
options->join_style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_MITER:
|
||||
options->miter = g_value_get_double (value);
|
||||
|
@ -253,10 +253,10 @@ gimp_stroke_options_get_property (GObject *object,
|
|||
g_value_set_double (value, options->width);
|
||||
break;
|
||||
case PROP_CAP_STYLE:
|
||||
g_value_set_int (value, options->cap_style);
|
||||
g_value_set_enum (value, options->cap_style);
|
||||
break;
|
||||
case PROP_JOIN_STYLE:
|
||||
g_value_set_int (value, options->join_style);
|
||||
g_value_set_enum (value, options->join_style);
|
||||
break;
|
||||
case PROP_MITER:
|
||||
g_value_set_double (value, options->miter);
|
||||
|
|
161
app/dialogs/stroke-dialog.c
Normal file
161
app/dialogs/stroke-dialog.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2003 Henrik Brix Andersen <brix@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 <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimplimits.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "config/gimpconfig.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
#include "config/gimpconfig-utils.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpstrokeeditor.h"
|
||||
|
||||
#include "stroke-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define STROKE_COLOR_SIZE 20
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
|
||||
static void reset_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
static void cancel_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
static void ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
|
||||
|
||||
/* public function */
|
||||
|
||||
|
||||
GtkWidget *
|
||||
stroke_dialog_new (GimpDrawable *drawable,
|
||||
GimpItem *item,
|
||||
GimpStrokeOptions *stroke_options)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *stroke_editor;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
if (!stroke_options)
|
||||
stroke_options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
|
||||
"gimp", GIMP_IMAGE (GIMP_ITEM (drawable)->gimage)->gimp,
|
||||
NULL);
|
||||
|
||||
/* the dialog */
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_ITEM (drawable)->gimage),
|
||||
_("Stroke Options"), "configure_grid",
|
||||
GIMP_STOCK_GRID, _("Configure Stroke Appearance"),
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_IMAGE_GRID,
|
||||
|
||||
GIMP_STOCK_RESET, reset_callback,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
GTK_STOCK_CANCEL, cancel_callback,
|
||||
NULL, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "drawable", drawable);
|
||||
g_object_set_data (G_OBJECT (dialog), "item", item);
|
||||
g_object_set_data (G_OBJECT (dialog), "stroke_options", stroke_options);
|
||||
|
||||
stroke_editor = gimp_stroke_editor_new (stroke_options);
|
||||
|
||||
gtk_widget_show (stroke_editor);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
|
||||
stroke_editor);
|
||||
|
||||
gtk_widget_show (stroke_editor);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void
|
||||
reset_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
/* something should reset the values here */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cancel_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpStrokeOptions *stroke_options;
|
||||
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke_options");
|
||||
|
||||
g_object_unref (stroke_options);
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpItem *item;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
|
||||
item = g_object_get_data (G_OBJECT (dialog), "item");
|
||||
drawable = g_object_get_data (G_OBJECT (dialog), "drawable");
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke_options");
|
||||
|
||||
gimp_item_stroke (item, drawable, GIMP_OBJECT (stroke_options));
|
||||
|
||||
gimp_image_flush (GIMP_ITEM (drawable)->gimage);
|
||||
|
||||
g_object_unref (stroke_options);
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
30
app/dialogs/stroke-dialog.h
Normal file
30
app/dialogs/stroke-dialog.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2003 Simon Budig
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __STROKE_DIALOG_H__
|
||||
#define __STROKE_DIALOG_H__
|
||||
|
||||
|
||||
GtkWidget * stroke_dialog_new (GimpDrawable *drawable,
|
||||
GimpItem *item,
|
||||
GimpStrokeOptions *stroke_options);
|
||||
|
||||
|
||||
#endif /* __STROKE_DIALOG_H__ */
|
|
@ -49,6 +49,8 @@ dialogs_sources = \
|
|||
resize-dialog.h \
|
||||
resolution-calibrate-dialog.c \
|
||||
resolution-calibrate-dialog.h \
|
||||
stroke-dialog.c \
|
||||
stroke-dialog.h \
|
||||
templates-commands.c \
|
||||
templates-commands.h \
|
||||
templates-menu.c \
|
||||
|
|
161
app/gui/stroke-dialog.c
Normal file
161
app/gui/stroke-dialog.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2003 Henrik Brix Andersen <brix@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 <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimplimits.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "config/gimpconfig.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
#include "config/gimpconfig-utils.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpstrokeeditor.h"
|
||||
|
||||
#include "stroke-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define STROKE_COLOR_SIZE 20
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
|
||||
static void reset_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
static void cancel_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
static void ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
|
||||
|
||||
/* public function */
|
||||
|
||||
|
||||
GtkWidget *
|
||||
stroke_dialog_new (GimpDrawable *drawable,
|
||||
GimpItem *item,
|
||||
GimpStrokeOptions *stroke_options)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *stroke_editor;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
if (!stroke_options)
|
||||
stroke_options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
|
||||
"gimp", GIMP_IMAGE (GIMP_ITEM (drawable)->gimage)->gimp,
|
||||
NULL);
|
||||
|
||||
/* the dialog */
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_ITEM (drawable)->gimage),
|
||||
_("Stroke Options"), "configure_grid",
|
||||
GIMP_STOCK_GRID, _("Configure Stroke Appearance"),
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_IMAGE_GRID,
|
||||
|
||||
GIMP_STOCK_RESET, reset_callback,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
GTK_STOCK_CANCEL, cancel_callback,
|
||||
NULL, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "drawable", drawable);
|
||||
g_object_set_data (G_OBJECT (dialog), "item", item);
|
||||
g_object_set_data (G_OBJECT (dialog), "stroke_options", stroke_options);
|
||||
|
||||
stroke_editor = gimp_stroke_editor_new (stroke_options);
|
||||
|
||||
gtk_widget_show (stroke_editor);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
|
||||
stroke_editor);
|
||||
|
||||
gtk_widget_show (stroke_editor);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void
|
||||
reset_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
/* something should reset the values here */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cancel_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpStrokeOptions *stroke_options;
|
||||
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke_options");
|
||||
|
||||
g_object_unref (stroke_options);
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpItem *item;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
|
||||
item = g_object_get_data (G_OBJECT (dialog), "item");
|
||||
drawable = g_object_get_data (G_OBJECT (dialog), "drawable");
|
||||
stroke_options = g_object_get_data (G_OBJECT (dialog), "stroke_options");
|
||||
|
||||
gimp_item_stroke (item, drawable, GIMP_OBJECT (stroke_options));
|
||||
|
||||
gimp_image_flush (GIMP_ITEM (drawable)->gimage);
|
||||
|
||||
g_object_unref (stroke_options);
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
30
app/gui/stroke-dialog.h
Normal file
30
app/gui/stroke-dialog.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* Copyright (C) 2003 Simon Budig
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __STROKE_DIALOG_H__
|
||||
#define __STROKE_DIALOG_H__
|
||||
|
||||
|
||||
GtkWidget * stroke_dialog_new (GimpDrawable *drawable,
|
||||
GimpItem *item,
|
||||
GimpStrokeOptions *stroke_options);
|
||||
|
||||
|
||||
#endif /* __STROKE_DIALOG_H__ */
|
|
@ -25,6 +25,7 @@
|
|||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
#include "stroke-dialog.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
|
@ -186,6 +187,7 @@ vectors_stroke_cmd_callback (GtkWidget *widget,
|
|||
GimpVectors *active_vectors;
|
||||
GimpDrawable *active_drawable;
|
||||
GimpToolInfo *tool_info;
|
||||
GtkWidget *dialog;
|
||||
return_if_no_vectors (gimage, active_vectors, data);
|
||||
|
||||
active_drawable = gimp_image_active_drawable (gimage);
|
||||
|
@ -196,11 +198,19 @@ vectors_stroke_cmd_callback (GtkWidget *widget,
|
|||
return;
|
||||
}
|
||||
|
||||
dialog = stroke_dialog_new (active_drawable,
|
||||
GIMP_ITEM (active_vectors),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
/*
|
||||
tool_info = gimp_context_get_tool (gimp_get_current_context (gimage->gimp));
|
||||
|
||||
gimp_item_stroke (GIMP_ITEM (active_vectors), active_drawable,
|
||||
GIMP_OBJECT (tool_info->paint_info));
|
||||
gimp_image_flush (gimage);
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -539,7 +539,9 @@ iscissors_convert (GimpIscissorsTool *iscissors,
|
|||
gint i;
|
||||
gint index;
|
||||
|
||||
sc = gimp_scan_convert_new (gdisp->gimage->width, gdisp->gimage->height, 1);
|
||||
sc = gimp_scan_convert_new (gdisp->gimage->width,
|
||||
gdisp->gimage->height,
|
||||
TRUE);
|
||||
|
||||
/* go over the curves in reverse order, adding the points we have */
|
||||
list = iscissors->curves;
|
||||
|
|
|
@ -25,23 +25,18 @@
|
|||
|
||||
#include "vectors-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable-stroke.h"
|
||||
#include "core/gimp-transform-utils.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo-push.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimppaintinfo.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#define LIBART_STROKE
|
||||
#undef LIBART_STROKE_BAD_HACK
|
||||
|
||||
#ifdef LIBART_STROKE
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
# include "core/gimp.h"
|
||||
# include "core/gimpcontext.h"
|
||||
# include "core/gimpdrawable-stroke.h"
|
||||
#else
|
||||
#include "paint/gimppaintcore-stroke.h"
|
||||
#endif
|
||||
|
||||
#include "gimpanchor.h"
|
||||
#include "gimpstroke.h"
|
||||
|
@ -546,9 +541,13 @@ gimp_vectors_stroke (GimpItem *item,
|
|||
GimpObject *stroke_desc)
|
||||
{
|
||||
GimpVectors *vectors;
|
||||
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (stroke_desc);
|
||||
GimpPaintInfo *paint_info;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PAINT_INFO (stroke_desc) ||
|
||||
GIMP_IS_STROKE_OPTIONS (stroke_desc), FALSE);
|
||||
|
||||
vectors = GIMP_VECTORS (item);
|
||||
|
||||
if (! vectors->strokes)
|
||||
|
@ -557,40 +556,54 @@ gimp_vectors_stroke (GimpItem *item,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef LIBART_STROKE
|
||||
if (GIMP_IS_STROKE_OPTIONS (stroke_desc))
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpRGB color;
|
||||
gfloat opacity;
|
||||
gdouble width;
|
||||
gboolean antialias;
|
||||
GimpCapStyle cap_style;
|
||||
GimpJoinStyle join_style;
|
||||
GValue value = { 0, };
|
||||
|
||||
context = gimp_get_current_context (
|
||||
gimp_item_get_image (GIMP_ITEM (drawable))->gimp);
|
||||
stroke_options = GIMP_STROKE_OPTIONS (stroke_desc);
|
||||
|
||||
context = GIMP_CONTEXT (stroke_options);
|
||||
gimp_context_get_foreground (context, &color);
|
||||
opacity = gimp_context_get_opacity (context);
|
||||
|
||||
#ifdef LIBART_STROKE_BAD_HACK
|
||||
/* Bad hack to be able to change the size of the stroke interactively:
|
||||
* use the opacity value as the width...
|
||||
*/
|
||||
g_value_init (&value, G_TYPE_DOUBLE);
|
||||
g_object_get_property (G_OBJECT (stroke_options), "width", &value);
|
||||
width = g_value_get_double (&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_value_init (&value, GIMP_TYPE_CAP_STYLE);
|
||||
g_object_get_property (G_OBJECT (stroke_options), "cap-style", &value);
|
||||
cap_style = g_value_get_enum (&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_value_init (&value, GIMP_TYPE_JOIN_STYLE);
|
||||
g_object_get_property (G_OBJECT (stroke_options), "join-style", &value);
|
||||
join_style = g_value_get_enum (&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_value_init (&value, G_TYPE_BOOLEAN);
|
||||
g_object_get_property (G_OBJECT (stroke_options), "antialias", &value);
|
||||
antialias = g_value_get_boolean (&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
gimp_drawable_stroke_vectors (drawable, vectors,
|
||||
1.0,
|
||||
gimp_context_get_opacity (context),
|
||||
&color,
|
||||
gimp_context_get_paint_mode (context),
|
||||
MAX (0.1, opacity * 100),
|
||||
GIMP_JOIN_MITER, GIMP_CAP_BUTT, TRUE);
|
||||
#else
|
||||
gimp_drawable_stroke_vectors (drawable, vectors,
|
||||
opacity,
|
||||
&color,
|
||||
gimp_context_get_paint_mode (context),
|
||||
5.0,
|
||||
GIMP_JOIN_MITER, GIMP_CAP_BUTT, TRUE);
|
||||
#endif
|
||||
width, join_style, cap_style, antialias);
|
||||
retval = TRUE;
|
||||
}
|
||||
#else
|
||||
else
|
||||
{
|
||||
GimpPaintCore *core = g_object_new (paint_info->paint_type, NULL);
|
||||
GimpPaintCore *core;
|
||||
|
||||
paint_info = GIMP_PAINT_INFO (stroke_desc);
|
||||
core = g_object_new (paint_info->paint_type, NULL);
|
||||
|
||||
retval = gimp_paint_core_stroke_vectors (core, drawable,
|
||||
paint_info->paint_options,
|
||||
|
@ -598,7 +611,6 @@ gimp_vectors_stroke (GimpItem *item,
|
|||
|
||||
g_object_unref (core);
|
||||
}
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue