Fixed vectors stroking on GRAY* and INDEXED* layers.

2003-09-23  Simon Budig  <simon@gimp.org>

	* app/core/gimpdrawable-stroke.c: Fixed vectors stroking on
	GRAY* and INDEXED* layers.

	* app/tools/gimpvectortool.c: Made the polygonal mode more
	consistent.
This commit is contained in:
Simon Budig 2003-09-22 23:19:22 +00:00 committed by Simon Budig
parent 02998f38d1
commit 2c212214fe
3 changed files with 45 additions and 22 deletions

View File

@ -1,3 +1,11 @@
2003-09-23 Simon Budig <simon@gimp.org>
* app/core/gimpdrawable-stroke.c: Fixed vectors stroking on
GRAY* and INDEXED* layers.
* app/tools/gimpvectortool.c: Made the polygonal mode more
consistent.
2003-09-23 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/stock-close-12.png

View File

@ -66,8 +66,9 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
TileManager *base;
TileManager *mask;
gint x1, x2, y1, y2, bytes, w, h;
guchar ucolor[4] = { 255, 127, 0, 255 };
guchar ucolor[4] = { 0, 0, 0, 255 };
guchar bg[1] = { 0, };
guchar *src_bytes;
PixelRegion maskPR, basePR;
/* what area do we operate on? */
@ -137,12 +138,18 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
if (!gimp_drawable_has_alpha (drawable))
bytes++;
src_bytes = g_malloc0 (bytes);
/* Fill a TileManager with the stroke color */
gimp_rgb_get_uchar (color, &(ucolor[0]), &(ucolor[1]), &(ucolor[2]));
src_bytes[bytes - 1] = OPAQUE_OPACITY;
gimp_image_transform_color (GIMP_ITEM (drawable)->gimage, drawable,
src_bytes, GIMP_RGB, ucolor);
base = tile_manager_new (w, h, bytes);
tile_manager_set_offsets (base, x1+x2, y1+y2);
pixel_region_init (&basePR, base, 0, 0, w, h, TRUE);
color_region (&basePR, ucolor);
color_region (&basePR, src_bytes);
g_free (src_bytes);
/* combine mask and stroke color TileManager */
pixel_region_init (&basePR, base, 0, 0, w, h, TRUE);

View File

@ -453,8 +453,6 @@ gimp_vector_tool_button_press (GimpTool *tool,
if (vector_tool->cur_anchor->selected == FALSE)
vector_tool->function = VECTORS_FINISHED;
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
}
@ -513,8 +511,6 @@ gimp_vector_tool_button_press (GimpTool *tool,
vector_tool->function == VECTORS_MOVE_VECTORS)
{
/* Work is being done in gimp_vector_tool_motion ()... */
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
}
@ -584,6 +580,9 @@ gimp_vector_tool_button_press (GimpTool *tool,
vector_tool->function = VECTORS_FINISHED;
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
gimp_vectors_thaw (vector_tool->vectors);
if (! gimp_draw_tool_is_active (draw_tool))
@ -677,20 +676,25 @@ gimp_vector_tool_motion (GimpTool *tool,
break;
case VECTORS_MOVE_CURVE:
if (options->polygonal)
{
gimp_vector_tool_move_selected_anchors (vector_tool,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
}
else
{
gimp_stroke_point_move_absolute (vector_tool->cur_stroke,
vector_tool->cur_anchor,
vector_tool->cur_position,
coords, vector_tool->restriction);
}
break;
case VECTORS_MOVE_ANCHORSET:
gimp_vector_tool_move_selected_anchors (vector_tool,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
break;
case VECTORS_MOVE_STROKE:
@ -706,24 +710,21 @@ gimp_vector_tool_motion (GimpTool *tool,
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y);
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
break;
case VECTORS_MOVE_VECTORS:
gimp_item_translate (GIMP_ITEM (vector_tool->vectors),
coords->x - vector_tool->last_x,
coords->y - vector_tool->last_y, FALSE);
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
break;
default:
break;
}
vector_tool->last_x = coords->x;
vector_tool->last_y = coords->y;
gimp_vectors_thaw (vector_tool->vectors);
}
@ -1002,11 +1003,18 @@ gimp_vector_tool_oper_update (GimpTool *tool,
else
{
if (state & TOGGLE_MASK)
{
vector_tool->function = VECTORS_DELETE_ANCHOR;
}
else
{
if (options->polygonal)
vector_tool->function = VECTORS_MOVE_ANCHOR;
else
vector_tool->function = VECTORS_MOVE_HANDLE;
}
}
}
else
{
vector_tool->function = VECTORS_CONVERT_EDGE;