libgimpwidgets/gimppreview.[ch] added gimp_preview_draw_buffer().

2004-09-29  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppreview.[ch]
	* libgimpwidgets/gimpwidgets.def: added gimp_preview_draw_buffer().

	* libgimp/gimpaspectpreview.[ch]
	* libgimp/gimpdrawablepreview.[ch]
	* libgimp/gimpui.def: removed the public draw_buffer API.
	Implement the virtual GimpPreview::draw_buffer method instead.

	* plug-ins/common/cartoon.c
	* plug-ins/common/deinterlace.c
	* plug-ins/common/despeckle.c
	* plug-ins/common/dog.c
	* plug-ins/common/edge.c
	* plug-ins/common/engrave.c
	* plug-ins/common/exchange.c
	* plug-ins/common/gauss.c
	* plug-ins/common/grid.c
	* plug-ins/common/neon.c
	* plug-ins/common/noisify.c
	* plug-ins/common/oilify.c
	* plug-ins/common/photocopy.c
	* plug-ins/common/plasma.c
	* plug-ins/common/sel_gauss.c
	* plug-ins/common/sharpen.c
	* plug-ins/common/shift.c
	* plug-ins/common/snoise.c
	* plug-ins/common/sobel.c
	* plug-ins/common/spread.c
	* plug-ins/common/struc.c: changed accordingly. Don't pass the
	preview around as GimpDrawablePreview or GimpAspectPreview. It
	should whenever possible be accessed as GimpPreview.
This commit is contained in:
Sven Neumann 2004-09-29 15:33:02 +00:00 committed by Sven Neumann
parent 94bdc06173
commit de37bbb7f8
36 changed files with 467 additions and 439 deletions

View file

@ -1,3 +1,37 @@
2004-09-29 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppreview.[ch]
* libgimpwidgets/gimpwidgets.def: added gimp_preview_draw_buffer().
* libgimp/gimpaspectpreview.[ch]
* libgimp/gimpdrawablepreview.[ch]
* libgimp/gimpui.def: removed the public draw_buffer API.
Implement the virtual GimpPreview::draw_buffer method instead.
* plug-ins/common/cartoon.c
* plug-ins/common/deinterlace.c
* plug-ins/common/despeckle.c
* plug-ins/common/dog.c
* plug-ins/common/edge.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c
* plug-ins/common/gauss.c
* plug-ins/common/grid.c
* plug-ins/common/neon.c
* plug-ins/common/noisify.c
* plug-ins/common/oilify.c
* plug-ins/common/photocopy.c
* plug-ins/common/plasma.c
* plug-ins/common/sel_gauss.c
* plug-ins/common/sharpen.c
* plug-ins/common/shift.c
* plug-ins/common/snoise.c
* plug-ins/common/sobel.c
* plug-ins/common/spread.c
* plug-ins/common/struc.c: changed accordingly. Don't pass the
preview around as GimpDrawablePreview or GimpAspectPreview. It
should whenever possible be accessed as GimpPreview.
2004-09-29 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppreview.[ch]

View file

@ -743,24 +743,6 @@ gimp_drawable_get_thumbnail
<TITLE>GimpAspectPreview</TITLE>
GimpAspectPreview
gimp_aspect_preview_new
gimp_aspect_preview_draw_buffer
<SUBSECTION Standard>
GimpAspectPreviewClass
GIMP_ASPECT_PREVIEW
GIMP_IS_ASPECT_PREVIEW
GIMP_TYPE_ASPECT_PREVIEW
gimp_aspect_preview_get_type
GIMP_ASPECT_PREVIEW_CLASS
GIMP_IS_ASPECT_PREVIEW_CLASS
GIMP_ASPECT_PREVIEW_GET_CLASS
</SECTION>
<SECTION>
<FILE>gimpaspectpreview</FILE>
<TITLE>GimpAspectPreview</TITLE>
GimpAspectPreview
gimp_aspect_preview_new
gimp_aspect_preview_draw_buffer
<SUBSECTION Standard>
GimpAspectPreviewClass
GIMP_ASPECT_PREVIEW
@ -778,7 +760,6 @@ GIMP_ASPECT_PREVIEW_GET_CLASS
GimpDrawablePreview
gimp_drawable_preview_new
gimp_drawable_preview_get_drawable
gimp_drawable_preview_draw_buffer
gimp_drawable_preview_draw_region
<SUBSECTION Standard>
GimpDrawablePreviewClass

View file

@ -9,13 +9,11 @@ GimpAspectPreview
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### STRUCT GimpAspectPreview ##### -->
<para>
@ -32,13 +30,3 @@ GimpAspectPreview
@Returns:
<!-- ##### FUNCTION gimp_aspect_preview_draw_buffer ##### -->
<para>
</para>
@preview:
@buffer:
@rowstride:

View file

@ -39,16 +39,6 @@ GimpDrawablePreview
@Returns:
<!-- ##### FUNCTION gimp_drawable_preview_draw_buffer ##### -->
<para>
</para>
@preview:
@buffer:
@rowstride:
<!-- ##### FUNCTION gimp_drawable_preview_draw_region ##### -->
<para>

View file

@ -809,6 +809,7 @@ gimp_preview_set_bounds
gimp_preview_get_size
gimp_preview_get_position
gimp_preview_draw
gimp_preview_draw_buffer
gimp_preview_invalidate
<SUBSECTION Standard>
GimpPreviewClass

View file

@ -95,6 +95,16 @@ GimpPreview
@preview:
<!-- ##### FUNCTION gimp_preview_draw_buffer ##### -->
<para>
</para>
@preview:
@buffer:
@rowstride:
<!-- ##### FUNCTION gimp_preview_invalidate ##### -->
<para>

View file

@ -33,12 +33,16 @@
#include "gimpaspectpreview.h"
static void gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass);
static void gimp_aspect_preview_init (GimpAspectPreview *preview);
static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview);
static void gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass);
static void gimp_aspect_preview_init (GimpAspectPreview *preview);
static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview);
static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
static GimpPreviewClass *parent_class = NULL;
@ -79,8 +83,10 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
parent_class = g_type_class_peek_parent (klass);
widget_class->style_set = gimp_aspect_preview_style_set;
preview_class->draw = gimp_aspect_preview_draw;
widget_class->style_set = gimp_aspect_preview_style_set;
preview_class->draw = gimp_aspect_preview_draw;
preview_class->draw_buffer = gimp_aspect_preview_draw_buffer;
}
static void
@ -96,9 +102,10 @@ static void
gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (widget);
gint size;
gint width, height;
GimpPreview *preview = GIMP_PREVIEW (widget);
GimpDrawable *drawable = GIMP_ASPECT_PREVIEW (preview)->drawable;
gint size;
gint width, height;
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
@ -106,22 +113,51 @@ gimp_aspect_preview_style_set (GtkWidget *widget,
gtk_widget_style_get (widget,
"size", &size,
NULL);
width = gimp_drawable_width (preview->drawable->drawable_id);
height = gimp_drawable_height (preview->drawable->drawable_id);
width = gimp_drawable_width (drawable->drawable_id);
height = gimp_drawable_height (drawable->drawable_id);
if (width > height)
{
GIMP_PREVIEW (preview)->width = MIN (width, size);
GIMP_PREVIEW (preview)->height = (height * GIMP_PREVIEW (preview)->width) / width;
preview->width = MIN (width, size);
preview->height = (height * preview->width) / width;
}
else
{
GIMP_PREVIEW (preview)->height = MIN (height, size);
GIMP_PREVIEW (preview)->width = (width * GIMP_PREVIEW (preview)->height) / height;
preview->height = MIN (height, size);
preview->width = (width * preview->height) / height;
}
gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
GIMP_PREVIEW (preview)->width,
GIMP_PREVIEW (preview)->height);
gtk_widget_set_size_request (preview->area,
preview->width, preview->height);
}
static void
gimp_aspect_preview_draw (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
gimp_preview_area_fill (GIMP_PREVIEW_AREA (preview->area),
0, 0,
preview->width,
preview->height,
0, 0, 0);
}
static void
gimp_aspect_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride)
{
GimpDrawable *drawable = GIMP_ASPECT_PREVIEW (preview)->drawable;
if (drawable)
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
0, 0,
preview->width, preview->height,
gimp_drawable_type (drawable->drawable_id),
buffer,
rowstride);
}
GtkWidget *
@ -140,46 +176,8 @@ gimp_aspect_preview_new (GimpDrawable *drawable,
gimp_preview_set_bounds (GIMP_PREVIEW (preview), 0, 0, width, height);
g_object_set (GIMP_PREVIEW (preview)->frame,
"ratio", (gdouble)width / (gdouble)height,
"ratio", (gdouble) width / (gdouble) height,
NULL);
return GTK_WIDGET (preview);
}
static void
gimp_aspect_preview_draw (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
gimp_preview_area_fill (GIMP_PREVIEW_AREA (preview->area),
0, 0,
preview->width,
preview->height,
0, 0, 0);
}
/**
* gimp_aspect_preview_draw_buffer:
* @preview: a #GimpAspectPreview widget
* @buffer:
* @rowstride:
*
* Since: GIMP 2.2
**/
void
gimp_aspect_preview_draw_buffer (GimpAspectPreview *preview,
const guchar *buffer,
gint rowstride)
{
g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
g_return_if_fail (buffer != NULL);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (GIMP_PREVIEW (preview)->area),
0, 0,
GIMP_PREVIEW (preview)->width,
GIMP_PREVIEW (preview)->height,
gimp_drawable_type (preview->drawable->drawable_id),
buffer,
rowstride);
}

View file

@ -54,13 +54,11 @@ struct _GimpAspectPreviewClass
};
GType gimp_aspect_preview_get_type (void) G_GNUC_CONST;
GtkWidget *gimp_aspect_preview_new (GimpDrawable *drawable,
gboolean *toggle);
GType gimp_aspect_preview_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_aspect_preview_new (GimpDrawable *drawable,
gboolean *toggle);
void gimp_aspect_preview_draw_buffer (GimpAspectPreview *preview,
const guchar *buffer,
gint rowstride);
G_END_DECLS

View file

@ -46,6 +46,10 @@ static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
static void gimp_drawable_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
static GimpScrolledPreviewClass *parent_class = NULL;
@ -86,10 +90,11 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
parent_class = g_type_class_peek_parent (klass);
widget_class->style_set = gimp_drawable_preview_style_set;
widget_class->style_set = gimp_drawable_preview_style_set;
preview_class->draw = gimp_drawable_preview_draw_original;
preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
preview_class->draw = gimp_drawable_preview_draw_original;
preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
preview_class->draw_buffer = gimp_drawable_preview_draw_buffer;
}
static void
@ -267,6 +272,19 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
}
}
static void
gimp_drawable_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride)
{
gimp_drawable_preview_draw_area (GIMP_DRAWABLE_PREVIEW (preview),
preview->xmin + preview->xoff,
preview->ymin + preview->yoff,
preview->width,
preview->height,
buffer, rowstride);
}
static void
gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
GimpDrawable *drawable)
@ -366,35 +384,6 @@ gimp_drawable_preview_get_drawable (GimpDrawablePreview *preview)
return preview->drawable;
}
/**
* gimp_drawable_preview_draw_buffer:
* @preview: a #GimpDrawablePreview widget
* @buffer:
* @rowstride:
*
* Since: GIMP 2.2
**/
void
gimp_drawable_preview_draw_buffer (GimpDrawablePreview *preview,
const guchar *buffer,
gint rowstride)
{
GimpPreview *gimp_preview;
g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview));
g_return_if_fail (preview->drawable != NULL);
g_return_if_fail (buffer != NULL);
gimp_preview = GIMP_PREVIEW (preview);
gimp_drawable_preview_draw_area (preview,
gimp_preview->xmin + gimp_preview->xoff,
gimp_preview->ymin + gimp_preview->yoff,
gimp_preview->width,
gimp_preview->height,
buffer, rowstride);
}
/**
* gimp_drawable_preview_draw_region:
* @preview: a #GimpDrawablePreview widget

View file

@ -59,9 +59,6 @@ GtkWidget * gimp_drawable_preview_new (GimpDrawable *drawable
gboolean *toggle);
GimpDrawable * gimp_drawable_preview_get_drawable (GimpDrawablePreview *preview);
void gimp_drawable_preview_draw_buffer (GimpDrawablePreview *preview,
const guchar *buffer,
gint rowstride);
void gimp_drawable_preview_draw_region (GimpDrawablePreview *preview,
const GimpPixelRgn *region);

View file

@ -1,5 +1,4 @@
EXPORTS
gimp_aspect_preview_draw_buffer
gimp_aspect_preview_get_type
gimp_aspect_preview_new
gimp_brush_select_widget_close
@ -10,7 +9,6 @@ EXPORTS
gimp_drawable_combo_box_new
gimp_drawable_get_thumbnail
gimp_drawable_menu_new
gimp_drawable_preview_draw_buffer
gimp_drawable_preview_draw_region
gimp_drawable_preview_get_drawable
gimp_drawable_preview_get_type

View file

@ -145,6 +145,7 @@ gimp_preview_class_init (GimpPreviewClass *klass)
klass->draw = NULL;
klass->draw_thumb = NULL;
klass->draw_buffer = NULL;
klass->set_cursor = gimp_preview_set_cursor;
g_object_class_install_property (object_class,
@ -593,6 +594,29 @@ gimp_preview_draw (GimpPreview *preview)
class->draw (preview);
}
/*
* gimp_preview_draw_buffer:
* @preview: a #GimpPreview widget
* @buffer: a pixel buffer the size of the preview
* @rowstride: the @buffer's rowstride
*
* Calls the GimpPreview::draw_buffer method. GimpPreview itself
* doesn't implement this method so the behaviour is determined by the
* derived class implementing this method.
*
* Since: GIMP 2.2
**/
void
gimp_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride)
{
GimpPreviewClass *class = GIMP_PREVIEW_GET_CLASS (preview);
if (class->draw_buffer)
class->draw_buffer (preview, buffer, rowstride);
}
/*
* gimp_preview_invalidate:
* @preview: a #GimpPreview widget

View file

@ -71,6 +71,9 @@ struct _GimpPreviewClass
GimpPreviewArea *area,
gint width,
gint height);
void (* draw_buffer) (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
void (* set_cursor) (GimpPreview *preview);
/* signal */
@ -80,25 +83,29 @@ struct _GimpPreviewClass
GType gimp_preview_get_type (void) G_GNUC_CONST;
void gimp_preview_set_update (GimpPreview *preview,
gboolean update);
gboolean gimp_preview_get_update (GimpPreview *preview);
void gimp_preview_set_update (GimpPreview *preview,
gboolean update);
gboolean gimp_preview_get_update (GimpPreview *preview);
void gimp_preview_set_bounds (GimpPreview *preview,
gint xmin,
gint ymin,
gint xmax,
gint ymax);
void gimp_preview_set_bounds (GimpPreview *preview,
gint xmin,
gint ymin,
gint xmax,
gint ymax);
void gimp_preview_get_position (GimpPreview *preview,
gint *x,
gint *y);
void gimp_preview_get_size (GimpPreview *preview,
gint *width,
gint *height);
void gimp_preview_get_position (GimpPreview *preview,
gint *x,
gint *y);
void gimp_preview_get_size (GimpPreview *preview,
gint *width,
gint *height);
void gimp_preview_draw (GimpPreview *preview);
void gimp_preview_invalidate (GimpPreview *preview);
void gimp_preview_draw (GimpPreview *preview);
void gimp_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
void gimp_preview_invalidate (GimpPreview *preview);
G_END_DECLS

View file

@ -163,6 +163,7 @@ EXPORTS
gimp_preview_area_set_max_size
gimp_preview_area_set_offsets
gimp_preview_draw
gimp_preview_draw_buffer
gimp_preview_get_position
gimp_preview_get_size
gimp_preview_get_type

View file

@ -57,14 +57,14 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void cartoon (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static gboolean cartoon_dialog (GimpDrawable *drawable);
static void cartoon (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean cartoon_dialog (GimpDrawable *drawable);
static gdouble compute_ramp (guchar *dest1,
guchar *dest2,
gint length,
gdouble pct_black);
static gdouble compute_ramp (guchar *dest1,
guchar *dest2,
gint length,
gdouble pct_black);
/*
* Gaussian blur helper functions
@ -251,8 +251,8 @@ run (const gchar *name,
* pixel intensity *= intensity mult
*/
static void
cartoon (GimpDrawable *drawable,
GimpDrawablePreview *preview)
cartoon (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
GimpPixelRgn *pr;
@ -290,7 +290,7 @@ cartoon (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_size (preview, &width, &height);
}
else
{
@ -301,7 +301,7 @@ cartoon (GimpDrawable *drawable,
}
bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->drawable_id);
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
val_p1 = g_new (gdouble, MAX (width, height) * bytes);
val_p2 = g_new (gdouble, MAX (width, height) * bytes);
@ -586,8 +586,7 @@ cartoon (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (preview,
preview_buffer, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer, width * bytes);
g_free (preview_buffer);
}
else

View file

@ -53,10 +53,10 @@ static void run (const gchar *name,
GimpParam **return_vals);
static void deinterlace (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void deinterlace (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean deinterlace_dialog (GimpDrawable *drawable);
static gboolean deinterlace_dialog (GimpDrawable *drawable);
GimpPlugInInfo PLUG_IN_INFO =
@ -181,8 +181,8 @@ run (const gchar *name,
}
static void
deinterlace (GimpDrawable *drawable,
GimpDrawablePreview *preview)
deinterlace (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn srcPR, destPR;
gint width, height;
@ -199,8 +199,9 @@ deinterlace (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
dest_buffer = dest = g_new (guchar, width * height * bytes);
}
else
@ -283,7 +284,7 @@ deinterlace (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (preview, dest_buffer, width * bytes);
gimp_preview_draw_buffer (preview, dest_buffer, width * bytes);
dest = dest_buffer;
}
else

View file

@ -853,8 +853,7 @@ preview_update (GtkWidget *widget)
* Update the screen...
*/
gimp_drawable_preview_draw_buffer (GIMP_DRAWABLE_PREVIEW (preview),
rgba, preview->width * img_bpp);
gimp_preview_draw_buffer (preview, rgba, preview->width * img_bpp);
g_free (rgba);
g_free (preview_src);

View file

@ -75,10 +75,10 @@ static void dog (GimpDrawable *drawable,
gdouble outer,
gboolean show_progress);
static void preview_update_preview (GimpDrawablePreview *preview,
GimpDrawable *drawable);
static void change_radius_callback (GtkWidget *widget,
gpointer data);
static void preview_update_preview (GimpPreview *preview,
GimpDrawable *drawable);
static void change_radius_callback (GtkWidget *widget,
gpointer data);
@ -908,8 +908,8 @@ run_length_encode (guchar *src,
}
static void
preview_update_preview (GimpDrawablePreview *preview,
GimpDrawable *drawable)
preview_update_preview (GimpPreview *preview,
GimpDrawable *drawable)
{
gint x1, y1;
gint width, height;
@ -923,8 +923,8 @@ preview_update_preview (GimpDrawablePreview *preview,
bpp = gimp_drawable_bpp (drawable->drawable_id);
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
buffer = g_new (guchar, width * height * bpp);
@ -955,7 +955,7 @@ preview_update_preview (GimpDrawablePreview *preview,
gimp_pixel_rgn_get_rect (&preview_rgn, buffer,
0, 0, width, height);
gimp_drawable_preview_draw_buffer (preview, buffer, width * bpp);
gimp_preview_draw_buffer (preview, buffer, width * bpp);
gimp_image_delete (image_id);
g_free (buffer);

View file

@ -93,15 +93,15 @@ typedef struct
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void edge (GimpDrawable *drawable);
static gboolean edge_dialog (GimpDrawable *drawable);
static void edge_preview_update (GimpDrawablePreview *preview);
static void edge (GimpDrawable *drawable);
static gboolean edge_dialog (GimpDrawable *drawable);
static void edge_preview_update (GimpPreview *preview);
static gint edge_detect (const guchar *data);
static gint prewitt (const guchar *data);
@ -770,12 +770,13 @@ edge_dialog (GimpDrawable *drawable)
}
static void
edge_preview_update (GimpDrawablePreview *preview)
edge_preview_update (GimpPreview *preview)
{
/* drawable */
glong bytes;
gint alpha;
gboolean has_alpha;
GimpDrawable *drawable;
glong bytes;
gint alpha;
gboolean has_alpha;
/* preview */
guchar *src = NULL; /* Buffer to hold source image */
@ -791,20 +792,22 @@ edge_preview_update (GimpDrawablePreview *preview)
gint x, y;
/* Get drawable info */
bytes = gimp_drawable_bpp (preview->drawable->drawable_id);
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
bytes = gimp_drawable_bpp (drawable->drawable_id);
alpha = bytes;
has_alpha = gimp_drawable_has_alpha (preview->drawable->drawable_id);
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
if (has_alpha)
alpha--;
/*
* Setup for filter...
*/
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
/* initialize pixel regions */
gimp_pixel_rgn_init (&srcPR, preview->drawable,
gimp_pixel_rgn_init (&srcPR, drawable,
x1, y1, width, height, FALSE, FALSE);
src = g_new (guchar, width * height * bytes);
render_buffer = g_new (guchar, width * height * bytes);
@ -842,7 +845,7 @@ edge_preview_update (GimpDrawablePreview *preview)
/*
* Draw the preview image on the screen...
*/
gimp_drawable_preview_draw_buffer (preview, render_buffer, width * bytes);
gimp_preview_draw_buffer (preview, render_buffer, width * bytes);
g_free (render_buffer);
g_free (src);

View file

@ -47,28 +47,28 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean engrave_dialog (GimpDrawable *drawable);
static gboolean engrave_dialog (GimpDrawable *drawable);
static void engrave (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void engrave (GimpDrawable *drawable,
GimpPreview *preview);
#if 0
static void engrave_large (GimpDrawable *drawable,
gint height,
gboolean limit,
GimpDrawablePreview *preview);
static void engrave_large (GimpDrawable *drawable,
gint height,
gboolean limit,
GimpPreview *preview);
#endif
static void engrave_small (GimpDrawable *drawable,
gint height,
gboolean limit,
gint tile_width,
GimpDrawablePreview *preview);
static void engrave_small (GimpDrawable *drawable,
gint height,
gboolean limit,
gint tile_width,
GimpPreview *preview);
static void engrave_sub (gint height,
gboolean limit,
gint bpp,
gint color_n);
static void engrave_sub (gint height,
gboolean limit,
gint bpp,
gint color_n);
GimpPlugInInfo PLUG_IN_INFO =
{
@ -271,8 +271,8 @@ engrave_dialog (GimpDrawable *drawable)
/* Engrave interface functions */
static void
engrave (GimpDrawable *drawable,
GimpDrawablePreview *preview)
engrave (GimpDrawable *drawable,
GimpPreview *preview)
{
gint tile_width;
gint height;
@ -293,10 +293,10 @@ engrave (GimpDrawable *drawable,
#if 0
static void
engrave_large (GimpDrawable *drawable,
gint height,
gboolean limit,
GimpDrawablePreview *preview)
engrave_large (GimpDrawable *drawable,
gint height,
gboolean limit,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
guchar *src_row, *dest_row;
@ -393,12 +393,12 @@ engrave_large (GimpDrawable *drawable,
}
}
g_free(average);
g_free (average);
/* update the engraved region */
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->drawable_id, TRUE);
gimp_drawable_update(drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
gimp_drawable_flush( drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
}
#endif
@ -412,11 +412,11 @@ typedef struct
PixelArea area;
static void
engrave_small (GimpDrawable *drawable,
gint line_height,
gboolean limit,
gint tile_width,
GimpDrawablePreview *preview)
engrave_small (GimpDrawable *drawable,
gint line_height,
gboolean limit,
gint tile_width,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
gint bpp, color_n;
@ -434,8 +434,8 @@ engrave_small (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -490,7 +490,8 @@ engrave_small (GimpDrawable *drawable,
/* update the engraved region */
if (preview)
{
gimp_drawable_preview_draw_region (preview, &dest_rgn);
gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview),
&dest_rgn);
}
else
{

View file

@ -69,14 +69,15 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void exchange (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void exchange (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean exchange_dialog (GimpDrawable *preview);
static void color_button_callback (GtkWidget *widget,
gpointer data);
static void scale_callback (GtkAdjustment *adj,
gpointer data);
static gboolean exchange_dialog (GimpDrawable *preview);
static void color_button_callback (GtkWidget *widget,
gpointer data);
static void scale_callback (GtkAdjustment *adj,
gpointer data);
/* some global variables */
static myParams xargs =
@ -643,8 +644,8 @@ scale_callback (GtkAdjustment *adj,
/* do the exchanging */
static void
exchange (GimpDrawable *drawable,
GimpDrawablePreview *preview)
exchange (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn srcPR, destPR;
guchar min_red, min_green, min_blue;
@ -661,8 +662,8 @@ exchange (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -765,7 +766,8 @@ exchange (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_region (preview, &destPR);
gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview),
&destPR);
}
else
{

View file

@ -553,7 +553,7 @@ static void
update_preview (GtkWidget *preview,
GtkWidget *size)
{
gauss (GIMP_DRAWABLE_PREVIEW (preview)->drawable,
gauss (gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview)),
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 0),
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 1),
bvals.method,
@ -1042,8 +1042,8 @@ gauss (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (GIMP_DRAWABLE_PREVIEW (preview),
preview_buffer2, width * bytes);
gimp_preview_draw_buffer (GIMP_PREVIEW (preview),
preview_buffer2, width * bytes);
g_free (preview_buffer1);
g_free (preview_buffer2);
}

View file

@ -482,8 +482,7 @@ grid (gint32 image_ID,
if (preview)
{
gimp_drawable_preview_draw_buffer (GIMP_DRAWABLE_PREVIEW (preview),
buffer, bytes * (sx2 - sx1));
gimp_preview_draw_buffer (preview, buffer, bytes * (sx2 - sx1));
g_free (buffer);
}
else

View file

@ -58,10 +58,10 @@ static void run (const gchar *name,
static void neon (GimpDrawable *drawable,
gdouble radius,
gdouble amount,
GtkWidget *preview);
GimpPreview *preview);
static gboolean neon_dialog (GimpDrawable *drawable);
static void neon_preview_update (GtkWidget *preview);
static void neon_preview_update (GimpPreview *preview);
/*
* Gaussian operator helper functions
@ -236,7 +236,7 @@ static void
neon (GimpDrawable *drawable,
gdouble radius,
gdouble amount,
GtkWidget *preview)
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
gint width, height;
@ -261,8 +261,8 @@ neon (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
}
@ -465,8 +465,7 @@ neon (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (GIMP_DRAWABLE_PREVIEW (preview),
preview_buffer2, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer2, width * bytes);
g_free (preview_buffer1);
g_free (preview_buffer2);
}
@ -750,7 +749,7 @@ neon_dialog (GimpDrawable *drawable)
}
static void
neon_preview_update (GtkWidget *preview)
neon_preview_update (GimpPreview *preview)
{
neon (GIMP_DRAWABLE_PREVIEW (preview)->drawable,
evals.radius,

View file

@ -71,12 +71,12 @@ static void run (const gchar *name,
GimpParam **return_vals);
static void noisify_func (const guchar *src,
guchar *dest,
gint bpp,
gpointer data);
static void noisify_func (const guchar *src,
guchar *dest,
gint bpp,
gpointer data);
static void noisify (GimpDrawablePreview *preview);
static void noisify (GimpPreview *preview);
static gdouble gauss (GRand *gr);
@ -272,25 +272,29 @@ noisify_func (const guchar *src,
}
static void
noisify (GimpDrawablePreview *preview)
noisify (GimpPreview *preview)
{
guchar *src, *dst;
GimpDrawable *drawable;
GimpPixelRgn src_rgn;
guchar *src, *dst;
gint i;
gint x1, y1;
gint width, height;
gint bpp;
GRand *gr = g_rand_new ();
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
bpp = preview->drawable->bpp;
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
bpp = drawable->bpp;
src = g_new (guchar, width * height * bpp);
dst = g_new (guchar, width * height * bpp);
gimp_pixel_rgn_init (&src_rgn, preview->drawable,
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, width, height,
FALSE, FALSE);
gimp_pixel_rgn_get_rect (&src_rgn, src, x1, y1, width, height);
@ -298,7 +302,7 @@ noisify (GimpDrawablePreview *preview)
for (i = 0; i < width * height; i++)
noisify_func (src + i * bpp, dst + i * bpp, bpp, gr);
gimp_drawable_preview_draw_buffer (preview, dst, width * bpp);
gimp_preview_draw_buffer (preview, dst, width * bpp);
g_free (src);
g_free (dst);

View file

@ -59,14 +59,14 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void oilify (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void oilify_rgb (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void oilify_intensity (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void oilify (GimpDrawable *drawable,
GimpPreview *preview);
static void oilify_rgb (GimpDrawable *drawable,
GimpPreview *preview);
static void oilify_intensity (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean oilify_dialog (GimpDrawable *drawable);
static gboolean oilify_dialog (GimpDrawable *drawable);
GimpPlugInInfo PLUG_IN_INFO =
@ -215,8 +215,8 @@ run (const gchar *name,
* at (x,y).
*/
static void
oilify_rgb (GimpDrawable *drawable,
GimpDrawablePreview *preview)
oilify_rgb (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
gint bytes;
@ -235,8 +235,8 @@ oilify_rgb (GimpDrawable *drawable,
/* get the selection bounds */
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -336,8 +336,8 @@ oilify_rgb (GimpDrawable *drawable,
* at (x,y). Histogram is based on intensity.
*/
static void
oilify_intensity (GimpDrawable *drawable,
GimpDrawablePreview *preview)
oilify_intensity (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
gint bytes;
@ -356,8 +356,8 @@ oilify_intensity (GimpDrawable *drawable,
/* get the selection bounds */
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -450,8 +450,8 @@ oilify_intensity (GimpDrawable *drawable,
}
static void
oilify (GimpDrawable *drawable,
GimpDrawablePreview *preview)
oilify (GimpDrawable *drawable,
GimpPreview *preview)
{
if (gimp_drawable_is_rgb (drawable->drawable_id) &&
(ovals.mode == MODE_INTEN))

View file

@ -62,15 +62,15 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void photocopy (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static gboolean photocopy_dialog (GimpDrawable *drawable);
static void photocopy (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean photocopy_dialog (GimpDrawable *drawable);
static gdouble compute_ramp (guchar *dest1,
guchar *dest2,
gint length,
gdouble pct_black,
gint under_threshold);
static gdouble compute_ramp (guchar *dest1,
guchar *dest2,
gint length,
gdouble pct_black,
gint under_threshold);
/*
* Gaussian blur helper functions
@ -266,8 +266,8 @@ run (const gchar *name,
* pixel intensity = white
*/
static void
photocopy (GimpDrawable *drawable,
GimpDrawablePreview *preview)
photocopy (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn src_rgn, dest_rgn;
GimpPixelRgn *pr;
@ -304,8 +304,8 @@ photocopy (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
}
else
{
@ -601,7 +601,8 @@ photocopy (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_region (preview, &dest_rgn);
gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview),
&dest_rgn);
}
else
{

View file

@ -460,9 +460,7 @@ end_plasma (GimpDrawable *drawable,
}
else
{
gimp_aspect_preview_draw_buffer (GIMP_ASPECT_PREVIEW (preview),
preview_buffer,
preview_width * bpp);
gimp_preview_draw_buffer (preview, preview_buffer, preview_width * bpp);
g_free (preview_buffer);
}

View file

@ -49,17 +49,18 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void sel_gauss (GimpDrawable *drawable,
gdouble radius,
gint maxdelta);
static gboolean sel_gauss_dialog (GimpDrawable *drawable);
static void preview_update (GimpPreview *preview);
static void sel_gauss (GimpDrawable *drawable,
gdouble radius,
gint maxdelta);
static gboolean sel_gauss_dialog (GimpDrawable *drawable);
static void preview_update (GimpDrawablePreview *preview);
GimpPlugInInfo PLUG_IN_INFO =
{
@ -449,9 +450,9 @@ sel_gauss (GimpDrawable *drawable,
}
static void
preview_update (GimpDrawablePreview *preview)
preview_update (GimpPreview *preview)
{
GimpDrawable *drawable = gimp_drawable_preview_get_drawable (preview);
GimpDrawable *drawable;
glong bytes;
gint x1, y1;
guchar *render_buffer; /* Buffer to hold rendered image */
@ -466,13 +467,15 @@ preview_update (GimpDrawablePreview *preview)
gdouble radius;
/* Get drawable info */
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
bytes = drawable->bpp;
/*
* Setup for filter...
*/
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
/* initialize pixel regions */
gimp_pixel_rgn_init (&srcPR, drawable,
@ -508,7 +511,7 @@ preview_update (GimpDrawablePreview *preview)
/*
* Draw the preview image on the screen...
*/
gimp_drawable_preview_draw_buffer (preview, render_buffer, width * bytes);
gimp_preview_draw_buffer (preview, render_buffer, width * bytes);
g_free (render_buffer);
}

View file

@ -53,11 +53,11 @@ static void run (const gchar *name,
GimpParam **returm_vals);
static void compute_luts (void);
static void sharpen (GimpDrawable *drawable);
static void sharpen (GimpDrawable *drawable);
static gboolean sharpen_dialog (GimpDrawable *drawable);
static gboolean sharpen_dialog (GimpDrawable *drawable);
static void preview_update (GimpDrawablePreview *preview);
static void preview_update (GimpPreview *preview);
typedef gint32 intneg;
typedef gint32 intpos;
@ -533,12 +533,13 @@ sharpen_dialog (GimpDrawable *drawable)
}
static void
preview_update (GimpDrawablePreview *preview)
preview_update (GimpPreview *preview)
{
GimpDrawable *drawable;
GimpPixelRgn src_rgn; /* Source image region */
guchar *src_ptr; /* Current source pixel */
guchar *dst_ptr; /* Current destination pixel */
intneg *neg_ptr; /* Current negative pixel */
guchar *src_ptr; /* Current source pixel */
guchar *dst_ptr; /* Current destination pixel */
intneg *neg_ptr; /* Current negative pixel */
gint i; /* Looping var */
gint y; /* Current location in image */
gint width; /* Byte width of the image */
@ -554,18 +555,20 @@ preview_update (GimpDrawablePreview *preview)
compute_luts();
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview),
&preview_width, &preview_height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &preview_width, &preview_height);
img_bpp = gimp_drawable_bpp (preview->drawable->drawable_id);
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
img_bpp = gimp_drawable_bpp (drawable->drawable_id);
preview_src = g_new (guchar, preview_width * preview_height * img_bpp);
preview_neg = g_new (intneg, preview_width * preview_height * img_bpp);
preview_dst = g_new (guchar, preview_width * preview_height * img_bpp);
gimp_pixel_rgn_init (&src_rgn, GIMP_DRAWABLE_PREVIEW (preview)->drawable,
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, preview_width, preview_height,
FALSE, FALSE);
@ -620,8 +623,7 @@ preview_update (GimpDrawablePreview *preview)
(*filter)(preview_width, src_ptr, dst_ptr, neg_ptr - width,
neg_ptr, neg_ptr + width);
gimp_drawable_preview_draw_buffer (preview,
preview_dst, preview_width * img_bpp);
gimp_preview_draw_buffer (preview, preview_dst, preview_width * img_bpp);
g_free (preview_src);
g_free (preview_neg);

View file

@ -59,8 +59,8 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void shift (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void shift (GimpDrawable *drawable,
GimpPreview *preview);
static gboolean shift_dialog (gint32 image_ID,
GimpDrawable *drawable);
@ -217,8 +217,8 @@ run (const gchar *name,
}
static void
shift (GimpDrawable *drawable,
GimpDrawablePreview *preview)
shift (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn dest_rgn;
gpointer pr;
@ -241,8 +241,8 @@ shift (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
}
else
{
@ -330,7 +330,8 @@ shift (GimpDrawable *drawable,
}
static gboolean
shift_dialog (gint32 image_ID, GimpDrawable *drawable)
shift_dialog (gint32 image_ID,
GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *main_vbox;

View file

@ -109,23 +109,23 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static void solid_noise (GimpDrawable *drawable,
GimpAspectPreview *preview);
static void solid_noise (GimpDrawable *drawable,
GimpPreview *preview);
static void solid_noise_init (void);
static gdouble plain_noise (gdouble x,
gdouble y,
guint s);
static gdouble noise (gdouble x,
gdouble y);
static gdouble plain_noise (gdouble x,
gdouble y,
guint s);
static gdouble noise (gdouble x,
gdouble y);
static gboolean solid_noise_dialog (GimpDrawable *drawable);
static void solid_noise_draw_one_tile (GimpPixelRgn *rgn,
gdouble width,
gdouble height,
gint xoffset,
gint yoffset,
gint chns,
gboolean has_alpha);
static gboolean solid_noise_dialog (GimpDrawable *drawable);
static void solid_noise_draw_one_tile (GimpPixelRgn *rgn,
gdouble width,
gdouble height,
gint xoffset,
gint yoffset,
gint chns,
gboolean has_alpha);
/*---- Variables ----*/
@ -302,8 +302,8 @@ run (const gchar *name,
static void
solid_noise (GimpDrawable *drawable,
GimpAspectPreview *preview)
solid_noise (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn dest_rgn;
gint bytes;
@ -318,7 +318,7 @@ solid_noise (GimpDrawable *drawable,
if (preview)
{
x1 = y1 = 0;
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_size (preview, &width, &height);
x2 = width;
y2 = height;
}
@ -385,7 +385,7 @@ solid_noise (GimpDrawable *drawable,
/* Update the drawable */
if (preview)
{
gimp_aspect_preview_draw_buffer (preview, dest_rgn.data, rowstride);
gimp_preview_draw_buffer (preview, dest_rgn.data, rowstride);
g_free (dest_rgn.data);
}
else

View file

@ -453,8 +453,7 @@ sobel (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (GIMP_DRAWABLE_PREVIEW (preview),
preview_buffer, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer, width * bytes);
g_free (preview_buffer);
}
else

View file

@ -288,25 +288,28 @@ static void
spread_preview_update (GimpPreview *preview,
GtkWidget *size)
{
GimpDrawablePreview *drawable_preview = GIMP_DRAWABLE_PREVIEW (preview);
SpreadParam_t param;
gint x, y, bpp;
guchar *buffer, *dest;
gint x_off, y_off;
gint width, height;
GimpDrawable *drawable;
SpreadParam_t param;
gint x, y, bpp;
guchar *buffer, *dest;
gint x_off, y_off;
gint width, height;
param.pft = gimp_pixel_fetcher_new (drawable_preview->drawable, FALSE);
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
param.pft = gimp_pixel_fetcher_new (drawable, FALSE);
param.gr = g_rand_new ();
param.x_amount = (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size),
0) + 1) / 2;
param.y_amount = (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size),
1) + 1) / 2;
param.width = drawable_preview->drawable->width;
param.height = drawable_preview->drawable->height;
param.width = drawable->width;
param.height = drawable->height;
gimp_preview_get_size (preview, &width, &height);
bpp = drawable_preview->drawable->bpp;
bpp = drawable->bpp;
dest = buffer = g_new (guchar, width * height * bpp);
gimp_preview_get_position (preview, &x_off, &y_off);
@ -318,7 +321,7 @@ spread_preview_update (GimpPreview *preview,
dest += bpp;
}
gimp_drawable_preview_draw_buffer (drawable_preview, buffer, width * bpp);
gimp_preview_draw_buffer (preview, buffer, width * bpp);
g_free (buffer);
g_rand_free (param.gr);

View file

@ -1097,9 +1097,9 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean struc_dialog (GimpDrawable *drawable);
static void strucpi (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static gboolean struc_dialog (GimpDrawable *drawable);
static void strucpi (GimpDrawable *drawable,
GimpPreview *preview);
/* --- Variables --- */
@ -1337,8 +1337,8 @@ struc_dialog (GimpDrawable *drawable)
/* Filter function */
static void
strucpi (GimpDrawable *drawable,
GimpDrawablePreview *preview)
strucpi (GimpDrawable *drawable,
GimpPreview *preview)
{
GimpPixelRgn srcPR, destPR;
gint width, height;
@ -1353,8 +1353,8 @@ strucpi (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -1390,7 +1390,8 @@ strucpi (GimpDrawable *drawable,
}
else
{
gimp_pixel_rgn_init (&destPR, drawable, x1, y1, width, height, TRUE, TRUE);
gimp_pixel_rgn_init (&destPR,
drawable, x1, y1, width, height, TRUE, TRUE);
}
mult = (gfloat) svals.depth * 0.25;
@ -1494,8 +1495,7 @@ strucpi (GimpDrawable *drawable,
if (preview)
{
gimp_drawable_preview_draw_buffer (preview,
preview_buffer, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer, width * bytes);
g_free (preview_buffer);
}
else

View file

@ -77,34 +77,34 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static gint dialog_box (GimpDrawable *drawable);
static gint dialog_box (GimpDrawable *drawable);
static gint render_effect (GimpDrawable *drawable,
GimpDrawablePreview *preview);
static void render_wind (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpDrawablePreview *preview);
static void render_blast (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpDrawablePreview *preview);
static gint render_blast_row (guchar *buffer,
gint bytes,
gint lpi,
gint threshold,
gint strength,
edge_t edge);
static void render_wind_row (guchar *sb,
gint bytes,
gint lpi,
gint threshold,
gint strength,
edge_t edge);
static gint render_effect (GimpDrawable *drawable,
GimpPreview *preview);
static void render_wind (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpPreview *preview);
static void render_blast (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpPreview *preview);
static gint render_blast_row (guchar *buffer,
gint bytes,
gint lpi,
gint threshold,
gint strength,
edge_t edge);
static void render_wind_row (guchar *sb,
gint bytes,
gint lpi,
gint threshold,
gint strength,
edge_t edge);
static void get_derivative (guchar *pixel_R1,
guchar *pixel_R2,
@ -266,8 +266,8 @@ run (const gchar *name,
}
static gint
render_effect (GimpDrawable *drawable,
GimpDrawablePreview *preview)
render_effect (GimpDrawable *drawable,
GimpPreview *preview)
{
if (config.alg == RENDER_WIND)
{
@ -283,12 +283,12 @@ render_effect (GimpDrawable *drawable,
}
static void
render_blast (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpDrawablePreview *preview)
render_blast (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpPreview *preview)
{
gint x1, x2, y1, y2;
gint width;
@ -303,8 +303,8 @@ render_blast (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -392,8 +392,7 @@ render_blast (GimpDrawable *drawable,
/* update the region */
if (preview)
{
gimp_drawable_preview_draw_buffer (preview,
preview_buffer, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer, width * bytes);
g_free (preview_buffer);
}
else
@ -405,12 +404,12 @@ render_blast (GimpDrawable *drawable,
}
static void
render_wind (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpDrawablePreview *preview)
render_wind (GimpDrawable *drawable,
gint threshold,
gint strength,
direction_t direction,
edge_t edge,
GimpPreview *preview)
{
GimpPixelRgn src_region, dest_region;
gint width;
@ -427,8 +426,8 @@ render_wind (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
@ -483,8 +482,7 @@ render_wind (GimpDrawable *drawable,
/* update the region */
if (preview)
{
gimp_drawable_preview_draw_buffer (preview,
preview_buffer, width * bytes);
gimp_preview_draw_buffer (preview, preview_buffer, width * bytes);
g_free (preview_buffer);
}
else