ported to GimpPreviewArea.

* plug-ins/common/diffraction.c: ported to GimpPreviewArea.
This commit is contained in:
David Odin 2004-07-31 13:18:31 +00:00
parent 19134bce88
commit f6d4e9f198
2 changed files with 158 additions and 156 deletions

View File

@ -1,3 +1,7 @@
2004-07-31 DindinX <david@dindinx.org>
* plug-ins/common/diffraction.c: ported to GimpPreviewArea.
2004-07-31 DindinX <david@dindinx.org>
* plug-ins/common/despeckle.c: use even more GimpPreviewArea's

View File

@ -30,11 +30,6 @@
#endif
#include <sys/types.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
@ -76,7 +71,7 @@ typedef struct
{
GtkWidget *preview;
GtkWidget *progress;
guchar preview_row[PREVIEW_WIDTH * 3];
guchar preview_buffer[PREVIEW_WIDTH * PREVIEW_HEIGHT * 3];
} diffraction_interface_t;
@ -139,7 +134,7 @@ static diffraction_interface_t dint =
{
NULL, /* preview */
NULL, /* progress */
{ 0 } /* preview_row */
{ 0 } /* preview_buffer */
};
static gdouble cos_lut[ITERATIONS + 1];
@ -461,13 +456,13 @@ diffraction_dialog (void)
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
frame = gtk_frame_new (NULL);
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
dint.preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW(dint.preview), PREVIEW_WIDTH, PREVIEW_HEIGHT);
dint.preview = gimp_preview_area_new ();
gtk_widget_set_size_request (dint.preview, PREVIEW_WIDTH, PREVIEW_HEIGHT);
gtk_container_add (GTK_CONTAINER (frame), dint.preview);
gtk_widget_show (dint.preview);
@ -675,10 +670,10 @@ dialog_update_preview (void)
py = top;
p = dint.preview_buffer;
for (y = 0; y < PREVIEW_HEIGHT; y++)
{
px = left;
p = dint.preview_row;
for (x = 0; x < PREVIEW_WIDTH; x++)
{
@ -691,19 +686,22 @@ dialog_update_preview (void)
px += dx;
}
gtk_preview_draw_row (GTK_PREVIEW (dint.preview),
dint.preview_row, 0, y, PREVIEW_WIDTH);
if ((y%10)==0)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dint.progress),
(gdouble) y /
(gdouble) (PREVIEW_HEIGHT - 1));
while (gtk_events_pending ())
gtk_main_iteration ();
}
py += dy;
}
gtk_widget_queue_draw (dint.preview);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (dint.preview),
0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT,
GIMP_RGB_IMAGE,
dint.preview_buffer,
3 * PREVIEW_WIDTH);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dint.progress), 0.0);
}