no need to include gimp-intl.h.

2003-05-20  Sven Neumann  <sven@gimp.org>

	* app/core/gimpimage-flip.c: no need to include gimp-intl.h.

	* app/core/gimpimage-rotate.c: change the image size if needed;
	implemented rotation of guides.

	* app/vectors/gimpvectors.c: implemented rotation of vectors.
This commit is contained in:
Sven Neumann 2003-05-20 11:55:12 +00:00 committed by Sven Neumann
parent f46c16c8ea
commit 4e335f7fc2
4 changed files with 132 additions and 42 deletions

View File

@ -1,3 +1,12 @@
2003-05-20 Sven Neumann <sven@gimp.org>
* app/core/gimpimage-flip.c: no need to include gimp-intl.h.
* app/core/gimpimage-rotate.c: change the image size if needed;
implemented rotation of guides.
* app/vectors/gimpvectors.c: implemented rotation of vectors.
2003-05-20 Michael Natterer <mitch@gimp.org> 2003-05-20 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-undo-push.c: remember the guide's orientation * app/core/gimpimage-undo-push.c: remember the guide's orientation

View File

@ -34,8 +34,6 @@
#include "gimplayer-floating-sel.h" #include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimp-intl.h"
void void
gimp_image_flip (GimpImage *gimage, gimp_image_flip (GimpImage *gimage,

View File

@ -34,7 +34,9 @@
#include "gimplayer-floating-sel.h" #include "gimplayer-floating-sel.h"
#include "gimplist.h" #include "gimplist.h"
#include "gimp-intl.h"
static void gimp_image_rotate_guides (GimpImage *gimage,
GimpRotationType rotate_type);
void void
@ -48,10 +50,12 @@ gimp_image_rotate (GimpImage *gimage,
GList *list; GList *list;
gdouble center_x; gdouble center_x;
gdouble center_y; gdouble center_y;
gint tmp;
gint num_channels; gint num_channels;
gint num_layers; gint num_layers;
gint num_vectors; gint num_vectors;
gint progress_current = 1; gint progress_current = 1;
gboolean size_changed = FALSE;
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -73,6 +77,24 @@ gimp_image_rotate (GimpImage *gimage,
if (floating_layer) if (floating_layer)
floating_sel_relax (floating_layer, TRUE); floating_sel_relax (floating_layer, TRUE);
/* Resize the image (if needed) */
switch (rotate_type)
{
case GIMP_ROTATE_90:
case GIMP_ROTATE_270:
gimp_image_undo_push_image_size (gimage, NULL);
tmp = gimage->width;
gimage->width = gimage->height;
gimage->height = tmp;
size_changed = TRUE;
break;
case GIMP_ROTATE_180:
break;
}
/* Rotate all channels */ /* Rotate all channels */
for (list = GIMP_LIST (gimage->channels)->list; for (list = GIMP_LIST (gimage->channels)->list;
list; list;
@ -124,30 +146,7 @@ gimp_image_rotate (GimpImage *gimage,
} }
/* Rotate all Guides */ /* Rotate all Guides */
#if 0 /* FIXME: implement! */ gimp_image_rotate_guides (gimage, rotate_type);
for (list = gimage->guides; list; list = g_list_next (list))
{
GimpGuide *guide = list->data;
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
if (rotate_type == GIMP_ORIENTATION_VERTICAL)
gimp_image_move_guide (gimage, guide,
gimage->height - guide->position, TRUE);
break;
case GIMP_ORIENTATION_VERTICAL:
if (rotate_type == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_move_guide (gimage, guide,
gimage->width - guide->position, TRUE);
break;
default:
break;
}
}
#endif
/* Make sure the projection matches the gimage size */ /* Make sure the projection matches the gimage size */
gimp_image_projection_allocate (gimage); gimp_image_projection_allocate (gimage);
@ -158,7 +157,82 @@ gimp_image_rotate (GimpImage *gimage,
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
if (size_changed)
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
gimp_image_mask_changed (gimage); gimp_image_mask_changed (gimage);
gimp_unset_busy (gimage->gimp); gimp_unset_busy (gimage->gimp);
} }
static void
gimp_image_rotate_guides (GimpImage *gimage,
GimpRotationType rotate_type)
{
GList *list;
/* Rotate all Guides */
for (list = gimage->guides; list; list = g_list_next (list))
{
GimpGuide *guide = list->data;
switch (rotate_type)
{
case GIMP_ROTATE_90:
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_undo_push_image_guide (gimage, NULL, guide);
guide->orientation = GIMP_ORIENTATION_VERTICAL;
guide->position = gimage->width - guide->position;
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_image_undo_push_image_guide (gimage, NULL, guide);
guide->orientation = GIMP_ORIENTATION_HORIZONTAL;
break;
default:
break;
}
break;
case GIMP_ROTATE_180:
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_move_guide (gimage, guide,
gimage->height - guide->position, TRUE);
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_image_move_guide (gimage, guide,
gimage->width - guide->position, TRUE);
break;
default:
break;
}
break;
case GIMP_ROTATE_270:
switch (guide->orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_image_undo_push_image_guide (gimage, NULL, guide);
guide->orientation = GIMP_ORIENTATION_VERTICAL;
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_image_undo_push_image_guide (gimage, NULL, guide);
guide->orientation = GIMP_ORIENTATION_HORIZONTAL;
guide->position = gimage->height - guide->position;
break;
default:
break;
}
break;
}
}
}

View File

@ -25,6 +25,7 @@
#include "vectors-types.h" #include "vectors-types.h"
#include "core/gimpdrawable-transform-utils.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-undo-push.h" #include "core/gimpimage-undo-push.h"
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
@ -445,6 +446,24 @@ gimp_vectors_rotate (GimpItem *item,
{ {
GimpVectors *vectors; GimpVectors *vectors;
GList *list; GList *list;
GimpMatrix3 matrix;
gdouble angle = 0.0;
switch (rotate_type)
{
case GIMP_ROTATE_90:
angle = - G_PI_2;
break;
case GIMP_ROTATE_180:
angle = G_PI;
break;
case GIMP_ROTATE_270:
angle = G_PI_2;
break;
}
gimp_drawable_transform_matrix_rotate_center (center_x, center_y, angle,
matrix);
vectors = GIMP_VECTORS (item); vectors = GIMP_VECTORS (item);
@ -454,7 +473,6 @@ gimp_vectors_rotate (GimpItem *item,
_("Rotate Path"), _("Rotate Path"),
vectors); vectors);
#if 0 /* FIXME: implement! */
for (list = vectors->strokes; list; list = g_list_next (list)) for (list = vectors->strokes; list; list = g_list_next (list))
{ {
GimpStroke *stroke = list->data; GimpStroke *stroke = list->data;
@ -464,22 +482,13 @@ gimp_vectors_rotate (GimpItem *item,
{ {
GimpAnchor *anchor = list2->data; GimpAnchor *anchor = list2->data;
switch (flip_type) gimp_matrix3_transform_point (matrix,
{ anchor->position.x,
case GIMP_ORIENTATION_HORIZONTAL: anchor->position.y,
anchor->position.x = -(anchor->position.x - axis) + axis; &anchor->position.x,
break; &anchor->position.y);
case GIMP_ORIENTATION_VERTICAL:
anchor->position.y = -(anchor->position.y - axis) + axis;
break;
default:
break;
}
} }
} }
#endif
gimp_vectors_thaw (vectors); gimp_vectors_thaw (vectors);
} }