mirror of https://github.com/GNOME/gimp.git
ported to GimpPreviewArea.
* plug-ins/common/emboss.c: ported to GimpPreviewArea.
This commit is contained in:
parent
f6d4e9f198
commit
cf4fb10ed0
|
@ -1,3 +1,7 @@
|
|||
2004-07-31 DindinX <david@dindinx.org>
|
||||
|
||||
* plug-ins/common/emboss.c: ported to GimpPreviewArea.
|
||||
|
||||
2004-07-31 DindinX <david@dindinx.org>
|
||||
|
||||
* plug-ins/common/diffraction.c: ported to GimpPreviewArea.
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
@ -511,7 +506,6 @@ pluginCoreIA (piArgs *argp)
|
|||
|
||||
preview = mw_preview_new (hbox, thePreview);
|
||||
g_object_set_data (G_OBJECT (preview), "piArgs", argp);
|
||||
emboss_do_preview (preview);
|
||||
|
||||
frame = gimp_int_radio_group_new (TRUE, _("Function"),
|
||||
G_CALLBACK (emboss_radio_button_callback),
|
||||
|
@ -561,6 +555,7 @@ pluginCoreIA (piArgs *argp)
|
|||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
emboss_do_preview (preview);
|
||||
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
|
||||
|
||||
gtk_widget_destroy (dlg);
|
||||
|
@ -587,16 +582,14 @@ emboss_do_preview (GtkWidget *w)
|
|||
ap = g_object_get_data (G_OBJECT (theWidget), "piArgs");
|
||||
rowsize = thePreview->width * thePreview->bpp;
|
||||
|
||||
dst = g_malloc (rowsize);
|
||||
c = g_malloc (rowsize * 3);
|
||||
dst = g_new (guchar, rowsize * thePreview->height);
|
||||
c = g_new (guchar, rowsize * 3);
|
||||
memcpy (c, thePreview->bits, rowsize);
|
||||
memcpy (c + rowsize, thePreview->bits, rowsize * 2);
|
||||
EmbossInit (DtoR (ap->azimuth), DtoR (ap->elevation), ap->depth);
|
||||
|
||||
EmbossRow (c, ap->embossp ? (guchar *) 0 : c,
|
||||
dst, thePreview->width, thePreview->bpp, FALSE);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (theWidget),
|
||||
dst, 0, 0, thePreview->width);
|
||||
|
||||
memcpy (c,
|
||||
thePreview->bits + ((thePreview->height-2) * rowsize),
|
||||
|
@ -605,20 +598,22 @@ emboss_do_preview (GtkWidget *w)
|
|||
thePreview->bits + ((thePreview->height - 1) * rowsize),
|
||||
rowsize);
|
||||
EmbossRow (c, ap->embossp ? (guchar *) 0 : c,
|
||||
dst, thePreview->width, thePreview->bpp, FALSE);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (theWidget),
|
||||
dst, 0, thePreview->height - 1, thePreview->width);
|
||||
dst+rowsize*(thePreview->height-1),
|
||||
thePreview->width, thePreview->bpp, FALSE);
|
||||
g_free (c);
|
||||
|
||||
for (y = 0, c = thePreview->bits; y<thePreview->height - 2; y++, c += rowsize)
|
||||
{
|
||||
EmbossRow (c, ap->embossp ? (guchar *) 0 : c,
|
||||
dst, thePreview->width, thePreview->bpp, FALSE);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (theWidget),
|
||||
dst, 0, y, thePreview->width);
|
||||
dst + rowsize * (y+1),
|
||||
thePreview->width, thePreview->bpp, FALSE);
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (theWidget);
|
||||
gimp_preview_area_draw (GIMP_PREVIEW_AREA (theWidget),
|
||||
1, 0, thePreview->width-2, thePreview->height,
|
||||
GIMP_RGB_IMAGE,
|
||||
dst+3,
|
||||
3 * thePreview->width);
|
||||
|
||||
g_free (dst);
|
||||
}
|
||||
|
@ -708,8 +703,8 @@ mw_preview_new (GtkWidget *parent,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), mwp->width, mwp->height);
|
||||
preview = gimp_preview_area_new ();
|
||||
gtk_widget_set_size_request (preview, mwp->width, mwp->height);
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
|
@ -724,3 +719,4 @@ mw_preview_new (GtkWidget *parent,
|
|||
|
||||
return preview;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue