mirror of https://github.com/GNOME/gimp.git
I'm maintaining the helpbrowser (Sven, I dared to add your name, too :-)
2000-01-05 Michael Natterer <mitch@gimp.org> * PLUGIN_MAINTAINERS: I'm maintaining the helpbrowser (Sven, I dared to add your name, too :-) * app/context_manager.c * app/flip_tool.[ch] * app/perspective_tool.[ch] * app/rotate_tool.[ch] * app/scale_tool.[ch] * app/shear_tool.[ch] * app/transform_core.[ch] * app/transform_tool.[ch] * app/tools_cmds.c * tools/pdbgen/pdb/tools.pdb - Show the correct help pages in the transform tools' dialogs. - The transform tool button of the toolbox is now always pressed if a transform tool is active (not only for "rotate"). - Replaced the transform action (CREATING, HANDLE_1, ...) and the transform state (INIT, MOTION, ...) #define's with typed enums. - Changed the return type of the *_recalc functions to "void" instead of "void *" and the return type of the *_transform functions to "TileManager *" instead of "void *". (I probably removed an artefact here because all *_recalc functions returned "(void *) 1"). - Use gboolean instead of int where appropriate. - Code cleanup, indentation.
This commit is contained in:
parent
5e4e7d8884
commit
1b2b43aba8
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2000-01-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* PLUGIN_MAINTAINERS: I'm maintaining the helpbrowser (Sven, I
|
||||
dared to add your name, too :-)
|
||||
|
||||
* app/context_manager.c
|
||||
* app/flip_tool.[ch]
|
||||
* app/perspective_tool.[ch]
|
||||
* app/rotate_tool.[ch]
|
||||
* app/scale_tool.[ch]
|
||||
* app/shear_tool.[ch]
|
||||
* app/transform_core.[ch]
|
||||
* app/transform_tool.[ch]
|
||||
* app/tools_cmds.c
|
||||
* tools/pdbgen/pdb/tools.pdb
|
||||
|
||||
- Show the correct help pages in the transform tools' dialogs.
|
||||
- The transform tool button of the toolbox is now always pressed
|
||||
if a transform tool is active (not only for "rotate").
|
||||
- Replaced the transform action (CREATING, HANDLE_1, ...) and the
|
||||
transform state (INIT, MOTION, ...) #define's with typed enums.
|
||||
- Changed the return type of the *_recalc functions to "void"
|
||||
instead of "void *" and the return type of the *_transform
|
||||
functions to "TileManager *" instead of "void *".
|
||||
(I probably removed an artefact here because all *_recalc
|
||||
functions returned "(void *) 1").
|
||||
- Use gboolean instead of int where appropriate.
|
||||
- Code cleanup, indentation.
|
||||
|
||||
Wed Jan 5 11:35:10 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gimpimage.c: In gimp_image_merge_visible_layers and
|
||||
|
|
|
@ -459,8 +459,8 @@ SIZE : 7.1 kB in 1 file (only C files counted)
|
|||
COMMENT :
|
||||
-----------
|
||||
NAME : helpbrowser
|
||||
AUTHOR : Sven Neumann <sven@gimp.org>, Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
MAINTAINER :
|
||||
AUTHOR : Sven Neumann <sven@gimp.org>, Michael Natterer <mitch@gimp.org>
|
||||
MAINTAINER : Sven Neumann <sven@gimp.org>, Michael Natterer <mitch@gimp.org>
|
||||
SIZE : 32.7 kB in 2 files (only C files counted)
|
||||
COMMENT :
|
||||
-----------
|
||||
|
|
|
@ -59,6 +59,13 @@ context_manager_tool_changed (GimpContext *context,
|
|||
}
|
||||
}
|
||||
|
||||
tools_select (tool_type);
|
||||
|
||||
if (tool_type == SCALE ||
|
||||
tool_type == SHEAR ||
|
||||
tool_type == PERSPECTIVE)
|
||||
tool_type = ROTATE;
|
||||
|
||||
if (! GTK_TOGGLE_BUTTON (tool_info[tool_type].tool_widget)->active)
|
||||
{
|
||||
gtk_signal_handler_block_by_data
|
||||
|
@ -69,8 +76,6 @@ context_manager_tool_changed (GimpContext *context,
|
|||
gtk_signal_handler_unblock_by_data
|
||||
(GTK_OBJECT (tool_info[tool_type].tool_widget), (gpointer) tool_type);
|
||||
}
|
||||
|
||||
tools_select (tool_type);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "transform_core.h"
|
||||
#include "paths_dialogP.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
@ -40,13 +39,14 @@
|
|||
/* the flip structures */
|
||||
|
||||
typedef struct _FlipOptions FlipOptions;
|
||||
|
||||
struct _FlipOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
ToolOptions tool_options;
|
||||
|
||||
ToolType type;
|
||||
ToolType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
InternalOrientationType type;
|
||||
InternalOrientationType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
};
|
||||
|
||||
static FlipOptions *flip_options = NULL;
|
||||
|
@ -76,7 +76,7 @@ flip_options_new (void)
|
|||
gint type_value[2] = { ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL };
|
||||
|
||||
/* the new flip tool options structure */
|
||||
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
|
||||
options = g_new (FlipOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Flip Tool Options"),
|
||||
flip_options_reset);
|
||||
|
@ -119,35 +119,35 @@ flip_modifier_key_func (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
void *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
transform_info = NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
case RECALC:
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* transform_core->trans_info[FLIP] *= -1.0;*/
|
||||
return flip_tool_flip (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
transform_core->original,
|
||||
(int)transform_core->trans_info[FLIP_INFO],
|
||||
(int) transform_core->trans_info[FLIP_INFO],
|
||||
flip_options->type);
|
||||
break;
|
||||
}
|
||||
|
@ -160,9 +160,9 @@ flip_cursor_update (Tool *tool,
|
|||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
|
@ -196,7 +196,7 @@ flip_cursor_update (Tool *tool,
|
|||
Tool *
|
||||
tools_new_flip (void)
|
||||
{
|
||||
Tool * tool;
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
|
||||
/* The tool options */
|
||||
|
@ -206,13 +206,13 @@ tools_new_flip (void)
|
|||
tools_register (FLIP, (ToolOptions *) flip_options);
|
||||
}
|
||||
|
||||
tool = transform_core_new (FLIP, NON_INTERACTIVE);
|
||||
tool = transform_core_new (FLIP, FALSE);
|
||||
private = tool->private;
|
||||
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_info[FLIP_INFO] = -1.0;
|
||||
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->cursor_update_func = flip_cursor_update;
|
||||
|
||||
return tool;
|
||||
|
@ -232,8 +232,8 @@ flip_tool_flip (GimpImage *gimage,
|
|||
InternalOrientationType type)
|
||||
{
|
||||
TileManager *new;
|
||||
PixelRegion srcPR, destPR;
|
||||
int i;
|
||||
PixelRegion srcPR, destPR;
|
||||
gint i;
|
||||
|
||||
if (!orig)
|
||||
return NULL;
|
||||
|
@ -258,14 +258,16 @@ flip_tool_flip (GimpImage *gimage,
|
|||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
(orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
||||
|
@ -273,10 +275,10 @@ flip_tool_flip (GimpImage *gimage,
|
|||
/* Note that the undo structures etc are setup before we enter this
|
||||
* function.
|
||||
*/
|
||||
if(type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz(gimage);
|
||||
if (type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz (gimage);
|
||||
else
|
||||
paths_transform_flip_vert(gimage);
|
||||
paths_transform_flip_vert (gimage);
|
||||
}
|
||||
|
||||
return new;
|
||||
|
|
|
@ -19,17 +19,21 @@
|
|||
#define __FLIP_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
/* Flip tool functions */
|
||||
|
||||
#include "gimpimage.h"
|
||||
TileManager * flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
|
||||
void * flip_tool_transform (Tool *, gpointer, int);
|
||||
TileManager * flip_tool_flip (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *orig,
|
||||
gint flip,
|
||||
InternalOrientationType type);
|
||||
|
||||
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
|
||||
TileManager *, int, InternalOrientationType);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *tool);
|
||||
|
||||
#endif /* __FLIP_TOOL_H__ */
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "perspective_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -33,32 +31,33 @@
|
|||
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static char matrix_row_buf [3][MAX_INFO_BUF];
|
||||
static gchar matrix_row_buf [3][MAX_INFO_BUF];
|
||||
|
||||
/* forward function declarations */
|
||||
static void * perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
static void perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
|
||||
void *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info =
|
||||
info_dialog_new (_("Perspective Transform Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_perspective.html");
|
||||
info_dialog_add_label (transform_info, _("Matrix:"),
|
||||
matrix_row_buf[0]);
|
||||
info_dialog_add_label (transform_info, "", matrix_row_buf[1]);
|
||||
|
@ -78,17 +77,16 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
perspective_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* Let the transform core handle the inverse mapping */
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return
|
||||
|
@ -104,14 +102,13 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_perspective_tool ()
|
||||
tools_new_perspective_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (PERSPECTIVE, INTERACTIVE);
|
||||
tool = transform_core_new (PERSPECTIVE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -132,26 +129,24 @@ tools_new_perspective_tool ()
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_perspective_tool (Tool *tool)
|
||||
{
|
||||
transform_core_free (tool);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int i;
|
||||
TransformCore *transform_core;
|
||||
gint i;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
char *p = matrix_row_buf[i];
|
||||
int j;
|
||||
gchar *p = matrix_row_buf[i];
|
||||
gint j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -162,18 +157,17 @@ perspective_info_update (Tool *tool)
|
|||
|
||||
info_dialog_update (transform_info);
|
||||
info_dialog_popup (transform_info);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -183,36 +177,36 @@ perspective_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
transform_core->trans_info [X0] += diff_x;
|
||||
transform_core->trans_info [Y0] += diff_y;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
transform_core->trans_info [X1] += diff_x;
|
||||
transform_core->trans_info [Y1] += diff_y;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
transform_core->trans_info [X2] += diff_x;
|
||||
transform_core->trans_info [Y2] += diff_y;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
transform_core->trans_info [X3] += diff_x;
|
||||
transform_core->trans_info [Y3] += diff_y;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
perspective_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
GimpMatrix m;
|
||||
double cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
GimpMatrix m;
|
||||
gdouble cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -226,6 +220,7 @@ perspective_tool_recalc (Tool *tool,
|
|||
cy = transform_core->y1;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
|
||||
if (transform_core->x2 - transform_core->x1)
|
||||
scalex = 1.0 / (transform_core->x2 - transform_core->x1);
|
||||
if (transform_core->y2 - transform_core->y1)
|
||||
|
@ -238,21 +233,18 @@ perspective_tool_recalc (Tool *tool,
|
|||
gimp_matrix_mult (m, transform_core->transform);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
perspective_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
perspective_find_transform (double *coords,
|
||||
GimpMatrix m)
|
||||
perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
double dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
double det1, det2;
|
||||
gdouble dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
gdouble det1, det2;
|
||||
|
||||
dx1 = coords[X1] - coords[X3];
|
||||
dx2 = coords[X2] - coords[X3];
|
||||
|
@ -265,53 +257,54 @@ perspective_find_transform (double *coords,
|
|||
/* Is the mapping affine? */
|
||||
if ((dx3 == 0.0) && (dy3 == 0.0))
|
||||
{
|
||||
m[0][0] = coords[X1] - coords[X0];
|
||||
m[0][1] = coords[X3] - coords[X1];
|
||||
m[0][2] = coords[X0];
|
||||
m[1][0] = coords[Y1] - coords[Y0];
|
||||
m[1][1] = coords[Y3] - coords[Y1];
|
||||
m[1][2] = coords[Y0];
|
||||
m[2][0] = 0.0;
|
||||
m[2][1] = 0.0;
|
||||
matrix[0][0] = coords[X1] - coords[X0];
|
||||
matrix[0][1] = coords[X3] - coords[X1];
|
||||
matrix[0][2] = coords[X0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0];
|
||||
matrix[1][1] = coords[Y3] - coords[Y1];
|
||||
matrix[1][2] = coords[Y0];
|
||||
matrix[2][0] = 0.0;
|
||||
matrix[2][1] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
det1 = dx3 * dy2 - dy3 * dx2;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][0] = det1 / det2;
|
||||
matrix[2][0] = det1 / det2;
|
||||
det1 = dx1 * dy3 - dy1 * dx3;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][1] = det1 / det2;
|
||||
matrix[2][1] = det1 / det2;
|
||||
|
||||
m[0][0] = coords[X1] - coords[X0] + m[2][0] * coords[X1];
|
||||
m[0][1] = coords[X2] - coords[X0] + m[2][1] * coords[X2];
|
||||
m[0][2] = coords[X0];
|
||||
matrix[0][0] = coords[X1] - coords[X0] + matrix[2][0] * coords[X1];
|
||||
matrix[0][1] = coords[X2] - coords[X0] + matrix[2][1] * coords[X2];
|
||||
matrix[0][2] = coords[X0];
|
||||
|
||||
m[1][0] = coords[Y1] - coords[Y0] + m[2][0] * coords[Y1];
|
||||
m[1][1] = coords[Y2] - coords[Y0] + m[2][1] * coords[Y2];
|
||||
m[1][2] = coords[Y0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0] + matrix[2][0] * coords[Y1];
|
||||
matrix[1][1] = coords[Y2] - coords[Y0] + matrix[2][1] * coords[Y2];
|
||||
matrix[1][2] = coords[Y0];
|
||||
}
|
||||
|
||||
m[2][2] = 1.0;
|
||||
matrix[2][2] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
perspective_tool_perspective (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Perspective..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,15 +19,21 @@
|
|||
#define __PERSPECTIVE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * perspective_tool_transform (Tool *, gpointer, int);
|
||||
void * perspective_tool_perspective (GimpImage *, GimpDrawable *,
|
||||
GDisplay *, TileManager *,
|
||||
int, GimpMatrix);
|
||||
void perspective_find_transform (double *, GimpMatrix);
|
||||
TileManager * perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * perspective_tool_perspective (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
void perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix);
|
||||
|
||||
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *);
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *tool);
|
||||
|
||||
#endif /* __PERSPECTIVE_TOOL_H__ */
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "rotate_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -52,7 +50,7 @@ static gdouble center_vals[2];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
|
@ -60,10 +58,10 @@ static void rotate_info_update (Tool *);
|
|||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
void *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -75,7 +73,7 @@ rotate_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
angle_val = 0.0;
|
||||
center_vals[0] = transform_core->cx;
|
||||
center_vals[1] = transform_core->cy;
|
||||
|
@ -83,7 +81,8 @@ rotate_tool_transform (Tool *tool,
|
|||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Rotation Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_rotate.html");
|
||||
|
||||
widget =
|
||||
info_dialog_add_spinbutton (transform_info, _("Angle:"),
|
||||
|
@ -161,17 +160,16 @@ rotate_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
rotate_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
case RECALC:
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return rotate_tool_rotate (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -187,12 +185,12 @@ rotate_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_rotate_tool ()
|
||||
tools_new_rotate_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (ROTATE, INTERACTIVE);
|
||||
tool = transform_core_new (ROTATE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -218,7 +216,7 @@ tools_free_rotate_tool (Tool *tool)
|
|||
static void
|
||||
rotate_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -231,13 +229,13 @@ rotate_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_angle_changed (GtkWidget *w,
|
||||
rotate_angle_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
double value;
|
||||
gdouble value;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -246,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
|
||||
value = GTK_ADJUSTMENT (widget)->value * G_PI / 180.0;
|
||||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
|
@ -259,14 +257,14 @@ rotate_angle_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_center_changed (GtkWidget *w,
|
||||
rotate_center_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
int cx;
|
||||
int cy;
|
||||
gint cx;
|
||||
gint cy;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -275,8 +273,10 @@ rotate_center_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
cx =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
cy =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
@ -294,10 +294,10 @@ static void
|
|||
rotate_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
double angle1, angle2, angle;
|
||||
double cx, cy;
|
||||
double x1, y1, x2, y2;
|
||||
TransformCore *transform_core;
|
||||
gdouble angle1, angle2, angle;
|
||||
gdouble cx, cy;
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -349,13 +349,13 @@ rotate_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
rotate_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
double cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gdouble cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -371,36 +371,31 @@ rotate_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
rotate_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
/* This procedure returns a valid pointer to a new selection if the
|
||||
* requested angle is a multiple of 90 degrees...
|
||||
*/
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
rotate_tool_rotate (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double angle,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Rotating..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __ROTATE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * rotate_tool_transform (Tool *, gpointer, int);
|
||||
void * rotate_tool_rotate (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double, TileManager *, int, GimpMatrix);
|
||||
TileManager * rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * rotate_tool_rotate (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *);
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *tool);
|
||||
|
||||
#endif /* __ROTATE_TOOL_H__ */
|
||||
|
|
154
app/scale_tool.c
154
app/scale_tool.c
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "scale_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -43,18 +41,18 @@ static gchar y_ratio_buf[MAX_INFO_BUF];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *widget, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
@ -65,14 +63,15 @@ scale_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
size_vals[0] = transform_core->x2 - transform_core->x1;
|
||||
size_vals[1] = transform_core->y2 - transform_core->y1;
|
||||
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Scaling Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_scale.html");
|
||||
|
||||
info_dialog_add_label (transform_info, _("Original Width:"),
|
||||
orig_width_buf);
|
||||
|
@ -147,17 +146,16 @@ scale_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
scale_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return scale_tool_scale (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -173,12 +171,12 @@ scale_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_scale_tool ()
|
||||
tools_new_scale_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SCALE, INTERACTIVE);
|
||||
tool = transform_core_new (SCALE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -204,15 +202,15 @@ tools_free_scale_tool (Tool *tool)
|
|||
static void
|
||||
scale_info_update (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio_x, ratio_y;
|
||||
int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
double unit_factor;
|
||||
gchar format_buf[16];
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -269,14 +267,14 @@ scale_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
scale_size_changed (GtkWidget *w,
|
||||
scale_size_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
tool = (Tool *)data;
|
||||
|
||||
|
@ -285,8 +283,10 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
@ -305,24 +305,26 @@ scale_size_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
scale_unit_changed (GtkWidget *w,
|
||||
scale_unit_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
scale_info_update ((Tool*) data);
|
||||
scale_info_update ((Tool *) data);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio;
|
||||
double *x1, *y1;
|
||||
double *x2, *y2;
|
||||
int w, h;
|
||||
int dir_x, dir_y;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio;
|
||||
gdouble *x1;
|
||||
gdouble *y1;
|
||||
gdouble *x2;
|
||||
gdouble *y2;
|
||||
gint w, h;
|
||||
gint dir_x, dir_y;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -332,14 +334,14 @@ scale_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
y2 = &transform_core->trans_info [Y1];
|
||||
dir_x = dir_y = 1;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -347,7 +349,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = -1;
|
||||
dir_y = 1;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
|
@ -355,7 +357,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = 1;
|
||||
dir_y = -1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -367,10 +369,12 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
|
||||
/* if just the mod1 key is down, affect only the height */
|
||||
if (transform_core->state & GDK_MOD1_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
|
||||
if (transform_core->state & GDK_MOD1_MASK &&
|
||||
! (transform_core->state & GDK_CONTROL_MASK))
|
||||
diff_x = 0;
|
||||
/* if just the control key is down, affect only the width */
|
||||
else if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_MOD1_MASK))
|
||||
else if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
! (transform_core->state & GDK_MOD1_MASK))
|
||||
diff_y = 0;
|
||||
|
||||
*x1 += diff_x;
|
||||
|
@ -394,8 +398,11 @@ scale_tool_motion (Tool *tool,
|
|||
if (*y1 <= *y2) *y1 = *y2 + 1;
|
||||
}
|
||||
|
||||
/* if both the control key & mod1 keys are down, keep the aspect ratio intact */
|
||||
if (transform_core->state & GDK_CONTROL_MASK && transform_core->state & GDK_MOD1_MASK)
|
||||
/* if both the control key & mod1 keys are down,
|
||||
* keep the aspect ratio intact
|
||||
*/
|
||||
if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
transform_core->state & GDK_MOD1_MASK)
|
||||
{
|
||||
ratio = (double) (transform_core->x2 - transform_core->x1) /
|
||||
(double) (transform_core->y2 - transform_core->y1);
|
||||
|
@ -413,19 +420,20 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
scale_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
int x1, y1, x2, y2;
|
||||
int diffx, diffy;
|
||||
int cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gint x1, y1, x2, y2;
|
||||
gint diffx, diffy;
|
||||
gint cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
x1 = (int) transform_core->trans_info [X0];
|
||||
y1 = (int) transform_core->trans_info [Y0];
|
||||
x2 = (int) transform_core->trans_info [X1];
|
||||
|
@ -439,22 +447,22 @@ scale_tool_recalc (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
cx = x2; cy = y2;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
cx = x1; cy = y2;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
cx = x2; cy = y1;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y1 - transform_core->y1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
cx = x1; cy = y1;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y1 - transform_core->y1;
|
||||
|
@ -472,31 +480,31 @@ scale_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
scale_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
scale_tool_scale (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double *trans_info,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Scaling..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __SCALE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * scale_tool_transform (Tool *, gpointer, int);
|
||||
void * scale_tool_scale (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double *, TileManager *, int, GimpMatrix);
|
||||
TileManager * scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * scale_tool_scale (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *);
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *tool);
|
||||
|
||||
#endif /* __SCALE_TOOL_H__ */
|
||||
|
|
130
app/shear_tool.c
130
app/shear_tool.c
|
@ -15,8 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include "appenv.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -24,40 +22,39 @@
|
|||
#include "info_dialog.h"
|
||||
#include "shear_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
/* index into trans_info array */
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
|
||||
/* the minimum movement before direction of shear can be determined (pixels) */
|
||||
#define MIN_MOVE 5
|
||||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
static void shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
|
||||
/* Info dialog callback funtions */
|
||||
static void shear_x_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_y_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_x_mag_changed (GtkWidget *widget, gpointer data);
|
||||
static void shear_y_mag_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -67,11 +64,12 @@ shear_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Shear Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_shear.html");
|
||||
|
||||
info_dialog_add_spinbutton (transform_info,
|
||||
_("Shear Magnitude X:"),
|
||||
|
@ -93,17 +91,16 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
shear_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return shear_tool_shear (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -117,14 +114,13 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_shear_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SHEAR, INTERACTIVE);
|
||||
tool = transform_core_new (SHEAR, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -137,7 +133,6 @@ tools_new_shear_tool (void)
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_shear_tool (Tool *tool)
|
||||
{
|
||||
|
@ -147,7 +142,7 @@ tools_free_shear_tool (Tool *tool)
|
|||
static void
|
||||
shear_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -159,22 +154,22 @@ shear_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
shear_x_mag_changed (GtkWidget *w,
|
||||
shear_x_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[XSHEAR])
|
||||
{
|
||||
|
@ -187,22 +182,22 @@ shear_x_mag_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
shear_y_mag_changed (GtkWidget *w,
|
||||
shear_y_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[YSHEAR])
|
||||
{
|
||||
|
@ -218,9 +213,9 @@ static void
|
|||
shear_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int diffx, diffy;
|
||||
int dir;
|
||||
TransformCore *transform_core;
|
||||
gint diffx, diffy;
|
||||
gint dir;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -233,9 +228,9 @@ shear_tool_motion (Tool *tool,
|
|||
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_UNKNOWN)
|
||||
{
|
||||
if (abs(diffx) > MIN_MOVE || abs(diffy) > MIN_MOVE)
|
||||
if (abs (diffx) > MIN_MOVE || abs (diffy) > MIN_MOVE)
|
||||
{
|
||||
if (abs(diffx) > abs(diffy))
|
||||
if (abs (diffx) > abs (diffy))
|
||||
{
|
||||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_HORIZONTAL;
|
||||
transform_core->trans_info[ORIENTATION_VERTICAL] = 0.0;
|
||||
|
@ -245,7 +240,6 @@ shear_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_VERTICAL;
|
||||
transform_core->trans_info[ORIENTATION_HORIZONTAL] = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
/* set the current coords to the last ones */
|
||||
else
|
||||
|
@ -261,45 +255,44 @@ shear_tool_motion (Tool *tool,
|
|||
dir = transform_core->trans_info[HORZ_OR_VERT];
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
static void
|
||||
shear_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
float width, height;
|
||||
float cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gfloat width, height;
|
||||
gfloat cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -322,39 +315,38 @@ shear_tool_recalc (Tool *tool,
|
|||
/* shear matrix */
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix_xshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
else
|
||||
gimp_matrix_yshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
shear_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Shearing..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@
|
|||
#define __SHEAR_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * shear_tool_transform (Tool *, gpointer, int);
|
||||
void * shear_tool_shear (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
TileManager *, int, GimpMatrix);
|
||||
TileManager * shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *);
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *matrix);
|
||||
|
||||
#endif /* __SHEAR_TOOL_H__ */
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "transform_core.h"
|
||||
#include "paths_dialogP.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
@ -40,13 +39,14 @@
|
|||
/* the flip structures */
|
||||
|
||||
typedef struct _FlipOptions FlipOptions;
|
||||
|
||||
struct _FlipOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
ToolOptions tool_options;
|
||||
|
||||
ToolType type;
|
||||
ToolType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
InternalOrientationType type;
|
||||
InternalOrientationType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
};
|
||||
|
||||
static FlipOptions *flip_options = NULL;
|
||||
|
@ -76,7 +76,7 @@ flip_options_new (void)
|
|||
gint type_value[2] = { ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL };
|
||||
|
||||
/* the new flip tool options structure */
|
||||
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
|
||||
options = g_new (FlipOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Flip Tool Options"),
|
||||
flip_options_reset);
|
||||
|
@ -119,35 +119,35 @@ flip_modifier_key_func (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
void *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
transform_info = NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
case RECALC:
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* transform_core->trans_info[FLIP] *= -1.0;*/
|
||||
return flip_tool_flip (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
transform_core->original,
|
||||
(int)transform_core->trans_info[FLIP_INFO],
|
||||
(int) transform_core->trans_info[FLIP_INFO],
|
||||
flip_options->type);
|
||||
break;
|
||||
}
|
||||
|
@ -160,9 +160,9 @@ flip_cursor_update (Tool *tool,
|
|||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
|
@ -196,7 +196,7 @@ flip_cursor_update (Tool *tool,
|
|||
Tool *
|
||||
tools_new_flip (void)
|
||||
{
|
||||
Tool * tool;
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
|
||||
/* The tool options */
|
||||
|
@ -206,13 +206,13 @@ tools_new_flip (void)
|
|||
tools_register (FLIP, (ToolOptions *) flip_options);
|
||||
}
|
||||
|
||||
tool = transform_core_new (FLIP, NON_INTERACTIVE);
|
||||
tool = transform_core_new (FLIP, FALSE);
|
||||
private = tool->private;
|
||||
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_info[FLIP_INFO] = -1.0;
|
||||
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->cursor_update_func = flip_cursor_update;
|
||||
|
||||
return tool;
|
||||
|
@ -232,8 +232,8 @@ flip_tool_flip (GimpImage *gimage,
|
|||
InternalOrientationType type)
|
||||
{
|
||||
TileManager *new;
|
||||
PixelRegion srcPR, destPR;
|
||||
int i;
|
||||
PixelRegion srcPR, destPR;
|
||||
gint i;
|
||||
|
||||
if (!orig)
|
||||
return NULL;
|
||||
|
@ -258,14 +258,16 @@ flip_tool_flip (GimpImage *gimage,
|
|||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
(orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
||||
|
@ -273,10 +275,10 @@ flip_tool_flip (GimpImage *gimage,
|
|||
/* Note that the undo structures etc are setup before we enter this
|
||||
* function.
|
||||
*/
|
||||
if(type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz(gimage);
|
||||
if (type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz (gimage);
|
||||
else
|
||||
paths_transform_flip_vert(gimage);
|
||||
paths_transform_flip_vert (gimage);
|
||||
}
|
||||
|
||||
return new;
|
||||
|
|
|
@ -19,17 +19,21 @@
|
|||
#define __FLIP_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
/* Flip tool functions */
|
||||
|
||||
#include "gimpimage.h"
|
||||
TileManager * flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
|
||||
void * flip_tool_transform (Tool *, gpointer, int);
|
||||
TileManager * flip_tool_flip (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *orig,
|
||||
gint flip,
|
||||
InternalOrientationType type);
|
||||
|
||||
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
|
||||
TileManager *, int, InternalOrientationType);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *tool);
|
||||
|
||||
#endif /* __FLIP_TOOL_H__ */
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "gimage_mask.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tool_options_ui.h"
|
||||
#include "transform_core.h"
|
||||
#include "paths_dialogP.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
@ -40,13 +39,14 @@
|
|||
/* the flip structures */
|
||||
|
||||
typedef struct _FlipOptions FlipOptions;
|
||||
|
||||
struct _FlipOptions
|
||||
{
|
||||
ToolOptions tool_options;
|
||||
ToolOptions tool_options;
|
||||
|
||||
ToolType type;
|
||||
ToolType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
InternalOrientationType type;
|
||||
InternalOrientationType type_d;
|
||||
GtkWidget *type_w[2];
|
||||
};
|
||||
|
||||
static FlipOptions *flip_options = NULL;
|
||||
|
@ -76,7 +76,7 @@ flip_options_new (void)
|
|||
gint type_value[2] = { ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL };
|
||||
|
||||
/* the new flip tool options structure */
|
||||
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
|
||||
options = g_new (FlipOptions, 1);
|
||||
tool_options_init ((ToolOptions *) options,
|
||||
_("Flip Tool Options"),
|
||||
flip_options_reset);
|
||||
|
@ -119,35 +119,35 @@ flip_modifier_key_func (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
void *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
transform_info = NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
case RECALC:
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* transform_core->trans_info[FLIP] *= -1.0;*/
|
||||
return flip_tool_flip (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
transform_core->original,
|
||||
(int)transform_core->trans_info[FLIP_INFO],
|
||||
(int) transform_core->trans_info[FLIP_INFO],
|
||||
flip_options->type);
|
||||
break;
|
||||
}
|
||||
|
@ -160,9 +160,9 @@ flip_cursor_update (Tool *tool,
|
|||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
GDisplay *gdisp;
|
||||
Layer *layer;
|
||||
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
|
@ -196,7 +196,7 @@ flip_cursor_update (Tool *tool,
|
|||
Tool *
|
||||
tools_new_flip (void)
|
||||
{
|
||||
Tool * tool;
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
|
||||
/* The tool options */
|
||||
|
@ -206,13 +206,13 @@ tools_new_flip (void)
|
|||
tools_register (FLIP, (ToolOptions *) flip_options);
|
||||
}
|
||||
|
||||
tool = transform_core_new (FLIP, NON_INTERACTIVE);
|
||||
tool = transform_core_new (FLIP, FALSE);
|
||||
private = tool->private;
|
||||
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_func = flip_tool_transform;
|
||||
private->trans_info[FLIP_INFO] = -1.0;
|
||||
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->modifier_key_func = flip_modifier_key_func;
|
||||
tool->cursor_update_func = flip_cursor_update;
|
||||
|
||||
return tool;
|
||||
|
@ -232,8 +232,8 @@ flip_tool_flip (GimpImage *gimage,
|
|||
InternalOrientationType type)
|
||||
{
|
||||
TileManager *new;
|
||||
PixelRegion srcPR, destPR;
|
||||
int i;
|
||||
PixelRegion srcPR, destPR;
|
||||
gint i;
|
||||
|
||||
if (!orig)
|
||||
return NULL;
|
||||
|
@ -258,14 +258,16 @@ flip_tool_flip (GimpImage *gimage,
|
|||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
(orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
pixel_region_init (&destPR, new,
|
||||
0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
||||
|
@ -273,10 +275,10 @@ flip_tool_flip (GimpImage *gimage,
|
|||
/* Note that the undo structures etc are setup before we enter this
|
||||
* function.
|
||||
*/
|
||||
if(type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz(gimage);
|
||||
if (type == ORIENTATION_HORIZONTAL)
|
||||
paths_transform_flip_horz (gimage);
|
||||
else
|
||||
paths_transform_flip_vert(gimage);
|
||||
paths_transform_flip_vert (gimage);
|
||||
}
|
||||
|
||||
return new;
|
||||
|
|
|
@ -19,17 +19,21 @@
|
|||
#define __FLIP_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
/* Flip tool functions */
|
||||
|
||||
#include "gimpimage.h"
|
||||
TileManager * flip_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
|
||||
void * flip_tool_transform (Tool *, gpointer, int);
|
||||
TileManager * flip_tool_flip (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *orig,
|
||||
gint flip,
|
||||
InternalOrientationType type);
|
||||
|
||||
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
|
||||
TileManager *, int, InternalOrientationType);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *);
|
||||
Tool * tools_new_flip (void);
|
||||
void tools_free_flip_tool (Tool *tool);
|
||||
|
||||
#endif /* __FLIP_TOOL_H__ */
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "perspective_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -33,32 +31,33 @@
|
|||
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static char matrix_row_buf [3][MAX_INFO_BUF];
|
||||
static gchar matrix_row_buf [3][MAX_INFO_BUF];
|
||||
|
||||
/* forward function declarations */
|
||||
static void * perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
static void perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
|
||||
void *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info =
|
||||
info_dialog_new (_("Perspective Transform Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_perspective.html");
|
||||
info_dialog_add_label (transform_info, _("Matrix:"),
|
||||
matrix_row_buf[0]);
|
||||
info_dialog_add_label (transform_info, "", matrix_row_buf[1]);
|
||||
|
@ -78,17 +77,16 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
perspective_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* Let the transform core handle the inverse mapping */
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return
|
||||
|
@ -104,14 +102,13 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_perspective_tool ()
|
||||
tools_new_perspective_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (PERSPECTIVE, INTERACTIVE);
|
||||
tool = transform_core_new (PERSPECTIVE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -132,26 +129,24 @@ tools_new_perspective_tool ()
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_perspective_tool (Tool *tool)
|
||||
{
|
||||
transform_core_free (tool);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int i;
|
||||
TransformCore *transform_core;
|
||||
gint i;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
char *p = matrix_row_buf[i];
|
||||
int j;
|
||||
gchar *p = matrix_row_buf[i];
|
||||
gint j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -162,18 +157,17 @@ perspective_info_update (Tool *tool)
|
|||
|
||||
info_dialog_update (transform_info);
|
||||
info_dialog_popup (transform_info);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -183,36 +177,36 @@ perspective_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
transform_core->trans_info [X0] += diff_x;
|
||||
transform_core->trans_info [Y0] += diff_y;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
transform_core->trans_info [X1] += diff_x;
|
||||
transform_core->trans_info [Y1] += diff_y;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
transform_core->trans_info [X2] += diff_x;
|
||||
transform_core->trans_info [Y2] += diff_y;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
transform_core->trans_info [X3] += diff_x;
|
||||
transform_core->trans_info [Y3] += diff_y;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
perspective_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
GimpMatrix m;
|
||||
double cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
GimpMatrix m;
|
||||
gdouble cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -226,6 +220,7 @@ perspective_tool_recalc (Tool *tool,
|
|||
cy = transform_core->y1;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
|
||||
if (transform_core->x2 - transform_core->x1)
|
||||
scalex = 1.0 / (transform_core->x2 - transform_core->x1);
|
||||
if (transform_core->y2 - transform_core->y1)
|
||||
|
@ -238,21 +233,18 @@ perspective_tool_recalc (Tool *tool,
|
|||
gimp_matrix_mult (m, transform_core->transform);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
perspective_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
perspective_find_transform (double *coords,
|
||||
GimpMatrix m)
|
||||
perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
double dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
double det1, det2;
|
||||
gdouble dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
gdouble det1, det2;
|
||||
|
||||
dx1 = coords[X1] - coords[X3];
|
||||
dx2 = coords[X2] - coords[X3];
|
||||
|
@ -265,53 +257,54 @@ perspective_find_transform (double *coords,
|
|||
/* Is the mapping affine? */
|
||||
if ((dx3 == 0.0) && (dy3 == 0.0))
|
||||
{
|
||||
m[0][0] = coords[X1] - coords[X0];
|
||||
m[0][1] = coords[X3] - coords[X1];
|
||||
m[0][2] = coords[X0];
|
||||
m[1][0] = coords[Y1] - coords[Y0];
|
||||
m[1][1] = coords[Y3] - coords[Y1];
|
||||
m[1][2] = coords[Y0];
|
||||
m[2][0] = 0.0;
|
||||
m[2][1] = 0.0;
|
||||
matrix[0][0] = coords[X1] - coords[X0];
|
||||
matrix[0][1] = coords[X3] - coords[X1];
|
||||
matrix[0][2] = coords[X0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0];
|
||||
matrix[1][1] = coords[Y3] - coords[Y1];
|
||||
matrix[1][2] = coords[Y0];
|
||||
matrix[2][0] = 0.0;
|
||||
matrix[2][1] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
det1 = dx3 * dy2 - dy3 * dx2;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][0] = det1 / det2;
|
||||
matrix[2][0] = det1 / det2;
|
||||
det1 = dx1 * dy3 - dy1 * dx3;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][1] = det1 / det2;
|
||||
matrix[2][1] = det1 / det2;
|
||||
|
||||
m[0][0] = coords[X1] - coords[X0] + m[2][0] * coords[X1];
|
||||
m[0][1] = coords[X2] - coords[X0] + m[2][1] * coords[X2];
|
||||
m[0][2] = coords[X0];
|
||||
matrix[0][0] = coords[X1] - coords[X0] + matrix[2][0] * coords[X1];
|
||||
matrix[0][1] = coords[X2] - coords[X0] + matrix[2][1] * coords[X2];
|
||||
matrix[0][2] = coords[X0];
|
||||
|
||||
m[1][0] = coords[Y1] - coords[Y0] + m[2][0] * coords[Y1];
|
||||
m[1][1] = coords[Y2] - coords[Y0] + m[2][1] * coords[Y2];
|
||||
m[1][2] = coords[Y0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0] + matrix[2][0] * coords[Y1];
|
||||
matrix[1][1] = coords[Y2] - coords[Y0] + matrix[2][1] * coords[Y2];
|
||||
matrix[1][2] = coords[Y0];
|
||||
}
|
||||
|
||||
m[2][2] = 1.0;
|
||||
matrix[2][2] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
perspective_tool_perspective (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Perspective..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,15 +19,21 @@
|
|||
#define __PERSPECTIVE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * perspective_tool_transform (Tool *, gpointer, int);
|
||||
void * perspective_tool_perspective (GimpImage *, GimpDrawable *,
|
||||
GDisplay *, TileManager *,
|
||||
int, GimpMatrix);
|
||||
void perspective_find_transform (double *, GimpMatrix);
|
||||
TileManager * perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * perspective_tool_perspective (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
void perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix);
|
||||
|
||||
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *);
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *tool);
|
||||
|
||||
#endif /* __PERSPECTIVE_TOOL_H__ */
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "rotate_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -52,7 +50,7 @@ static gdouble center_vals[2];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
|
@ -60,10 +58,10 @@ static void rotate_info_update (Tool *);
|
|||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
void *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -75,7 +73,7 @@ rotate_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
angle_val = 0.0;
|
||||
center_vals[0] = transform_core->cx;
|
||||
center_vals[1] = transform_core->cy;
|
||||
|
@ -83,7 +81,8 @@ rotate_tool_transform (Tool *tool,
|
|||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Rotation Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_rotate.html");
|
||||
|
||||
widget =
|
||||
info_dialog_add_spinbutton (transform_info, _("Angle:"),
|
||||
|
@ -161,17 +160,16 @@ rotate_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
rotate_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
case RECALC:
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return rotate_tool_rotate (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -187,12 +185,12 @@ rotate_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_rotate_tool ()
|
||||
tools_new_rotate_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (ROTATE, INTERACTIVE);
|
||||
tool = transform_core_new (ROTATE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -218,7 +216,7 @@ tools_free_rotate_tool (Tool *tool)
|
|||
static void
|
||||
rotate_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -231,13 +229,13 @@ rotate_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_angle_changed (GtkWidget *w,
|
||||
rotate_angle_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
double value;
|
||||
gdouble value;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -246,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
|
||||
value = GTK_ADJUSTMENT (widget)->value * G_PI / 180.0;
|
||||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
|
@ -259,14 +257,14 @@ rotate_angle_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_center_changed (GtkWidget *w,
|
||||
rotate_center_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
int cx;
|
||||
int cy;
|
||||
gint cx;
|
||||
gint cy;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -275,8 +273,10 @@ rotate_center_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
cx =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
cy =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
@ -294,10 +294,10 @@ static void
|
|||
rotate_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
double angle1, angle2, angle;
|
||||
double cx, cy;
|
||||
double x1, y1, x2, y2;
|
||||
TransformCore *transform_core;
|
||||
gdouble angle1, angle2, angle;
|
||||
gdouble cx, cy;
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -349,13 +349,13 @@ rotate_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
rotate_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
double cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gdouble cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -371,36 +371,31 @@ rotate_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
rotate_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
/* This procedure returns a valid pointer to a new selection if the
|
||||
* requested angle is a multiple of 90 degrees...
|
||||
*/
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
rotate_tool_rotate (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double angle,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Rotating..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __ROTATE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * rotate_tool_transform (Tool *, gpointer, int);
|
||||
void * rotate_tool_rotate (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double, TileManager *, int, GimpMatrix);
|
||||
TileManager * rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * rotate_tool_rotate (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *);
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *tool);
|
||||
|
||||
#endif /* __ROTATE_TOOL_H__ */
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "scale_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -43,18 +41,18 @@ static gchar y_ratio_buf[MAX_INFO_BUF];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *widget, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
@ -65,14 +63,15 @@ scale_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
size_vals[0] = transform_core->x2 - transform_core->x1;
|
||||
size_vals[1] = transform_core->y2 - transform_core->y1;
|
||||
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Scaling Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_scale.html");
|
||||
|
||||
info_dialog_add_label (transform_info, _("Original Width:"),
|
||||
orig_width_buf);
|
||||
|
@ -147,17 +146,16 @@ scale_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
scale_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return scale_tool_scale (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -173,12 +171,12 @@ scale_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_scale_tool ()
|
||||
tools_new_scale_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SCALE, INTERACTIVE);
|
||||
tool = transform_core_new (SCALE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -204,15 +202,15 @@ tools_free_scale_tool (Tool *tool)
|
|||
static void
|
||||
scale_info_update (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio_x, ratio_y;
|
||||
int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
double unit_factor;
|
||||
gchar format_buf[16];
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -269,14 +267,14 @@ scale_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
scale_size_changed (GtkWidget *w,
|
||||
scale_size_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
tool = (Tool *)data;
|
||||
|
||||
|
@ -285,8 +283,10 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
@ -305,24 +305,26 @@ scale_size_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
scale_unit_changed (GtkWidget *w,
|
||||
scale_unit_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
scale_info_update ((Tool*) data);
|
||||
scale_info_update ((Tool *) data);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio;
|
||||
double *x1, *y1;
|
||||
double *x2, *y2;
|
||||
int w, h;
|
||||
int dir_x, dir_y;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio;
|
||||
gdouble *x1;
|
||||
gdouble *y1;
|
||||
gdouble *x2;
|
||||
gdouble *y2;
|
||||
gint w, h;
|
||||
gint dir_x, dir_y;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -332,14 +334,14 @@ scale_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
y2 = &transform_core->trans_info [Y1];
|
||||
dir_x = dir_y = 1;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -347,7 +349,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = -1;
|
||||
dir_y = 1;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
|
@ -355,7 +357,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = 1;
|
||||
dir_y = -1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -367,10 +369,12 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
|
||||
/* if just the mod1 key is down, affect only the height */
|
||||
if (transform_core->state & GDK_MOD1_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
|
||||
if (transform_core->state & GDK_MOD1_MASK &&
|
||||
! (transform_core->state & GDK_CONTROL_MASK))
|
||||
diff_x = 0;
|
||||
/* if just the control key is down, affect only the width */
|
||||
else if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_MOD1_MASK))
|
||||
else if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
! (transform_core->state & GDK_MOD1_MASK))
|
||||
diff_y = 0;
|
||||
|
||||
*x1 += diff_x;
|
||||
|
@ -394,8 +398,11 @@ scale_tool_motion (Tool *tool,
|
|||
if (*y1 <= *y2) *y1 = *y2 + 1;
|
||||
}
|
||||
|
||||
/* if both the control key & mod1 keys are down, keep the aspect ratio intact */
|
||||
if (transform_core->state & GDK_CONTROL_MASK && transform_core->state & GDK_MOD1_MASK)
|
||||
/* if both the control key & mod1 keys are down,
|
||||
* keep the aspect ratio intact
|
||||
*/
|
||||
if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
transform_core->state & GDK_MOD1_MASK)
|
||||
{
|
||||
ratio = (double) (transform_core->x2 - transform_core->x1) /
|
||||
(double) (transform_core->y2 - transform_core->y1);
|
||||
|
@ -413,19 +420,20 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
scale_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
int x1, y1, x2, y2;
|
||||
int diffx, diffy;
|
||||
int cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gint x1, y1, x2, y2;
|
||||
gint diffx, diffy;
|
||||
gint cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
x1 = (int) transform_core->trans_info [X0];
|
||||
y1 = (int) transform_core->trans_info [Y0];
|
||||
x2 = (int) transform_core->trans_info [X1];
|
||||
|
@ -439,22 +447,22 @@ scale_tool_recalc (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
cx = x2; cy = y2;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
cx = x1; cy = y2;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
cx = x2; cy = y1;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y1 - transform_core->y1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
cx = x1; cy = y1;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y1 - transform_core->y1;
|
||||
|
@ -472,31 +480,31 @@ scale_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
scale_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
scale_tool_scale (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double *trans_info,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Scaling..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __SCALE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * scale_tool_transform (Tool *, gpointer, int);
|
||||
void * scale_tool_scale (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double *, TileManager *, int, GimpMatrix);
|
||||
TileManager * scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * scale_tool_scale (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *);
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *tool);
|
||||
|
||||
#endif /* __SCALE_TOOL_H__ */
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include "appenv.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -24,40 +22,39 @@
|
|||
#include "info_dialog.h"
|
||||
#include "shear_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
/* index into trans_info array */
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
|
||||
/* the minimum movement before direction of shear can be determined (pixels) */
|
||||
#define MIN_MOVE 5
|
||||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
static void shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
|
||||
/* Info dialog callback funtions */
|
||||
static void shear_x_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_y_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_x_mag_changed (GtkWidget *widget, gpointer data);
|
||||
static void shear_y_mag_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -67,11 +64,12 @@ shear_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Shear Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_shear.html");
|
||||
|
||||
info_dialog_add_spinbutton (transform_info,
|
||||
_("Shear Magnitude X:"),
|
||||
|
@ -93,17 +91,16 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
shear_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return shear_tool_shear (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -117,14 +114,13 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_shear_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SHEAR, INTERACTIVE);
|
||||
tool = transform_core_new (SHEAR, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -137,7 +133,6 @@ tools_new_shear_tool (void)
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_shear_tool (Tool *tool)
|
||||
{
|
||||
|
@ -147,7 +142,7 @@ tools_free_shear_tool (Tool *tool)
|
|||
static void
|
||||
shear_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -159,22 +154,22 @@ shear_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
shear_x_mag_changed (GtkWidget *w,
|
||||
shear_x_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[XSHEAR])
|
||||
{
|
||||
|
@ -187,22 +182,22 @@ shear_x_mag_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
shear_y_mag_changed (GtkWidget *w,
|
||||
shear_y_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[YSHEAR])
|
||||
{
|
||||
|
@ -218,9 +213,9 @@ static void
|
|||
shear_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int diffx, diffy;
|
||||
int dir;
|
||||
TransformCore *transform_core;
|
||||
gint diffx, diffy;
|
||||
gint dir;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -233,9 +228,9 @@ shear_tool_motion (Tool *tool,
|
|||
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_UNKNOWN)
|
||||
{
|
||||
if (abs(diffx) > MIN_MOVE || abs(diffy) > MIN_MOVE)
|
||||
if (abs (diffx) > MIN_MOVE || abs (diffy) > MIN_MOVE)
|
||||
{
|
||||
if (abs(diffx) > abs(diffy))
|
||||
if (abs (diffx) > abs (diffy))
|
||||
{
|
||||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_HORIZONTAL;
|
||||
transform_core->trans_info[ORIENTATION_VERTICAL] = 0.0;
|
||||
|
@ -245,7 +240,6 @@ shear_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_VERTICAL;
|
||||
transform_core->trans_info[ORIENTATION_HORIZONTAL] = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
/* set the current coords to the last ones */
|
||||
else
|
||||
|
@ -261,45 +255,44 @@ shear_tool_motion (Tool *tool,
|
|||
dir = transform_core->trans_info[HORZ_OR_VERT];
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
static void
|
||||
shear_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
float width, height;
|
||||
float cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gfloat width, height;
|
||||
gfloat cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -322,39 +315,38 @@ shear_tool_recalc (Tool *tool,
|
|||
/* shear matrix */
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix_xshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
else
|
||||
gimp_matrix_yshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
shear_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Shearing..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@
|
|||
#define __SHEAR_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * shear_tool_transform (Tool *, gpointer, int);
|
||||
void * shear_tool_shear (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
TileManager *, int, GimpMatrix);
|
||||
TileManager * shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *);
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *matrix);
|
||||
|
||||
#endif /* __SHEAR_TOOL_H__ */
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "perspective_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -33,32 +31,33 @@
|
|||
|
||||
|
||||
/* storage for information dialog fields */
|
||||
static char matrix_row_buf [3][MAX_INFO_BUF];
|
||||
static gchar matrix_row_buf [3][MAX_INFO_BUF];
|
||||
|
||||
/* forward function declarations */
|
||||
static void * perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
static void perspective_tool_recalc (Tool *, void *);
|
||||
static void perspective_tool_motion (Tool *, void *);
|
||||
static void perspective_info_update (Tool *);
|
||||
|
||||
void *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info =
|
||||
info_dialog_new (_("Perspective Transform Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_perspective.html");
|
||||
info_dialog_add_label (transform_info, _("Matrix:"),
|
||||
matrix_row_buf[0]);
|
||||
info_dialog_add_label (transform_info, "", matrix_row_buf[1]);
|
||||
|
@ -78,17 +77,16 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
perspective_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (perspective_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
perspective_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
/* Let the transform core handle the inverse mapping */
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return
|
||||
|
@ -104,14 +102,13 @@ perspective_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_perspective_tool ()
|
||||
tools_new_perspective_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (PERSPECTIVE, INTERACTIVE);
|
||||
tool = transform_core_new (PERSPECTIVE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -132,26 +129,24 @@ tools_new_perspective_tool ()
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_perspective_tool (Tool *tool)
|
||||
{
|
||||
transform_core_free (tool);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int i;
|
||||
TransformCore *transform_core;
|
||||
gint i;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
char *p = matrix_row_buf[i];
|
||||
int j;
|
||||
gchar *p = matrix_row_buf[i];
|
||||
gint j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -162,18 +157,17 @@ perspective_info_update (Tool *tool)
|
|||
|
||||
info_dialog_update (transform_info);
|
||||
info_dialog_popup (transform_info);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
perspective_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -183,36 +177,36 @@ perspective_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
transform_core->trans_info [X0] += diff_x;
|
||||
transform_core->trans_info [Y0] += diff_y;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
transform_core->trans_info [X1] += diff_x;
|
||||
transform_core->trans_info [Y1] += diff_y;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
transform_core->trans_info [X2] += diff_x;
|
||||
transform_core->trans_info [Y2] += diff_y;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
transform_core->trans_info [X3] += diff_x;
|
||||
transform_core->trans_info [Y3] += diff_y;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
perspective_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
GimpMatrix m;
|
||||
double cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
GimpMatrix m;
|
||||
gdouble cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -226,6 +220,7 @@ perspective_tool_recalc (Tool *tool,
|
|||
cy = transform_core->y1;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
|
||||
if (transform_core->x2 - transform_core->x1)
|
||||
scalex = 1.0 / (transform_core->x2 - transform_core->x1);
|
||||
if (transform_core->y2 - transform_core->y1)
|
||||
|
@ -238,21 +233,18 @@ perspective_tool_recalc (Tool *tool,
|
|||
gimp_matrix_mult (m, transform_core->transform);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
perspective_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
perspective_find_transform (double *coords,
|
||||
GimpMatrix m)
|
||||
perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
double dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
double det1, det2;
|
||||
gdouble dx1, dx2, dx3, dy1, dy2, dy3;
|
||||
gdouble det1, det2;
|
||||
|
||||
dx1 = coords[X1] - coords[X3];
|
||||
dx2 = coords[X2] - coords[X3];
|
||||
|
@ -265,53 +257,54 @@ perspective_find_transform (double *coords,
|
|||
/* Is the mapping affine? */
|
||||
if ((dx3 == 0.0) && (dy3 == 0.0))
|
||||
{
|
||||
m[0][0] = coords[X1] - coords[X0];
|
||||
m[0][1] = coords[X3] - coords[X1];
|
||||
m[0][2] = coords[X0];
|
||||
m[1][0] = coords[Y1] - coords[Y0];
|
||||
m[1][1] = coords[Y3] - coords[Y1];
|
||||
m[1][2] = coords[Y0];
|
||||
m[2][0] = 0.0;
|
||||
m[2][1] = 0.0;
|
||||
matrix[0][0] = coords[X1] - coords[X0];
|
||||
matrix[0][1] = coords[X3] - coords[X1];
|
||||
matrix[0][2] = coords[X0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0];
|
||||
matrix[1][1] = coords[Y3] - coords[Y1];
|
||||
matrix[1][2] = coords[Y0];
|
||||
matrix[2][0] = 0.0;
|
||||
matrix[2][1] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
det1 = dx3 * dy2 - dy3 * dx2;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][0] = det1 / det2;
|
||||
matrix[2][0] = det1 / det2;
|
||||
det1 = dx1 * dy3 - dy1 * dx3;
|
||||
det2 = dx1 * dy2 - dy1 * dx2;
|
||||
m[2][1] = det1 / det2;
|
||||
matrix[2][1] = det1 / det2;
|
||||
|
||||
m[0][0] = coords[X1] - coords[X0] + m[2][0] * coords[X1];
|
||||
m[0][1] = coords[X2] - coords[X0] + m[2][1] * coords[X2];
|
||||
m[0][2] = coords[X0];
|
||||
matrix[0][0] = coords[X1] - coords[X0] + matrix[2][0] * coords[X1];
|
||||
matrix[0][1] = coords[X2] - coords[X0] + matrix[2][1] * coords[X2];
|
||||
matrix[0][2] = coords[X0];
|
||||
|
||||
m[1][0] = coords[Y1] - coords[Y0] + m[2][0] * coords[Y1];
|
||||
m[1][1] = coords[Y2] - coords[Y0] + m[2][1] * coords[Y2];
|
||||
m[1][2] = coords[Y0];
|
||||
matrix[1][0] = coords[Y1] - coords[Y0] + matrix[2][0] * coords[Y1];
|
||||
matrix[1][1] = coords[Y2] - coords[Y0] + matrix[2][1] * coords[Y2];
|
||||
matrix[1][2] = coords[Y0];
|
||||
}
|
||||
|
||||
m[2][2] = 1.0;
|
||||
matrix[2][2] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
perspective_tool_perspective (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Perspective..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,15 +19,21 @@
|
|||
#define __PERSPECTIVE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * perspective_tool_transform (Tool *, gpointer, int);
|
||||
void * perspective_tool_perspective (GimpImage *, GimpDrawable *,
|
||||
GDisplay *, TileManager *,
|
||||
int, GimpMatrix);
|
||||
void perspective_find_transform (double *, GimpMatrix);
|
||||
TileManager * perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * perspective_tool_perspective (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
void perspective_find_transform (gdouble *coords,
|
||||
GimpMatrix matrix);
|
||||
|
||||
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *);
|
||||
Tool * tools_new_perspective_tool (void);
|
||||
void tools_free_perspective_tool (Tool *tool);
|
||||
|
||||
#endif /* __PERSPECTIVE_TOOL_H__ */
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "rotate_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -52,7 +50,7 @@ static gdouble center_vals[2];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_recalc (Tool *, void *);
|
||||
static void rotate_tool_motion (Tool *, void *);
|
||||
static void rotate_info_update (Tool *);
|
||||
|
||||
|
@ -60,10 +58,10 @@ static void rotate_info_update (Tool *);
|
|||
static void rotate_angle_changed (GtkWidget *entry, gpointer data);
|
||||
static void rotate_center_changed (GtkWidget *entry, gpointer data);
|
||||
|
||||
void *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -75,7 +73,7 @@ rotate_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
angle_val = 0.0;
|
||||
center_vals[0] = transform_core->cx;
|
||||
center_vals[1] = transform_core->cy;
|
||||
|
@ -83,7 +81,8 @@ rotate_tool_transform (Tool *tool,
|
|||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Rotation Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_rotate.html");
|
||||
|
||||
widget =
|
||||
info_dialog_add_spinbutton (transform_info, _("Angle:"),
|
||||
|
@ -161,17 +160,16 @@ rotate_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
rotate_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return rotate_tool_recalc (tool, gdisp_ptr);
|
||||
case RECALC:
|
||||
rotate_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return rotate_tool_rotate (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -187,12 +185,12 @@ rotate_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_rotate_tool ()
|
||||
tools_new_rotate_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (ROTATE, INTERACTIVE);
|
||||
tool = transform_core_new (ROTATE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -218,7 +216,7 @@ tools_free_rotate_tool (Tool *tool)
|
|||
static void
|
||||
rotate_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -231,13 +229,13 @@ rotate_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_angle_changed (GtkWidget *w,
|
||||
rotate_angle_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
double value;
|
||||
gdouble value;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -246,7 +244,7 @@ rotate_angle_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value * G_PI / 180.0;
|
||||
value = GTK_ADJUSTMENT (widget)->value * G_PI / 180.0;
|
||||
|
||||
if (value != transform_core->trans_info[ANGLE])
|
||||
{
|
||||
|
@ -259,14 +257,14 @@ rotate_angle_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
rotate_center_changed (GtkWidget *w,
|
||||
rotate_center_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
int cx;
|
||||
int cy;
|
||||
gint cx;
|
||||
gint cy;
|
||||
|
||||
tool = (Tool *) data;
|
||||
|
||||
|
@ -275,8 +273,10 @@ rotate_center_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
cx = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
cy = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
cx =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
cy =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((cx != transform_core->cx) ||
|
||||
(cy != transform_core->cy))
|
||||
|
@ -294,10 +294,10 @@ static void
|
|||
rotate_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
double angle1, angle2, angle;
|
||||
double cx, cy;
|
||||
double x1, y1, x2, y2;
|
||||
TransformCore *transform_core;
|
||||
gdouble angle1, angle2, angle;
|
||||
gdouble cx, cy;
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -349,13 +349,13 @@ rotate_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[ANGLE] = transform_core->trans_info[REAL_ANGLE];
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
rotate_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
double cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gdouble cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -371,36 +371,31 @@ rotate_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
rotate_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
/* This procedure returns a valid pointer to a new selection if the
|
||||
* requested angle is a multiple of 90 degrees...
|
||||
*/
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
rotate_tool_rotate (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double angle,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Rotating..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __ROTATE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * rotate_tool_transform (Tool *, gpointer, int);
|
||||
void * rotate_tool_rotate (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double, TileManager *, int, GimpMatrix);
|
||||
TileManager * rotate_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * rotate_tool_rotate (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble angle,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *);
|
||||
Tool * tools_new_rotate_tool (void);
|
||||
void tools_free_rotate_tool (Tool *tool);
|
||||
|
||||
#endif /* __ROTATE_TOOL_H__ */
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "info_dialog.h"
|
||||
#include "scale_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -43,18 +41,18 @@ static gchar y_ratio_buf[MAX_INFO_BUF];
|
|||
static GtkWidget *sizeentry;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
static void scale_tool_recalc (Tool *, void *);
|
||||
static void scale_tool_motion (Tool *, void *);
|
||||
static void scale_info_update (Tool *);
|
||||
|
||||
/* callback functions for the info dialog fields */
|
||||
static void scale_size_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *w, gpointer data);
|
||||
static void scale_size_changed (GtkWidget *widget, gpointer data);
|
||||
static void scale_unit_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
|
@ -65,14 +63,15 @@ scale_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
size_vals[0] = transform_core->x2 - transform_core->x1;
|
||||
size_vals[1] = transform_core->y2 - transform_core->y1;
|
||||
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Scaling Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_scale.html");
|
||||
|
||||
info_dialog_add_label (transform_info, _("Original Width:"),
|
||||
orig_width_buf);
|
||||
|
@ -147,17 +146,16 @@ scale_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
scale_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (scale_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
scale_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return scale_tool_scale (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -173,12 +171,12 @@ scale_tool_transform (Tool *tool,
|
|||
}
|
||||
|
||||
Tool *
|
||||
tools_new_scale_tool ()
|
||||
tools_new_scale_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SCALE, INTERACTIVE);
|
||||
tool = transform_core_new (SCALE, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -204,15 +202,15 @@ tools_free_scale_tool (Tool *tool)
|
|||
static void
|
||||
scale_info_update (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio_x, ratio_y;
|
||||
int x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
double unit_factor;
|
||||
gchar format_buf[16];
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -269,14 +267,14 @@ scale_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
scale_size_changed (GtkWidget *w,
|
||||
scale_size_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int width;
|
||||
int height;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
tool = (Tool *)data;
|
||||
|
||||
|
@ -285,8 +283,10 @@ scale_size_changed (GtkWidget *w,
|
|||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
width = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 0) + 0.5);
|
||||
height = (int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (w), 1) + 0.5);
|
||||
width =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0) + 0.5);
|
||||
height =
|
||||
(int) (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1) + 0.5);
|
||||
|
||||
if ((width != (transform_core->trans_info[X1] -
|
||||
transform_core->trans_info[X0])) ||
|
||||
|
@ -305,24 +305,26 @@ scale_size_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
scale_unit_changed (GtkWidget *w,
|
||||
scale_unit_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
scale_info_update ((Tool*) data);
|
||||
scale_info_update ((Tool *) data);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
TransformCore * transform_core;
|
||||
double ratio;
|
||||
double *x1, *y1;
|
||||
double *x2, *y2;
|
||||
int w, h;
|
||||
int dir_x, dir_y;
|
||||
int diff_x, diff_y;
|
||||
GDisplay *gdisp;
|
||||
TransformCore *transform_core;
|
||||
gdouble ratio;
|
||||
gdouble *x1;
|
||||
gdouble *y1;
|
||||
gdouble *x2;
|
||||
gdouble *y2;
|
||||
gint w, h;
|
||||
gint dir_x, dir_y;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -332,14 +334,14 @@ scale_tool_motion (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
y2 = &transform_core->trans_info [Y1];
|
||||
dir_x = dir_y = 1;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y0];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -347,7 +349,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = -1;
|
||||
dir_y = 1;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
x1 = &transform_core->trans_info [X0];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X1];
|
||||
|
@ -355,7 +357,7 @@ scale_tool_motion (Tool *tool,
|
|||
dir_x = 1;
|
||||
dir_y = -1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
x1 = &transform_core->trans_info [X1];
|
||||
y1 = &transform_core->trans_info [Y1];
|
||||
x2 = &transform_core->trans_info [X0];
|
||||
|
@ -367,10 +369,12 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
|
||||
/* if just the mod1 key is down, affect only the height */
|
||||
if (transform_core->state & GDK_MOD1_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
|
||||
if (transform_core->state & GDK_MOD1_MASK &&
|
||||
! (transform_core->state & GDK_CONTROL_MASK))
|
||||
diff_x = 0;
|
||||
/* if just the control key is down, affect only the width */
|
||||
else if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_MOD1_MASK))
|
||||
else if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
! (transform_core->state & GDK_MOD1_MASK))
|
||||
diff_y = 0;
|
||||
|
||||
*x1 += diff_x;
|
||||
|
@ -394,8 +398,11 @@ scale_tool_motion (Tool *tool,
|
|||
if (*y1 <= *y2) *y1 = *y2 + 1;
|
||||
}
|
||||
|
||||
/* if both the control key & mod1 keys are down, keep the aspect ratio intact */
|
||||
if (transform_core->state & GDK_CONTROL_MASK && transform_core->state & GDK_MOD1_MASK)
|
||||
/* if both the control key & mod1 keys are down,
|
||||
* keep the aspect ratio intact
|
||||
*/
|
||||
if (transform_core->state & GDK_CONTROL_MASK &&
|
||||
transform_core->state & GDK_MOD1_MASK)
|
||||
{
|
||||
ratio = (double) (transform_core->x2 - transform_core->x1) /
|
||||
(double) (transform_core->y2 - transform_core->y1);
|
||||
|
@ -413,19 +420,20 @@ scale_tool_motion (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
static void
|
||||
scale_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
int x1, y1, x2, y2;
|
||||
int diffx, diffy;
|
||||
int cx, cy;
|
||||
double scalex, scaley;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gint x1, y1, x2, y2;
|
||||
gint diffx, diffy;
|
||||
gint cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
x1 = (int) transform_core->trans_info [X0];
|
||||
y1 = (int) transform_core->trans_info [Y0];
|
||||
x2 = (int) transform_core->trans_info [X1];
|
||||
|
@ -439,22 +447,22 @@ scale_tool_recalc (Tool *tool,
|
|||
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
cx = x2; cy = y2;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
cx = x1; cy = y2;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y2 - transform_core->y2;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
cx = x2; cy = y1;
|
||||
diffx = x2 - transform_core->x2;
|
||||
diffy = y1 - transform_core->y1;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
cx = x1; cy = y1;
|
||||
diffx = x1 - transform_core->x1;
|
||||
diffy = y1 - transform_core->y1;
|
||||
|
@ -472,31 +480,31 @@ scale_tool_recalc (Tool *tool,
|
|||
gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
scale_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
scale_tool_scale (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
double *trans_info,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Scaling..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,20 @@
|
|||
#define __SCALE_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * scale_tool_transform (Tool *, gpointer, int);
|
||||
void * scale_tool_scale (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
double *, TileManager *, int, GimpMatrix);
|
||||
TileManager * scale_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * scale_tool_scale (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
gdouble *trans_info,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *);
|
||||
Tool * tools_new_scale_tool (void);
|
||||
void tools_free_scale_tool (Tool *tool);
|
||||
|
||||
#endif /* __SCALE_TOOL_H__ */
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include "appenv.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -24,40 +22,39 @@
|
|||
#include "info_dialog.h"
|
||||
#include "shear_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
/* index into trans_info array */
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
#define HORZ_OR_VERT 0
|
||||
#define XSHEAR 1
|
||||
#define YSHEAR 2
|
||||
|
||||
/* the minimum movement before direction of shear can be determined (pixels) */
|
||||
#define MIN_MOVE 5
|
||||
#define MIN_MOVE 5
|
||||
|
||||
/* variables local to this file */
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
static gdouble xshear_val;
|
||||
static gdouble yshear_val;
|
||||
|
||||
/* forward function declarations */
|
||||
static void * shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
static void shear_tool_recalc (Tool *, void *);
|
||||
static void shear_tool_motion (Tool *, void *);
|
||||
static void shear_info_update (Tool *);
|
||||
|
||||
/* Info dialog callback funtions */
|
||||
static void shear_x_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_y_mag_changed (GtkWidget *, gpointer);
|
||||
static void shear_x_mag_changed (GtkWidget *widget, gpointer data);
|
||||
static void shear_y_mag_changed (GtkWidget *widget, gpointer data);
|
||||
|
||||
void *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
int state)
|
||||
TileManager *
|
||||
shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state)
|
||||
{
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
|
@ -67,11 +64,12 @@ shear_tool_transform (Tool *tool,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case INIT :
|
||||
case INIT:
|
||||
if (!transform_info)
|
||||
{
|
||||
transform_info = info_dialog_new (_("Shear Information"),
|
||||
tools_help_func, NULL);
|
||||
gimp_standard_help_func,
|
||||
"tools/transform_shear.html");
|
||||
|
||||
info_dialog_add_spinbutton (transform_info,
|
||||
_("Shear Magnitude X:"),
|
||||
|
@ -93,17 +91,16 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
break;
|
||||
|
||||
case MOTION :
|
||||
case MOTION:
|
||||
shear_tool_motion (tool, gdisp_ptr);
|
||||
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case RECALC :
|
||||
return (shear_tool_recalc (tool, gdisp_ptr));
|
||||
case RECALC:
|
||||
shear_tool_recalc (tool, gdisp_ptr);
|
||||
break;
|
||||
|
||||
case FINISH :
|
||||
case FINISH:
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
||||
return shear_tool_shear (gdisp->gimage,
|
||||
gimage_active_drawable (gdisp->gimage),
|
||||
|
@ -117,14 +114,13 @@ shear_tool_transform (Tool *tool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Tool *
|
||||
tools_new_shear_tool (void)
|
||||
{
|
||||
Tool * tool;
|
||||
TransformCore * private;
|
||||
Tool *tool;
|
||||
TransformCore *private;
|
||||
|
||||
tool = transform_core_new (SHEAR, INTERACTIVE);
|
||||
tool = transform_core_new (SHEAR, TRUE);
|
||||
|
||||
private = tool->private;
|
||||
|
||||
|
@ -137,7 +133,6 @@ tools_new_shear_tool (void)
|
|||
return tool;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tools_free_shear_tool (Tool *tool)
|
||||
{
|
||||
|
@ -147,7 +142,7 @@ tools_free_shear_tool (Tool *tool)
|
|||
static void
|
||||
shear_info_update (Tool *tool)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
TransformCore *transform_core;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -159,22 +154,22 @@ shear_info_update (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
shear_x_mag_changed (GtkWidget *w,
|
||||
shear_x_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[XSHEAR])
|
||||
{
|
||||
|
@ -187,22 +182,22 @@ shear_x_mag_changed (GtkWidget *w,
|
|||
}
|
||||
|
||||
static void
|
||||
shear_y_mag_changed (GtkWidget *w,
|
||||
shear_y_mag_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Tool *tool;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
tool = (Tool *)data;
|
||||
tool = (Tool *) data;
|
||||
|
||||
if (tool)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
value = GTK_ADJUSTMENT (w)->value;
|
||||
value = GTK_ADJUSTMENT (widget)->value;
|
||||
|
||||
if (value != transform_core->trans_info[YSHEAR])
|
||||
{
|
||||
|
@ -218,9 +213,9 @@ static void
|
|||
shear_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
int diffx, diffy;
|
||||
int dir;
|
||||
TransformCore *transform_core;
|
||||
gint diffx, diffy;
|
||||
gint dir;
|
||||
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
||||
|
@ -233,9 +228,9 @@ shear_tool_motion (Tool *tool,
|
|||
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_UNKNOWN)
|
||||
{
|
||||
if (abs(diffx) > MIN_MOVE || abs(diffy) > MIN_MOVE)
|
||||
if (abs (diffx) > MIN_MOVE || abs (diffy) > MIN_MOVE)
|
||||
{
|
||||
if (abs(diffx) > abs(diffy))
|
||||
if (abs (diffx) > abs (diffy))
|
||||
{
|
||||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_HORIZONTAL;
|
||||
transform_core->trans_info[ORIENTATION_VERTICAL] = 0.0;
|
||||
|
@ -245,7 +240,6 @@ shear_tool_motion (Tool *tool,
|
|||
transform_core->trans_info[HORZ_OR_VERT] = ORIENTATION_VERTICAL;
|
||||
transform_core->trans_info[ORIENTATION_HORIZONTAL] = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
/* set the current coords to the last ones */
|
||||
else
|
||||
|
@ -261,45 +255,44 @@ shear_tool_motion (Tool *tool,
|
|||
dir = transform_core->trans_info[HORZ_OR_VERT];
|
||||
switch (transform_core->function)
|
||||
{
|
||||
case HANDLE_1 :
|
||||
case HANDLE_1:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_2 :
|
||||
case HANDLE_2:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] -= diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
case HANDLE_3 :
|
||||
case HANDLE_3:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] -= diffy;
|
||||
break;
|
||||
case HANDLE_4 :
|
||||
case HANDLE_4:
|
||||
if (dir == ORIENTATION_HORIZONTAL)
|
||||
transform_core->trans_info[XSHEAR] += diffx;
|
||||
else
|
||||
transform_core->trans_info[YSHEAR] += diffy;
|
||||
break;
|
||||
default :
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
static void
|
||||
shear_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
{
|
||||
TransformCore * transform_core;
|
||||
GDisplay * gdisp;
|
||||
float width, height;
|
||||
float cx, cy;
|
||||
TransformCore *transform_core;
|
||||
GDisplay *gdisp;
|
||||
gfloat width, height;
|
||||
gfloat cx, cy;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -322,39 +315,38 @@ shear_tool_recalc (Tool *tool,
|
|||
/* shear matrix */
|
||||
if (transform_core->trans_info[HORZ_OR_VERT] == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix_xshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
(float) transform_core->trans_info [XSHEAR] / height);
|
||||
else
|
||||
gimp_matrix_yshear (transform_core->transform,
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
(float) transform_core->trans_info [YSHEAR] / width);
|
||||
|
||||
gimp_matrix_translate (transform_core->transform, +cx, +cy);
|
||||
|
||||
/* transform the bounding box */
|
||||
transform_bounding_box (tool);
|
||||
transform_core_transform_bounding_box (tool);
|
||||
|
||||
/* update the information dialog */
|
||||
shear_info_update (tool);
|
||||
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
TileManager *
|
||||
shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
int interpolation,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix)
|
||||
{
|
||||
void *ret;
|
||||
gimp_progress *progress;
|
||||
TileManager *ret;
|
||||
|
||||
progress = progress_start (gdisp, _("Shearing..."), FALSE, NULL, NULL);
|
||||
|
||||
ret = transform_core_do (gimage, drawable, float_tiles,
|
||||
interpolation, matrix,
|
||||
progress? progress_update_and_flush:NULL, progress);
|
||||
progress ? progress_update_and_flush : NULL,
|
||||
progress);
|
||||
|
||||
if (progress)
|
||||
progress_end (progress);
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@
|
|||
#define __SHEAR_TOOL_H__
|
||||
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
|
||||
void * shear_tool_transform (Tool *, gpointer, int);
|
||||
void * shear_tool_shear (GimpImage *, GimpDrawable *, GDisplay *,
|
||||
TileManager *, int, GimpMatrix);
|
||||
TileManager * shear_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * shear_tool_shear (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix);
|
||||
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *);
|
||||
Tool * tools_new_shear_tool (void);
|
||||
void tools_free_shear_tool (Tool *matrix);
|
||||
|
||||
#endif /* __SHEAR_TOOL_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,107 +18,115 @@
|
|||
#ifndef __TRANSFORM_CORE_H__
|
||||
#define __TRANSFORM_CORE_H__
|
||||
|
||||
#include "info_dialog.h"
|
||||
#include "draw_core.h"
|
||||
#include "temp_buf.h"
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
#include "gimpprogress.h"
|
||||
#include "info_dialog.h"
|
||||
#include "temp_buf.h"
|
||||
|
||||
/* possible scaling functions */
|
||||
#define CREATING 0
|
||||
#define HANDLE_1 1
|
||||
#define HANDLE_2 2
|
||||
#define HANDLE_3 3
|
||||
#define HANDLE_4 4
|
||||
#define HANDLE_CENTER 5
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
|
||||
/* the different states that the transformation function can be called with */
|
||||
#define INIT 0
|
||||
#define MOTION 1
|
||||
#define RECALC 2
|
||||
#define FINISH 3
|
||||
/* possible transform functions */
|
||||
typedef enum
|
||||
{
|
||||
CREATING,
|
||||
HANDLE_1,
|
||||
HANDLE_2,
|
||||
HANDLE_3,
|
||||
HANDLE_4,
|
||||
HANDLE_CENTER
|
||||
} TransformAction;
|
||||
|
||||
/* the different states that the transformation function can be called with */
|
||||
typedef enum
|
||||
{
|
||||
INIT,
|
||||
MOTION,
|
||||
RECALC,
|
||||
FINISH
|
||||
} TransformState;
|
||||
|
||||
/* buffer sizes for scaling information strings (for the info dialog) */
|
||||
#define MAX_INFO_BUF 40
|
||||
#define TRAN_INFO_SIZE 8
|
||||
|
||||
/* control whether the transform tool draws a bounding box */
|
||||
#define NON_INTERACTIVE 0
|
||||
#define INTERACTIVE 1
|
||||
|
||||
enum BoundingBox
|
||||
{
|
||||
X0, Y0, X1, Y1, X2, Y2, X3, Y3
|
||||
};
|
||||
|
||||
typedef double TranInfo[TRAN_INFO_SIZE];
|
||||
typedef gdouble TranInfo[TRAN_INFO_SIZE];
|
||||
|
||||
typedef TileManager * (* TransformFunc) (Tool *, void *, TransformState);
|
||||
|
||||
typedef void * (* TransformFunc) (Tool *, void *, int);
|
||||
|
||||
typedef struct _TransformCore TransformCore;
|
||||
|
||||
struct _TransformCore
|
||||
{
|
||||
DrawCore * core; /* Core select object */
|
||||
DrawCore *core; /* Core select object */
|
||||
|
||||
int startx; /* starting x coord */
|
||||
int starty; /* starting y coord */
|
||||
gint startx; /* starting x coord */
|
||||
gint starty; /* starting y coord */
|
||||
|
||||
int curx; /* current x coord */
|
||||
int cury; /* current y coord */
|
||||
gint curx; /* current x coord */
|
||||
gint cury; /* current y coord */
|
||||
|
||||
int lastx; /* last x coord */
|
||||
int lasty; /* last y coord */
|
||||
gint lastx; /* last x coord */
|
||||
gint lasty; /* last y coord */
|
||||
|
||||
int state; /* state of buttons and keys */
|
||||
gint state; /* state of buttons and keys */
|
||||
|
||||
int x1, y1; /* upper left hand coordinate */
|
||||
int x2, y2; /* lower right hand coords */
|
||||
int cx, cy; /* center point (for rotation) */
|
||||
gint x1, y1; /* upper left hand coordinate */
|
||||
gint x2, y2; /* lower right hand coords */
|
||||
gint cx, cy; /* center point (for rotation) */
|
||||
|
||||
double tx1, ty1; /* transformed coords */
|
||||
double tx2, ty2; /* */
|
||||
double tx3, ty3; /* */
|
||||
double tx4, ty4; /* */
|
||||
double tcx, tcy; /* */
|
||||
gdouble tx1, ty1; /* transformed coords */
|
||||
gdouble tx2, ty2; /* */
|
||||
gdouble tx3, ty3; /* */
|
||||
gdouble tx4, ty4; /* */
|
||||
gdouble tcx, tcy; /* */
|
||||
|
||||
int sx1, sy1; /* transformed screen coords */
|
||||
int sx2, sy2; /* position of four handles */
|
||||
int sx3, sy3; /* */
|
||||
int sx4, sy4; /* */
|
||||
int scx, scy; /* and center for rotation */
|
||||
gint sx1, sy1; /* transformed screen coords */
|
||||
gint sx2, sy2; /* position of four handles */
|
||||
gint sx3, sy3; /* */
|
||||
gint sx4, sy4; /* */
|
||||
gint scx, scy; /* and center for rotation */
|
||||
|
||||
GimpMatrix transform; /* transformation matrix */
|
||||
TranInfo trans_info; /* transformation info */
|
||||
|
||||
TileManager * original; /* pointer to original tiles */
|
||||
TileManager *original; /* pointer to original tiles */
|
||||
|
||||
TransformFunc trans_func; /* transformation function */
|
||||
|
||||
int function; /* current tool activity */
|
||||
TransformAction function; /* current tool activity */
|
||||
|
||||
int interactive; /* tool is interactive */
|
||||
int bpressed; /* Bug work around make sure we have
|
||||
* a button pressed before we deal with
|
||||
* motion events. ALT.
|
||||
gboolean interactive; /* tool is interactive */
|
||||
gboolean bpressed; /* Bug work around make sure we have
|
||||
* a button pressed before we deal with
|
||||
* motion events. ALT.
|
||||
*/
|
||||
int ngx, ngy; /* number of grid lines in original
|
||||
x and y directions */
|
||||
double *grid_coords; /* x and y coordinates of the grid
|
||||
endpoints (a total of (ngx+ngy)*2
|
||||
coordinate pairs) */
|
||||
double *tgrid_coords; /* transformed grid_coords */
|
||||
gint ngx, ngy; /* number of grid lines in original
|
||||
* x and y directions
|
||||
*/
|
||||
gdouble *grid_coords; /* x and y coordinates of the grid
|
||||
* endpoints (a total of (ngx+ngy)*2
|
||||
* coordinate pairs)
|
||||
*/
|
||||
gdouble *tgrid_coords; /* transformed grid_coords */
|
||||
};
|
||||
|
||||
|
||||
/* Special undo type */
|
||||
typedef struct _TransformUndo TransformUndo;
|
||||
|
||||
struct _TransformUndo
|
||||
{
|
||||
int tool_ID;
|
||||
int tool_type;
|
||||
TranInfo trans_info;
|
||||
TileManager * original;
|
||||
void * path_undo;
|
||||
gint tool_ID;
|
||||
gint tool_type;
|
||||
TranInfo trans_info;
|
||||
TileManager *original;
|
||||
void *path_undo;
|
||||
};
|
||||
|
||||
|
||||
|
@ -133,21 +141,31 @@ void transform_core_cursor_update (Tool *, GdkEventMotion *, gpointer)
|
|||
void transform_core_control (Tool *, ToolAction, gpointer);
|
||||
|
||||
/* transform tool functions */
|
||||
void transform_core_draw (Tool *);
|
||||
void transform_core_no_draw (Tool *);
|
||||
Tool * transform_core_new (ToolType, int);
|
||||
void transform_core_free (Tool *);
|
||||
void transform_core_reset (Tool *, void *);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint);
|
||||
Tool * transform_core_new (ToolType tool_type,
|
||||
gboolean interactive);
|
||||
void transform_core_free (Tool *tool);
|
||||
void transform_core_draw (Tool *tool);
|
||||
void transform_core_no_draw (Tool *tool);
|
||||
void transform_core_transform_bounding_box (Tool *tool);
|
||||
void transform_core_reset (Tool *tool,
|
||||
void *gdisp_ptr);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint type);
|
||||
|
||||
/* transform functions */
|
||||
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *,
|
||||
int, GimpMatrix, progress_func_t,
|
||||
gpointer);
|
||||
TileManager * transform_core_cut (GImage *, GimpDrawable *, int *);
|
||||
Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *,
|
||||
int);
|
||||
void transform_bounding_box (Tool*);
|
||||
TileManager * transform_core_do (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix,
|
||||
progress_func_t progress_callback,
|
||||
gpointer progress_data);
|
||||
TileManager * transform_core_cut (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gboolean *new_layer);
|
||||
Layer * transform_core_paste (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *tiles,
|
||||
gboolean new_layer);
|
||||
|
||||
#endif /* __TRANSFORM_CORE_H__ */
|
||||
|
|
|
@ -74,7 +74,7 @@ static TransformOptions *transform_options = NULL;
|
|||
|
||||
|
||||
/* local functions */
|
||||
static void transform_change_type (int);
|
||||
static void transform_change_type (ToolType new_type);
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -381,18 +381,23 @@ tools_free_transform_tool (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
transform_change_type (gint new_type)
|
||||
transform_change_type (ToolType new_type)
|
||||
{
|
||||
if (transform_options->type != new_type)
|
||||
{
|
||||
/* change the type, free the old tool, create the new tool */
|
||||
transform_options->type = new_type;
|
||||
|
||||
gimp_context_set_tool (gimp_context_get_user (), transform_options->type);
|
||||
if (gimp_context_get_tool (gimp_context_get_user ()) != new_type)
|
||||
gimp_context_set_tool (gimp_context_get_user (), new_type);
|
||||
else
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (gimp_context_get_user ()),
|
||||
"tool_changed",
|
||||
new_type);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_smoothing (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -401,7 +406,7 @@ transform_tool_smoothing (void)
|
|||
return transform_options->smoothing;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_showpath (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -410,7 +415,7 @@ transform_tool_showpath (void)
|
|||
return transform_options->showpath;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_clip (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -419,7 +424,7 @@ transform_tool_clip (void)
|
|||
return transform_options->clip;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
transform_tool_direction (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -428,7 +433,7 @@ transform_tool_direction (void)
|
|||
return transform_options->direction;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
transform_tool_grid_size (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -437,7 +442,7 @@ transform_tool_grid_size (void)
|
|||
return transform_options->grid_size;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_show_grid (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
|
|
@ -18,18 +18,19 @@
|
|||
#ifndef __TRANSFORM_TOOL_H__
|
||||
#define __TRANSFORM_TOOL_H__
|
||||
|
||||
/* tool functions */
|
||||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *);
|
||||
int transform_tool_smoothing (void);
|
||||
int transform_tool_showpath (void);
|
||||
int transform_tool_clip (void);
|
||||
int transform_tool_direction (void);
|
||||
int transform_tool_grid_size (void);
|
||||
int transform_tool_show_grid (void);
|
||||
|
||||
/* transform directions */
|
||||
#define TRANSFORM_TRADITIONAL 0
|
||||
#define TRANSFORM_CORRECTIVE 1
|
||||
#define TRANSFORM_CORRECTIVE 1
|
||||
|
||||
/* tool functions */
|
||||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *tool);
|
||||
|
||||
gboolean transform_tool_smoothing (void);
|
||||
gboolean transform_tool_showpath (void);
|
||||
gboolean transform_tool_clip (void);
|
||||
gint transform_tool_direction (void);
|
||||
gint transform_tool_grid_size (void);
|
||||
gboolean transform_tool_show_grid (void);
|
||||
|
||||
#endif /* __TRANSFORM_TOOL_H__ */
|
||||
|
|
|
@ -1566,7 +1566,7 @@ flip_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
Layer *layer;
|
||||
int new_layer;
|
||||
gboolean new_layer;
|
||||
|
||||
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
|
||||
if (drawable == NULL)
|
||||
|
@ -2108,7 +2108,7 @@ perspective_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
Layer *layer;
|
||||
int new_layer;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
double scalex, scaley;
|
||||
double trans_info[8];
|
||||
|
@ -2389,7 +2389,7 @@ rotate_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
Layer *layer;
|
||||
int new_layer;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
GimpMatrix matrix;
|
||||
|
||||
|
@ -2501,7 +2501,7 @@ scale_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
Layer *layer;
|
||||
int new_layer;
|
||||
gboolean new_layer;
|
||||
double scalex, scaley;
|
||||
double trans_info[4];
|
||||
GimpMatrix matrix;
|
||||
|
@ -2648,7 +2648,7 @@ shear_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
Layer *layer;
|
||||
int new_layer;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
GimpMatrix matrix;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,107 +18,115 @@
|
|||
#ifndef __TRANSFORM_CORE_H__
|
||||
#define __TRANSFORM_CORE_H__
|
||||
|
||||
#include "info_dialog.h"
|
||||
#include "draw_core.h"
|
||||
#include "temp_buf.h"
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
#include "gimpprogress.h"
|
||||
#include "info_dialog.h"
|
||||
#include "temp_buf.h"
|
||||
|
||||
/* possible scaling functions */
|
||||
#define CREATING 0
|
||||
#define HANDLE_1 1
|
||||
#define HANDLE_2 2
|
||||
#define HANDLE_3 3
|
||||
#define HANDLE_4 4
|
||||
#define HANDLE_CENTER 5
|
||||
#include "libgimp/gimpmatrix.h"
|
||||
|
||||
/* the different states that the transformation function can be called with */
|
||||
#define INIT 0
|
||||
#define MOTION 1
|
||||
#define RECALC 2
|
||||
#define FINISH 3
|
||||
/* possible transform functions */
|
||||
typedef enum
|
||||
{
|
||||
CREATING,
|
||||
HANDLE_1,
|
||||
HANDLE_2,
|
||||
HANDLE_3,
|
||||
HANDLE_4,
|
||||
HANDLE_CENTER
|
||||
} TransformAction;
|
||||
|
||||
/* the different states that the transformation function can be called with */
|
||||
typedef enum
|
||||
{
|
||||
INIT,
|
||||
MOTION,
|
||||
RECALC,
|
||||
FINISH
|
||||
} TransformState;
|
||||
|
||||
/* buffer sizes for scaling information strings (for the info dialog) */
|
||||
#define MAX_INFO_BUF 40
|
||||
#define TRAN_INFO_SIZE 8
|
||||
|
||||
/* control whether the transform tool draws a bounding box */
|
||||
#define NON_INTERACTIVE 0
|
||||
#define INTERACTIVE 1
|
||||
|
||||
enum BoundingBox
|
||||
{
|
||||
X0, Y0, X1, Y1, X2, Y2, X3, Y3
|
||||
};
|
||||
|
||||
typedef double TranInfo[TRAN_INFO_SIZE];
|
||||
typedef gdouble TranInfo[TRAN_INFO_SIZE];
|
||||
|
||||
typedef TileManager * (* TransformFunc) (Tool *, void *, TransformState);
|
||||
|
||||
typedef void * (* TransformFunc) (Tool *, void *, int);
|
||||
|
||||
typedef struct _TransformCore TransformCore;
|
||||
|
||||
struct _TransformCore
|
||||
{
|
||||
DrawCore * core; /* Core select object */
|
||||
DrawCore *core; /* Core select object */
|
||||
|
||||
int startx; /* starting x coord */
|
||||
int starty; /* starting y coord */
|
||||
gint startx; /* starting x coord */
|
||||
gint starty; /* starting y coord */
|
||||
|
||||
int curx; /* current x coord */
|
||||
int cury; /* current y coord */
|
||||
gint curx; /* current x coord */
|
||||
gint cury; /* current y coord */
|
||||
|
||||
int lastx; /* last x coord */
|
||||
int lasty; /* last y coord */
|
||||
gint lastx; /* last x coord */
|
||||
gint lasty; /* last y coord */
|
||||
|
||||
int state; /* state of buttons and keys */
|
||||
gint state; /* state of buttons and keys */
|
||||
|
||||
int x1, y1; /* upper left hand coordinate */
|
||||
int x2, y2; /* lower right hand coords */
|
||||
int cx, cy; /* center point (for rotation) */
|
||||
gint x1, y1; /* upper left hand coordinate */
|
||||
gint x2, y2; /* lower right hand coords */
|
||||
gint cx, cy; /* center point (for rotation) */
|
||||
|
||||
double tx1, ty1; /* transformed coords */
|
||||
double tx2, ty2; /* */
|
||||
double tx3, ty3; /* */
|
||||
double tx4, ty4; /* */
|
||||
double tcx, tcy; /* */
|
||||
gdouble tx1, ty1; /* transformed coords */
|
||||
gdouble tx2, ty2; /* */
|
||||
gdouble tx3, ty3; /* */
|
||||
gdouble tx4, ty4; /* */
|
||||
gdouble tcx, tcy; /* */
|
||||
|
||||
int sx1, sy1; /* transformed screen coords */
|
||||
int sx2, sy2; /* position of four handles */
|
||||
int sx3, sy3; /* */
|
||||
int sx4, sy4; /* */
|
||||
int scx, scy; /* and center for rotation */
|
||||
gint sx1, sy1; /* transformed screen coords */
|
||||
gint sx2, sy2; /* position of four handles */
|
||||
gint sx3, sy3; /* */
|
||||
gint sx4, sy4; /* */
|
||||
gint scx, scy; /* and center for rotation */
|
||||
|
||||
GimpMatrix transform; /* transformation matrix */
|
||||
TranInfo trans_info; /* transformation info */
|
||||
|
||||
TileManager * original; /* pointer to original tiles */
|
||||
TileManager *original; /* pointer to original tiles */
|
||||
|
||||
TransformFunc trans_func; /* transformation function */
|
||||
|
||||
int function; /* current tool activity */
|
||||
TransformAction function; /* current tool activity */
|
||||
|
||||
int interactive; /* tool is interactive */
|
||||
int bpressed; /* Bug work around make sure we have
|
||||
* a button pressed before we deal with
|
||||
* motion events. ALT.
|
||||
gboolean interactive; /* tool is interactive */
|
||||
gboolean bpressed; /* Bug work around make sure we have
|
||||
* a button pressed before we deal with
|
||||
* motion events. ALT.
|
||||
*/
|
||||
int ngx, ngy; /* number of grid lines in original
|
||||
x and y directions */
|
||||
double *grid_coords; /* x and y coordinates of the grid
|
||||
endpoints (a total of (ngx+ngy)*2
|
||||
coordinate pairs) */
|
||||
double *tgrid_coords; /* transformed grid_coords */
|
||||
gint ngx, ngy; /* number of grid lines in original
|
||||
* x and y directions
|
||||
*/
|
||||
gdouble *grid_coords; /* x and y coordinates of the grid
|
||||
* endpoints (a total of (ngx+ngy)*2
|
||||
* coordinate pairs)
|
||||
*/
|
||||
gdouble *tgrid_coords; /* transformed grid_coords */
|
||||
};
|
||||
|
||||
|
||||
/* Special undo type */
|
||||
typedef struct _TransformUndo TransformUndo;
|
||||
|
||||
struct _TransformUndo
|
||||
{
|
||||
int tool_ID;
|
||||
int tool_type;
|
||||
TranInfo trans_info;
|
||||
TileManager * original;
|
||||
void * path_undo;
|
||||
gint tool_ID;
|
||||
gint tool_type;
|
||||
TranInfo trans_info;
|
||||
TileManager *original;
|
||||
void *path_undo;
|
||||
};
|
||||
|
||||
|
||||
|
@ -133,21 +141,31 @@ void transform_core_cursor_update (Tool *, GdkEventMotion *, gpointer)
|
|||
void transform_core_control (Tool *, ToolAction, gpointer);
|
||||
|
||||
/* transform tool functions */
|
||||
void transform_core_draw (Tool *);
|
||||
void transform_core_no_draw (Tool *);
|
||||
Tool * transform_core_new (ToolType, int);
|
||||
void transform_core_free (Tool *);
|
||||
void transform_core_reset (Tool *, void *);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint);
|
||||
Tool * transform_core_new (ToolType tool_type,
|
||||
gboolean interactive);
|
||||
void transform_core_free (Tool *tool);
|
||||
void transform_core_draw (Tool *tool);
|
||||
void transform_core_no_draw (Tool *tool);
|
||||
void transform_core_transform_bounding_box (Tool *tool);
|
||||
void transform_core_reset (Tool *tool,
|
||||
void *gdisp_ptr);
|
||||
void transform_core_grid_density_changed (void);
|
||||
void transform_core_showpath_changed (gint type);
|
||||
|
||||
/* transform functions */
|
||||
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *,
|
||||
int, GimpMatrix, progress_func_t,
|
||||
gpointer);
|
||||
TileManager * transform_core_cut (GImage *, GimpDrawable *, int *);
|
||||
Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *,
|
||||
int);
|
||||
void transform_bounding_box (Tool*);
|
||||
TileManager * transform_core_do (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *float_tiles,
|
||||
gboolean interpolation,
|
||||
GimpMatrix matrix,
|
||||
progress_func_t progress_callback,
|
||||
gpointer progress_data);
|
||||
TileManager * transform_core_cut (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gboolean *new_layer);
|
||||
Layer * transform_core_paste (GImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
TileManager *tiles,
|
||||
gboolean new_layer);
|
||||
|
||||
#endif /* __TRANSFORM_CORE_H__ */
|
||||
|
|
|
@ -74,7 +74,7 @@ static TransformOptions *transform_options = NULL;
|
|||
|
||||
|
||||
/* local functions */
|
||||
static void transform_change_type (int);
|
||||
static void transform_change_type (ToolType new_type);
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -381,18 +381,23 @@ tools_free_transform_tool (Tool *tool)
|
|||
}
|
||||
|
||||
static void
|
||||
transform_change_type (gint new_type)
|
||||
transform_change_type (ToolType new_type)
|
||||
{
|
||||
if (transform_options->type != new_type)
|
||||
{
|
||||
/* change the type, free the old tool, create the new tool */
|
||||
transform_options->type = new_type;
|
||||
|
||||
gimp_context_set_tool (gimp_context_get_user (), transform_options->type);
|
||||
if (gimp_context_get_tool (gimp_context_get_user ()) != new_type)
|
||||
gimp_context_set_tool (gimp_context_get_user (), new_type);
|
||||
else
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (gimp_context_get_user ()),
|
||||
"tool_changed",
|
||||
new_type);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_smoothing (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -401,7 +406,7 @@ transform_tool_smoothing (void)
|
|||
return transform_options->smoothing;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_showpath (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -410,7 +415,7 @@ transform_tool_showpath (void)
|
|||
return transform_options->showpath;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_clip (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -419,7 +424,7 @@ transform_tool_clip (void)
|
|||
return transform_options->clip;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
transform_tool_direction (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -428,7 +433,7 @@ transform_tool_direction (void)
|
|||
return transform_options->direction;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
transform_tool_grid_size (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
@ -437,7 +442,7 @@ transform_tool_grid_size (void)
|
|||
return transform_options->grid_size;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
transform_tool_show_grid (void)
|
||||
{
|
||||
if (!transform_options)
|
||||
|
|
|
@ -18,18 +18,19 @@
|
|||
#ifndef __TRANSFORM_TOOL_H__
|
||||
#define __TRANSFORM_TOOL_H__
|
||||
|
||||
/* tool functions */
|
||||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *);
|
||||
int transform_tool_smoothing (void);
|
||||
int transform_tool_showpath (void);
|
||||
int transform_tool_clip (void);
|
||||
int transform_tool_direction (void);
|
||||
int transform_tool_grid_size (void);
|
||||
int transform_tool_show_grid (void);
|
||||
|
||||
/* transform directions */
|
||||
#define TRANSFORM_TRADITIONAL 0
|
||||
#define TRANSFORM_CORRECTIVE 1
|
||||
#define TRANSFORM_CORRECTIVE 1
|
||||
|
||||
/* tool functions */
|
||||
Tool * tools_new_transform_tool (void);
|
||||
void tools_free_transform_tool (Tool *tool);
|
||||
|
||||
gboolean transform_tool_smoothing (void);
|
||||
gboolean transform_tool_showpath (void);
|
||||
gboolean transform_tool_clip (void);
|
||||
gint transform_tool_direction (void);
|
||||
gint transform_tool_grid_size (void);
|
||||
gboolean transform_tool_show_grid (void);
|
||||
|
||||
#endif /* __TRANSFORM_TOOL_H__ */
|
||||
|
|
|
@ -688,7 +688,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("flip_tool.h" "transform_core.h" "undo.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer' ],
|
||||
'Layer *layer', 'gboolean new_layer' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -982,7 +982,7 @@ HELP
|
|||
headers => [ qw("perspective_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix m, matrix' ],
|
||||
code => <<'CODE'
|
||||
|
@ -1105,7 +1105,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("rotate_tool.h" "transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1188,7 +1188,7 @@ HELP
|
|||
headers => [ qw("scale_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double scalex, scaley',
|
||||
'Layer *layer', 'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1279,7 +1279,7 @@ HELP
|
|||
headers => [ qw("shear_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
|
|
@ -688,7 +688,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("flip_tool.h" "transform_core.h" "undo.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer' ],
|
||||
'Layer *layer', 'gboolean new_layer' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -982,7 +982,7 @@ HELP
|
|||
headers => [ qw("perspective_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix m, matrix' ],
|
||||
code => <<'CODE'
|
||||
|
@ -1105,7 +1105,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("rotate_tool.h" "transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1188,7 +1188,7 @@ HELP
|
|||
headers => [ qw("scale_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double scalex, scaley',
|
||||
'Layer *layer', 'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1279,7 +1279,7 @@ HELP
|
|||
headers => [ qw("shear_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
|
|
@ -688,7 +688,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("flip_tool.h" "transform_core.h" "undo.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer' ],
|
||||
'Layer *layer', 'gboolean new_layer' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -982,7 +982,7 @@ HELP
|
|||
headers => [ qw("perspective_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix m, matrix' ],
|
||||
code => <<'CODE'
|
||||
|
@ -1105,7 +1105,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("rotate_tool.h" "transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1188,7 +1188,7 @@ HELP
|
|||
headers => [ qw("scale_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double scalex, scaley',
|
||||
'Layer *layer', 'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1279,7 +1279,7 @@ HELP
|
|||
headers => [ qw("shear_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
|
|
@ -688,7 +688,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("flip_tool.h" "transform_core.h" "undo.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer' ],
|
||||
'Layer *layer', 'gboolean new_layer' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -982,7 +982,7 @@ HELP
|
|||
headers => [ qw("perspective_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix m, matrix' ],
|
||||
code => <<'CODE'
|
||||
|
@ -1105,7 +1105,7 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("rotate_tool.h" "transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1188,7 +1188,7 @@ HELP
|
|||
headers => [ qw("scale_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double scalex, scaley',
|
||||
'Layer *layer', 'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
@ -1279,7 +1279,7 @@ HELP
|
|||
headers => [ qw("shear_tool.h" "transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'Layer *layer', 'int new_layer', 'double cx, cy',
|
||||
'Layer *layer', 'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue