ported to GimpPreviewArea (from GimpOldPreview).
* plug-ins/common/polar.c: ported to GimpPreviewArea (from GimpOldPreview).
This commit is contained in:
parent
e890f8ff83
commit
e6d4d26c75
@ -1,3 +1,8 @@
|
|||||||
|
2004-08-06 DindinX <david@dindinx.org>
|
||||||
|
|
||||||
|
* plug-ins/common/polar.c: ported to GimpPreviewArea (from
|
||||||
|
GimpOldPreview).
|
||||||
|
|
||||||
2004-08-06 Sven Neumann <sven@gimp.org>
|
2004-08-06 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* libgimpcolor/test-color-parser.c: include <glib-object.h>.
|
* libgimpcolor/test-color-parser.c: include <glib-object.h>.
|
||||||
|
@ -70,8 +70,6 @@
|
|||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
#include "gimpoldpreview.h"
|
|
||||||
|
|
||||||
#define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0)
|
#define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0)
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +81,7 @@
|
|||||||
|
|
||||||
#define SCALE_WIDTH 200
|
#define SCALE_WIDTH 200
|
||||||
#define ENTRY_WIDTH 60
|
#define ENTRY_WIDTH 60
|
||||||
|
#define PREVIEW_SIZE 128
|
||||||
|
|
||||||
/***** Types *****/
|
/***** Types *****/
|
||||||
|
|
||||||
@ -95,7 +94,9 @@ typedef struct
|
|||||||
gint polrec;
|
gint polrec;
|
||||||
} polarize_vals_t;
|
} polarize_vals_t;
|
||||||
|
|
||||||
static GimpOldPreview *preview;
|
static GtkWidget *preview;
|
||||||
|
static gint preview_width, preview_height, preview_bpp;
|
||||||
|
static guchar *preview_cache;
|
||||||
|
|
||||||
/***** Prototypes *****/
|
/***** Prototypes *****/
|
||||||
|
|
||||||
@ -610,9 +611,15 @@ polarize_dialog (void)
|
|||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
preview = gimp_old_preview_new (drawable);
|
preview = gimp_preview_area_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), preview->frame, FALSE, FALSE, 0);
|
preview_width = preview_height = PREVIEW_SIZE;
|
||||||
gtk_widget_show (preview->frame);
|
preview_cache = gimp_drawable_get_thumbnail_data (drawable->drawable_id,
|
||||||
|
&preview_width,
|
||||||
|
&preview_height,
|
||||||
|
&preview_bpp);
|
||||||
|
gtk_widget_set_size_request (preview, preview_width, preview_height);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (preview);
|
||||||
|
|
||||||
/* Controls */
|
/* Controls */
|
||||||
|
|
||||||
@ -699,8 +706,6 @@ polarize_dialog (void)
|
|||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
|
|
||||||
gimp_old_preview_free (preview);
|
|
||||||
|
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,24 +735,24 @@ dialog_update_preview (void)
|
|||||||
bottom = sel_y2 - 1;
|
bottom = sel_y2 - 1;
|
||||||
top = sel_y1;
|
top = sel_y1;
|
||||||
|
|
||||||
dx = (right - left) / (preview->width - 1);
|
dx = (right - left) / (preview_width - 1);
|
||||||
dy = (bottom - top) / (preview->height - 1);
|
dy = (bottom - top) / (preview_height - 1);
|
||||||
|
|
||||||
scale_x = (double) preview->width / (right - left + 1);
|
scale_x = (double) preview_width / (right - left + 1);
|
||||||
scale_y = (double) preview->height / (bottom - top + 1);
|
scale_y = (double) preview_height / (bottom - top + 1);
|
||||||
|
|
||||||
bpp = preview->bpp;
|
bpp = preview_bpp;
|
||||||
|
|
||||||
py = top;
|
py = top;
|
||||||
|
|
||||||
buffer = g_new (guchar, preview->rowstride);
|
buffer = g_new (guchar, bpp * preview_width * preview_height);
|
||||||
|
p_ul = buffer;
|
||||||
|
|
||||||
for (y = 0; y < preview->height; y++)
|
for (y = 0; y < preview_height; y++)
|
||||||
{
|
{
|
||||||
px = left;
|
px = left;
|
||||||
p_ul = buffer;
|
|
||||||
|
|
||||||
for (x = 0; x < preview->width; x++)
|
for (x = 0; x < preview_width; x++)
|
||||||
{
|
{
|
||||||
calc_undistorted_coords (px, py, &cx, &cy);
|
calc_undistorted_coords (px, py, &cx, &cy);
|
||||||
|
|
||||||
@ -757,9 +762,9 @@ dialog_update_preview (void)
|
|||||||
ix = (int) (cx + 0.5);
|
ix = (int) (cx + 0.5);
|
||||||
iy = (int) (cy + 0.5);
|
iy = (int) (cy + 0.5);
|
||||||
|
|
||||||
if ((ix >= 0) && (ix < preview->width) &&
|
if ((ix >= 0) && (ix < preview_width) &&
|
||||||
(iy >= 0) && (iy < preview->height))
|
(iy >= 0) && (iy < preview_height))
|
||||||
i = preview->cache + preview->rowstride * iy + bpp * ix;
|
i = preview_cache + bpp * (preview_width * iy + ix);
|
||||||
else
|
else
|
||||||
i = outside;
|
i = outside;
|
||||||
|
|
||||||
@ -771,14 +776,15 @@ dialog_update_preview (void)
|
|||||||
px += dx;
|
px += dx;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_old_preview_do_row (preview, y, preview->width, buffer);
|
|
||||||
|
|
||||||
py += dy;
|
py += dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
|
||||||
|
0, 0, preview_width, preview_height,
|
||||||
|
gimp_drawable_type (drawable->drawable_id),
|
||||||
|
buffer,
|
||||||
|
bpp * preview_width);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
|
||||||
gtk_widget_queue_draw (preview->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user