ported to GimpPreviewArea.

* plug-ins/common/tileit.c: ported to GimpPreviewArea.
This commit is contained in:
David Odin
2004-08-01 21:59:13 +00:00
parent c5f67ae992
commit e62343c737
2 changed files with 170 additions and 195 deletions

View File

@ -1,3 +1,7 @@
2004-08-01 DindinX <david@dindinx.org>
* plug-ins/common/tileit.c: ported to GimpPreviewArea.
2004-08-01 DindinX <david@dindinx.org>
* plug-ins/common/sinus.c: ported to GimpPreviewArea.

View File

@ -394,8 +394,8 @@ tileit_dialog (void)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
tint.preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (tint.preview), preview_width, preview_height);
tint.preview = gimp_preview_area_new ();
gtk_widget_set_size_request (tint.preview, preview_width, preview_height);
gtk_widget_set_events (GTK_WIDGET (tint.preview), PREVIEW_MASK);
gtk_container_add (GTK_CONTAINER (frame), tint.preview);
gtk_widget_show (tint.preview);
@ -1128,21 +1128,11 @@ static void
dialog_update_preview (void)
{
gint y;
gint check, check_0, check_1;
guchar *buffer;
buffer = g_new (guchar, preview_width * preview_height * tint.img_bpp);
for (y = 0; y < preview_height; y++)
{
if ((y / GIMP_CHECK_SIZE) & 1)
{
check_0 = GIMP_CHECK_DARK * 255;
check_1 = GIMP_CHECK_LIGHT * 255;
}
else
{
check_0 = GIMP_CHECK_LIGHT * 255;
check_1 = GIMP_CHECK_DARK * 255;
}
do_tiles_preview (tint.preview_row,
tint.pv_cache,
preview_width,
@ -1150,35 +1140,16 @@ dialog_update_preview (void)
preview_height,
tint.img_bpp);
if (tint.img_bpp > 3)
{
gint i, j;
for (i = 0, j = 0 ; i < sizeof (tint.preview_row); i += 4, j += 3 )
{
gint alphaval;
if (((i/4) / GIMP_CHECK_SIZE) & 1)
check = check_0;
else
check = check_1;
alphaval = tint.preview_row[i + 3];
tint.preview_row[j] =
check + (((tint.preview_row[i] - check)*alphaval)/255);
tint.preview_row[j + 1] =
check + (((tint.preview_row[i + 1] - check)*alphaval)/255);
tint.preview_row[j + 2] =
check + (((tint.preview_row[i + 2] - check)*alphaval)/255);
memcpy (buffer + y* (preview_width * tint.img_bpp),
tint.preview_row,
preview_width * tint.img_bpp);
}
}
gtk_preview_draw_row (GTK_PREVIEW (tint.preview),
tint.preview_row, 0, y, preview_width);
}
gimp_preview_area_draw (GIMP_PREVIEW_AREA (tint.preview),
0, 0, preview_width, preview_height,
(tint.img_bpp>3)?GIMP_RGBA_IMAGE:GIMP_RGB_IMAGE,
buffer,
preview_width * tint.img_bpp);
g_free (buffer);
draw_explict_sel ();
gtk_widget_queue_draw (tint.preview);
}