Commit 57eec590 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

Added new drawable transform API to the PDB. Largely based on patches from

2004-10-26  Sven Neumann  <sven@gimp.org>

	Added new drawable transform API to the PDB. Largely based on
	patches from Joao S. O. Bueno. Fixes bug #137053.

	* app/core/gimpdrawable-transform.[ch]: added missing parameters
	to gimp_drawable_transform_flip().

	* tools/pdbgen/pdb/transform_tools.pdb: changed accordinly.

	* app/base/base-enums.h
	* app/core/core-enums.h: removed pdp-skip for GimpInterpolationType
	and GimpTransformDirection enums.

	* libgimp/gimpenums.h
	* plug-ins/pygimp/gimpenums.py
	* tools/pdbgen/enums.pl
	* tools/pdbgen/groups.pl: regenerated.

	* tools/pdbgen/Makefile.am
	* tools/pdbgen/pdb/drawable_transform.pdb: added new file defining
	the new PDB calls.

	* app/pdb/Makefile.am
	* app/pdb/drawable_transform_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/transform_tools_cmds.c
	* libgimp/gimp_pdb.h
	* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
parent 078cf7a8
2004-10-26 Sven Neumann <sven@gimp.org>
Added new drawable transform API to the PDB. Largely based on
patches from Joao S. O. Bueno. Fixes bug #137053.
* app/core/gimpdrawable-transform.[ch]: added missing parameters
to gimp_drawable_transform_flip().
* tools/pdbgen/pdb/transform_tools.pdb: changed accordinly.
* app/base/base-enums.h
* app/core/core-enums.h: removed pdp-skip for GimpInterpolationType
and GimpTransformDirection enums.
* libgimp/gimpenums.h
* plug-ins/pygimp/gimpenums.py
* tools/pdbgen/enums.pl
* tools/pdbgen/groups.pl: regenerated.
* tools/pdbgen/Makefile.am
* tools/pdbgen/pdb/drawable_transform.pdb: added new file defining
the new PDB calls.
* app/pdb/Makefile.am
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimp_pdb.h
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-26 Michael Natterer <mitch@gimp.org>
 
* modules/controller_linux_input.c
......
......@@ -65,7 +65,7 @@ typedef enum
GType gimp_interpolation_type_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
typedef enum
{
GIMP_INTERPOLATION_NONE, /*< desc="None (Fastest)" >*/
GIMP_INTERPOLATION_LINEAR, /*< desc="Linear" >*/
......
......@@ -385,7 +385,7 @@ typedef enum /*< pdb-skip >*/
GType gimp_transform_direction_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
typedef enum
{
GIMP_TRANSFORM_FORWARD, /*< desc="Forward (traditional)" >*/
GIMP_TRANSFORM_BACKWARD /*< desc="Backward (corrective)" >*/
......
......@@ -914,7 +914,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean
gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpContext *context,
GimpOrientationType flip_type)
GimpOrientationType flip_type,
gboolean center,
gdouble axis,
gboolean clip_result)
{
GimpImage *gimage;
TileManager *orig_tiles;
......@@ -938,30 +941,33 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
TileManager *new_tiles;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
tile_manager_get_offsets (orig_tiles, &off_x, &off_y);
width = tile_manager_width (orig_tiles);
height = tile_manager_height (orig_tiles);
switch (flip_type)
if (center)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
default:
break;
default:
break;
}
}
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis, FALSE);
flip_type, axis,
clip_result);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
......
......@@ -914,7 +914,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean
gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpContext *context,
GimpOrientationType flip_type)
GimpOrientationType flip_type,
gboolean center,
gdouble axis,
gboolean clip_result)
{
GimpImage *gimage;
TileManager *orig_tiles;
......@@ -938,30 +941,33 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
TileManager *new_tiles;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
tile_manager_get_offsets (orig_tiles, &off_x, &off_y);
width = tile_manager_width (orig_tiles);
height = tile_manager_height (orig_tiles);
switch (flip_type)
if (center)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
default:
break;
default:
break;
}
}
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis, FALSE);
flip_type, axis,
clip_result);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
......
......@@ -67,10 +67,13 @@ gboolean gimp_drawable_transform_affine (GimpDrawable *draw
gint recursion_level,
gboolean clip_result,
GimpProgress *progress);
gboolean gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpContext *context,
GimpOrientationType flip_type);
GimpOrientationType flip_type,
gboolean center,
gdouble axis,
gboolean clip_result);
gboolean gimp_drawable_transform_rotate (GimpDrawable *drawable,
GimpContext *context,
......
......@@ -3,54 +3,55 @@
noinst_LIBRARIES = libapppdb.a
libapppdb_a_SOURCES = \
pdb-types.h \
pdb_glue.h \
procedural_db.c \
procedural_db.h \
pdb-types.h \
pdb_glue.h \
procedural_db.c \
procedural_db.h \
\
internal_procs.c \
internal_procs.h \
brush_cmds.c \
brush_select_cmds.c \
brushes_cmds.c \
channel_cmds.c \
color_cmds.c \
context_cmds.c \
convert_cmds.c \
display_cmds.c \
drawable_cmds.c \
edit_cmds.c \
fileops_cmds.c \
floating_sel_cmds.c \
font_select_cmds.c \
fonts_cmds.c \
gimprc_cmds.c \
gradient_cmds.c \
gradient_select_cmds.c \
gradients_cmds.c \
guides_cmds.c \
help_cmds.c \
image_cmds.c \
layer_cmds.c \
message_cmds.c \
misc_cmds.c \
paint_tools_cmds.c \
palette_cmds.c \
palette_select_cmds.c \
palettes_cmds.c \
parasite_cmds.c \
paths_cmds.c \
pattern_cmds.c \
pattern_select_cmds.c \
patterns_cmds.c \
plug_in_cmds.c \
procedural_db_cmds.c \
progress_cmds.c \
selection_cmds.c \
selection_tools_cmds.c \
text_tool_cmds.c \
transform_tools_cmds.c \
undo_cmds.c \
internal_procs.c \
internal_procs.h \
brush_cmds.c \
brush_select_cmds.c \
brushes_cmds.c \
channel_cmds.c \
color_cmds.c \
context_cmds.c \
convert_cmds.c \
display_cmds.c \
drawable_cmds.c \
drawable_transform_cmds.c \
edit_cmds.c \
fileops_cmds.c \
floating_sel_cmds.c \
font_select_cmds.c \
fonts_cmds.c \
gimprc_cmds.c \
gradient_cmds.c \
gradient_select_cmds.c \
gradients_cmds.c \
guides_cmds.c \
help_cmds.c \
image_cmds.c \
layer_cmds.c \
message_cmds.c \
misc_cmds.c \
paint_tools_cmds.c \
palette_cmds.c \
palette_select_cmds.c \
palettes_cmds.c \
parasite_cmds.c \
paths_cmds.c \
pattern_cmds.c \
pattern_select_cmds.c \
patterns_cmds.c \
plug_in_cmds.c \
procedural_db_cmds.c \
progress_cmds.c \
selection_cmds.c \
selection_tools_cmds.c \
text_tool_cmds.c \
transform_tools_cmds.c \
undo_cmds.c \
unit_cmds.c
AM_CPPFLAGS = \
......
This diff is collapsed.
......@@ -30,50 +30,51 @@
/* Forward declarations for registering PDB procs */
void register_brush_procs (Gimp *gimp);
void register_brush_select_procs (Gimp *gimp);
void register_brushes_procs (Gimp *gimp);
void register_channel_procs (Gimp *gimp);
void register_color_procs (Gimp *gimp);
void register_context_procs (Gimp *gimp);
void register_convert_procs (Gimp *gimp);
void register_display_procs (Gimp *gimp);
void register_drawable_procs (Gimp *gimp);
void register_edit_procs (Gimp *gimp);
void register_fileops_procs (Gimp *gimp);
void register_floating_sel_procs (Gimp *gimp);
void register_font_select_procs (Gimp *gimp);
void register_fonts_procs (Gimp *gimp);
void register_gimprc_procs (Gimp *gimp);
void register_gradient_procs (Gimp *gimp);
void register_gradient_select_procs (Gimp *gimp);
void register_gradients_procs (Gimp *gimp);
void register_guides_procs (Gimp *gimp);
void register_help_procs (Gimp *gimp);
void register_image_procs (Gimp *gimp);
void register_layer_procs (Gimp *gimp);
void register_message_procs (Gimp *gimp);
void register_misc_procs (Gimp *gimp);
void register_paint_tools_procs (Gimp *gimp);
void register_palette_procs (Gimp *gimp);
void register_palette_select_procs (Gimp *gimp);
void register_palettes_procs (Gimp *gimp);
void register_parasite_procs (Gimp *gimp);
void register_paths_procs (Gimp *gimp);
void register_pattern_procs (Gimp *gimp);
void register_pattern_select_procs (Gimp *gimp);
void register_patterns_procs (Gimp *gimp);
void register_plug_in_procs (Gimp *gimp);
void register_procedural_db_procs (Gimp *gimp);
void register_progress_procs (Gimp *gimp);
void register_selection_procs (Gimp *gimp);
void register_selection_tools_procs (Gimp *gimp);
void register_text_tool_procs (Gimp *gimp);
void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 413 procedures registered total */
void register_brush_procs (Gimp *gimp);
void register_brush_select_procs (Gimp *gimp);
void register_brushes_procs (Gimp *gimp);
void register_channel_procs (Gimp *gimp);
void register_color_procs (Gimp *gimp);
void register_context_procs (Gimp *gimp);
void register_convert_procs (Gimp *gimp);
void register_display_procs (Gimp *gimp);
void register_drawable_procs (Gimp *gimp);
void register_drawable_transform_procs (Gimp *gimp);
void register_edit_procs (Gimp *gimp);
void register_fileops_procs (Gimp *gimp);
void register_floating_sel_procs (Gimp *gimp);
void register_font_select_procs (Gimp *gimp);
void register_fonts_procs (Gimp *gimp);
void register_gimprc_procs (Gimp *gimp);
void register_gradient_procs (Gimp *gimp);
void register_gradient_select_procs (Gimp *gimp);
void register_gradients_procs (Gimp *gimp);
void register_guides_procs (Gimp *gimp);
void register_help_procs (Gimp *gimp);
void register_image_procs (Gimp *gimp);
void register_layer_procs (Gimp *gimp);
void register_message_procs (Gimp *gimp);
void register_misc_procs (Gimp *gimp);
void register_paint_tools_procs (Gimp *gimp);
void register_palette_procs (Gimp *gimp);
void register_palette_select_procs (Gimp *gimp);
void register_palettes_procs (Gimp *gimp);
void register_parasite_procs (Gimp *gimp);
void register_paths_procs (Gimp *gimp);
void register_pattern_procs (Gimp *gimp);
void register_pattern_select_procs (Gimp *gimp);
void register_patterns_procs (Gimp *gimp);
void register_plug_in_procs (Gimp *gimp);
void register_procedural_db_procs (Gimp *gimp);
void register_progress_procs (Gimp *gimp);
void register_selection_procs (Gimp *gimp);
void register_selection_tools_procs (Gimp *gimp);
void register_text_tool_procs (Gimp *gimp);
void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 420 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -88,121 +89,124 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Brush UI"), 0.019);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.027);
(* status_callback) (NULL, _("Brushes"), 0.026);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.041);
(* status_callback) (NULL, _("Channel"), 0.04);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.063);
(* status_callback) (NULL, _("Color"), 0.062);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.097);
(* status_callback) (NULL, _("Context"), 0.095);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.15);
(* status_callback) (NULL, _("Convert"), 0.148);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.157);
(* status_callback) (NULL, _("Display procedures"), 0.155);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.167);
(* status_callback) (NULL, _("Drawable procedures"), 0.164);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.247);
(* status_callback) (NULL, _("Transformation procedures"), 0.243);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.26);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.266);
(* status_callback) (NULL, _("File Operations"), 0.279);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.288);
(* status_callback) (NULL, _("Floating selections"), 0.3);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.303);
(* status_callback) (NULL, _("Font UI"), 0.314);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.31);
(* status_callback) (NULL, _("Fonts"), 0.321);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.315);
(* status_callback) (NULL, _("Gimprc procedures"), 0.326);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.329);
(* status_callback) (NULL, _("Gradient"), 0.34);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.4);
(* status_callback) (NULL, _("Gradient UI"), 0.41);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.407);
(* status_callback) (NULL, _("Gradients"), 0.417);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.419);
(* status_callback) (NULL, _("Guide procedures"), 0.429);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.433);
(* status_callback) (NULL, _("Help procedures"), 0.443);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.436);
(* status_callback) (NULL, _("Image"), 0.445);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.586);
(* status_callback) (NULL, _("Layer"), 0.593);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.649);
(* status_callback) (NULL, _("Message procedures"), 0.655);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.656);
(* status_callback) (NULL, _("Miscellaneous"), 0.662);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.661);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.667);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.697);
(* status_callback) (NULL, _("Palette"), 0.702);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.724);
(* status_callback) (NULL, _("Palette UI"), 0.729);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.731);
(* status_callback) (NULL, _("Palettes"), 0.736);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.741);
(* status_callback) (NULL, _("Parasite procedures"), 0.745);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.77);
(* status_callback) (NULL, _("Paths"), 0.774);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.806);
(* status_callback) (NULL, _("Pattern"), 0.81);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.811);
(* status_callback) (NULL, _("Pattern UI"), 0.814);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.818);
(* status_callback) (NULL, _("Patterns"), 0.821);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.828);
(* status_callback) (NULL, _("Plug-in"), 0.831);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.84);
(* status_callback) (NULL, _("Procedural database"), 0.843);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.862);
(* status_callback) (NULL, _("Progress"), 0.864);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.874);
(* status_callback) (NULL, _("Image mask"), 0.876);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.918);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.919);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.93);
(* status_callback) (NULL, _("Text procedures"), 0.931);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.939);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.94);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.954);
(* status_callback) (NULL, _("Undo"), 0.955);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.971);
......
......@@ -79,7 +79,8 @@ flip_invoker (Gimp *gimp,
success = gimp_item_is_attached (GIMP_ITEM (drawable));
if (success)
success = gimp_drawable_transform_flip (drawable, context, flip_type);
success = gimp_drawable_transform_flip (drawable, context,
flip_type, TRUE, 0.0, FALSE);
}
return_args = procedural_db_return_args (&flip_proc, success);
......
......@@ -33,6 +33,7 @@
#include <libgimp/gimpconvert_pdb.h>
#include <libgimp/gimpdisplay_pdb.h>
#include <libgimp/gimpdrawable_pdb.h>
#include <libgimp/gimpdrawabletransform_pdb.h>
#include <libgimp/gimpedit_pdb.h>
#include <libgimp/gimpfileops_pdb.h>
#include <libgimp/gimpfloatingsel_pdb.h>
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpdrawabletransform_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* gimp_drawable_transform_flip:
* @drawable_ID: The affected drawable.
* @flip_type: Type of flip.
* @center: Whether to automatically position the axis in the image center.
* @axis: coord. of flip axis.
* @transform_direction: Direction of Transformation.
* @interpolation: Type of interpolation.
* @supersample: Whether to perform supersample.