diff --git a/ChangeLog b/ChangeLog index 7f5ffd31de..c3a5828291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2003-12-09 DindinX + + * libgimp/gimpmiscui.c: + * libgimp/gimpmiscui.h: + * plug-ins/common/AlienMap.c: + * plug-ins/common/AlienMap2.c: + * plug-ins/common/blinds.c: + * plug-ins/common/flarefx.c: + * plug-ins/common/glasstile.c: + * plug-ins/common/grid.c: + * plug-ins/common/illusion.c: + * plug-ins/common/jigsaw.c: + * plug-ins/common/max_rgb.c: + * plug-ins/common/nlfilt.c: + * plug-ins/common/noisify.c: + * plug-ins/common/nova.c: + * plug-ins/common/plasma.c: + * plug-ins/common/polar.c: + * plug-ins/common/waves.c: + * plug-ins/common/wind.c: Rename GimpFixmePreview into + GimpOldPreview. This is just a prelimirary stuff, before moving it + into its own, no_inst library. + 2003-12-09 DindinX * plug-ins/common/vpropagate.c (vpropagate_dialog): diff --git a/libgimp/gimpmiscui.c b/libgimp/gimpmiscui.c index b55380472f..5e3ddec60c 100644 --- a/libgimp/gimpmiscui.c +++ b/libgimp/gimpmiscui.c @@ -39,11 +39,11 @@ #include "libgimp-intl.h" -#define PREVIEW_SIZE 128 -#define PREVIEW_BPP 3 +#define PREVIEW_SIZE 128 +#define PREVIEW_BPP 3 static void -gimp_fixme_preview_put_in_frame (GimpFixMePreview* preview) +gimp_old_preview_put_in_frame (GimpOldPreview* preview) { GtkWidget *frame, *abox; @@ -63,26 +63,26 @@ gimp_fixme_preview_put_in_frame (GimpFixMePreview* preview) gtk_container_add (GTK_CONTAINER (frame), preview->widget); } -GimpFixMePreview* -gimp_fixme_preview_new (GimpDrawable *drawable, - gboolean has_frame) +GimpOldPreview* +gimp_old_preview_new (GimpDrawable *drawable, + gboolean has_frame) { - GimpFixMePreview *preview = g_new0 (GimpFixMePreview, 1); + GimpOldPreview *preview = g_new0 (GimpOldPreview, 1); preview->widget = gtk_preview_new (GTK_PREVIEW_COLOR); preview->is_gray = FALSE; if (drawable) - gimp_fixme_preview_fill_with_thumb (preview, drawable->drawable_id); + gimp_old_preview_fill_with_thumb (preview, drawable->drawable_id); if (has_frame) - gimp_fixme_preview_put_in_frame (preview); + gimp_old_preview_put_in_frame (preview); return preview; } void -gimp_fixme_preview_free (GimpFixMePreview *preview) +gimp_old_preview_free (GimpOldPreview *preview) { g_free (preview->cmap); g_free (preview->even); @@ -91,15 +91,15 @@ gimp_fixme_preview_free (GimpFixMePreview *preview) g_free (preview); } -GimpFixMePreview* -gimp_fixme_preview_new2 (GimpImageType drawable_type, - gboolean has_frame) +GimpOldPreview* +gimp_old_preview_new2 (GimpImageType drawable_type, + gboolean has_frame) { - GimpFixMePreview *preview; - guchar *buf = NULL; - gint y; + GimpOldPreview *preview; + guchar *buf = NULL; + gint y; - preview = g_new0 (GimpFixMePreview, 1); + preview = g_new0 (GimpOldPreview, 1); switch (drawable_type) { @@ -126,12 +126,12 @@ gimp_fixme_preview_new2 (GimpImageType drawable_type, for (y = 0; y < PREVIEW_SIZE; y++) gtk_preview_draw_row (GTK_PREVIEW (preview->widget), buf, 0, y, - PREVIEW_SIZE); + PREVIEW_SIZE); g_free (buf); if (has_frame) - gimp_fixme_preview_put_in_frame (preview); + gimp_old_preview_put_in_frame (preview); preview->buffer = GTK_PREVIEW (preview->widget)->buffer; preview->width = GTK_PREVIEW (preview->widget)->buffer_width; @@ -142,10 +142,10 @@ gimp_fixme_preview_new2 (GimpImageType drawable_type, } void -gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, - gint x, - gint y, - const guchar *pixel) +gimp_old_preview_put_pixel (GimpOldPreview *preview, + gint x, + gint y, + const guchar *pixel) { guchar *dest; @@ -169,10 +169,10 @@ gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, } void -gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, - gint x, - gint y, - guchar *pixel) +gimp_old_preview_get_pixel (GimpOldPreview *preview, + gint x, + gint y, + guchar *pixel) { const guchar *src; @@ -196,10 +196,10 @@ gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, } void -gimp_fixme_preview_do_row (GimpFixMePreview *preview, - gint row, - gint width, - const guchar *src) +gimp_old_preview_do_row (GimpOldPreview *preview, + gint row, + gint width, + const guchar *src) { gint x; guchar *p0 = preview->even; @@ -213,50 +213,50 @@ gimp_fixme_preview_do_row (GimpFixMePreview *preview, switch (bpp) { case 4: - r = src[x * 4 + 0]; - g = src[x * 4 + 1]; - b = src[x * 4 + 2]; - a = src[x * 4 + 3]; + r = src[x * 4 + 0]; + g = src[x * 4 + 1]; + b = src[x * 4 + 2]; + a = src[x * 4 + 3]; break; case 3: - r = src[x*3 + 0]; - g = src[x*3 + 1]; - b = src[x*3 + 2]; - a = 255; + r = src[x*3 + 0]; + g = src[x*3 + 1]; + b = src[x*3 + 2]; + a = 255; break; default: - if (preview->cmap) - { - gint index = MIN (src[x*bpp], preview->ncolors - 1); + if (preview->cmap) + { + gint index = MIN (src[x*bpp], preview->ncolors - 1); - r = preview->cmap[index * 3 + 0]; - g = preview->cmap[index * 3 + 1]; - b = preview->cmap[index * 3 + 2]; - } - else - { - g = b = r = src[x * bpp + 0]; - } + r = preview->cmap[index * 3 + 0]; + g = preview->cmap[index * 3 + 1]; + b = preview->cmap[index * 3 + 2]; + } + else + { + g = b = r = src[x * bpp + 0]; + } - if (bpp == 2) - a = src[x*2 + 1]; - else - a = 255; + if (bpp == 2) + a = src[x*2 + 1]; + else + a = 255; break; } if ((x / GIMP_CHECK_SIZE_SM) & 1) - { - c0 = GIMP_CHECK_LIGHT * 255; - c1 = GIMP_CHECK_DARK * 255; - } + { + c0 = GIMP_CHECK_LIGHT * 255; + c1 = GIMP_CHECK_DARK * 255; + } else - { - c0 = GIMP_CHECK_DARK * 255; - c1 = GIMP_CHECK_LIGHT * 255; - } + { + c0 = GIMP_CHECK_DARK * 255; + c1 = GIMP_CHECK_LIGHT * 255; + } *p0++ = c0 + (r - c0) * a / 255; *p0++ = c0 + (g - c0) * a / 255; @@ -280,9 +280,9 @@ gimp_fixme_preview_do_row (GimpFixMePreview *preview, } void -gimp_fixme_preview_update (GimpFixMePreview *preview, - GimpFixeMePreviewFunc func, - gpointer data) +gimp_old_preview_update (GimpOldPreview *preview, + GimpOldPreviewFunc func, + gpointer data) { guchar *buffer; gint x, y; @@ -297,14 +297,14 @@ gimp_fixme_preview_update (GimpFixMePreview *preview, guchar *dest = buffer; for (x = 0; x < preview->width; x++) - { - func (src, dest, bpp, data); + { + func (src, dest, bpp, data); - src += bpp; - dest += bpp; - } + src += bpp; + dest += bpp; + } - gimp_fixme_preview_do_row (preview, y, preview->width, buffer); + gimp_old_preview_do_row (preview, y, preview->width, buffer); } gtk_widget_queue_draw (preview->widget); @@ -313,8 +313,8 @@ gimp_fixme_preview_update (GimpFixMePreview *preview, } void -gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, - gint32 drawable_ID) +gimp_old_preview_fill_with_thumb (GimpOldPreview *preview, + gint32 drawable_ID) { const guchar *src; gint bpp; @@ -354,7 +354,7 @@ gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, for (y = 0; y < height; y++) { - gimp_fixme_preview_do_row (preview, y, width, src); + gimp_old_preview_do_row (preview, y, width, src); src += width * bpp; } @@ -364,8 +364,8 @@ gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, } void -gimp_fixme_preview_fill (GimpFixMePreview *preview, - GimpDrawable *drawable) +gimp_old_preview_fill (GimpOldPreview *preview, + GimpDrawable *drawable) { GimpPixelRgn srcPR; gint width; @@ -416,8 +416,8 @@ gimp_fixme_preview_fill (GimpFixMePreview *preview, for (y = 0; y < height; y++) { - gimp_fixme_preview_do_row (preview, y, width, - preview->cache + (y * width * bpp)); + gimp_old_preview_do_row (preview, y, width, + preview->cache + (y * width * bpp)); } preview->buffer = GTK_PREVIEW (preview->widget)->buffer; @@ -428,8 +428,8 @@ gimp_fixme_preview_fill (GimpFixMePreview *preview, } void -gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, - GimpDrawable *drawable) +gimp_old_preview_fill_scaled (GimpOldPreview *preview, + GimpDrawable *drawable) { gint bpp; gint x1, y1, x2, y2; @@ -493,12 +493,12 @@ gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, dest = preview->cache + y * preview->rowstride; px = x1; for (x = 0; x < width; x++) - { - gimp_pixel_fetcher_get_pixel (pft, (gint) px, (gint) py, dest); - dest += bpp; - px += dx; - } - gimp_fixme_preview_do_row (preview, y, width, dest); + { + gimp_pixel_fetcher_get_pixel (pft, (gint) px, (gint) py, dest); + dest += bpp; + px += dx; + } + gimp_old_preview_do_row (preview, y, width, dest); py += dy; } gimp_pixel_fetcher_destroy (pft); @@ -534,9 +534,9 @@ gimp_plug_in_get_path (const gchar *path_name, g_free (full_path); g_message (_("No %s in gimprc:\n" - "You need to add an entry like\n" - "(%s \"%s\")\n" - "to your %s file."), + "You need to add an entry like\n" + "(%s \"%s\")\n" + "to your %s file."), path_name, path_name, esc_path, gimprc); g_free (gimprc); diff --git a/libgimp/gimpmiscui.h b/libgimp/gimpmiscui.h index 36c8741696..9fccc46b35 100644 --- a/libgimp/gimpmiscui.h +++ b/libgimp/gimpmiscui.h @@ -56,43 +56,44 @@ typedef struct gdouble scale_x; gdouble scale_y; gboolean is_gray; -} GimpFixMePreview; +} GimpOldPreview; -typedef void (*GimpFixeMePreviewFunc) (const guchar *src, - guchar *dest, - gint bpp, - gpointer data); +typedef void (*GimpOldPreviewFunc) (const guchar *src, + guchar *dest, + gint bpp, + gpointer data); -GimpFixMePreview * gimp_fixme_preview_new (GimpDrawable *drawable, - gboolean has_frame); -GimpFixMePreview * gimp_fixme_preview_new2 (GimpImageType drawable_type, - gboolean has_frame); -void gimp_fixme_preview_free (GimpFixMePreview *preview); +GimpOldPreview * gimp_old_preview_new (GimpDrawable *drawable, + gboolean has_frame); +GimpOldPreview * gimp_old_preview_new2 (GimpImageType drawable_type, + gboolean has_frame); +void gimp_old_preview_free (GimpOldPreview *preview); -void gimp_fixme_preview_update (GimpFixMePreview *preview, - GimpFixeMePreviewFunc func, - gpointer data); +void gimp_old_preview_update (GimpOldPreview *preview, + GimpOldPreviewFunc func, + gpointer data); -void gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, - gint32 drawable_ID); -void gimp_fixme_preview_fill (GimpFixMePreview *preview, - GimpDrawable *drawable); -void gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, - GimpDrawable *drawable); -void gimp_fixme_preview_do_row (GimpFixMePreview *preview, - gint row, - gint width, - const guchar *src); +void gimp_old_preview_fill_with_thumb (GimpOldPreview *preview, + gint32 drawable_ID); +void gimp_old_preview_fill (GimpOldPreview *preview, + GimpDrawable *drawable); +void gimp_old_preview_fill_scaled (GimpOldPreview *preview, + GimpDrawable *drawable); -void gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, - gint x, - gint y, - const guchar *pixel); -void gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, - gint x, - gint y, - guchar *pixel); +void gimp_old_preview_do_row (GimpOldPreview *preview, + gint row, + gint width, + const guchar *src); + +void gimp_old_preview_put_pixel (GimpOldPreview *preview, + gint x, + gint y, + const guchar *pixel); +void gimp_old_preview_get_pixel (GimpOldPreview *preview, + gint x, + gint y, + guchar *pixel); gchar * gimp_plug_in_get_path (const gchar *path_name, const gchar *dir_name); diff --git a/plug-ins/common/AlienMap.c b/plug-ins/common/AlienMap.c index 38b5ba924c..e877c98ad8 100644 --- a/plug-ins/common/AlienMap.c +++ b/plug-ins/common/AlienMap.c @@ -886,8 +886,8 @@ static void alienmap_logo_dialog (GtkWidget *parent); /***** Variables *****/ -static GimpRunMode run_mode; -static GimpFixMePreview *preview; +static GimpRunMode run_mode; +static GimpOldPreview *preview; GimpPlugInInfo PLUG_IN_INFO = { @@ -1172,8 +1172,8 @@ alienmap_dialog (void) gtk_table_attach (GTK_TABLE (top_table), frame, 0, 1, 0, 1, 0, 0, 0, 0); gtk_widget_show (frame); - preview = gimp_fixme_preview_new (NULL, FALSE); - gimp_fixme_preview_fill_scaled (preview, drawable); + preview = gimp_old_preview_new (NULL, FALSE); + gimp_old_preview_fill_scaled (preview, drawable); gtk_container_add (GTK_CONTAINER (frame), preview->widget); gtk_widget_show (preview->widget); @@ -1294,7 +1294,7 @@ alienmap_dialog (void) static void dialog_update_preview (void) { - gimp_fixme_preview_update (preview, alienmap_func, NULL); + gimp_old_preview_update (preview, alienmap_func, NULL); } static void diff --git a/plug-ins/common/AlienMap2.c b/plug-ins/common/AlienMap2.c index 6eb6ea841c..00f269db35 100644 --- a/plug-ins/common/AlienMap2.c +++ b/plug-ins/common/AlienMap2.c @@ -886,8 +886,8 @@ static void alienmap2_logo_dialog (GtkWidget *parent); /***** Variables *****/ -static GimpRunMode run_mode; -static GimpFixMePreview *preview; +static GimpRunMode run_mode; +static GimpOldPreview *preview; GimpPlugInInfo PLUG_IN_INFO = { @@ -1176,8 +1176,8 @@ alienmap2_dialog (void) gtk_table_attach (GTK_TABLE (top_table), frame, 0, 1, 0, 1, 0, 0, 0, 0); gtk_widget_show (frame); - preview = gimp_fixme_preview_new (NULL, FALSE); - gimp_fixme_preview_fill_scaled (preview, drawable); + preview = gimp_old_preview_new (NULL, FALSE); + gimp_old_preview_fill_scaled (preview, drawable); gtk_container_add (GTK_CONTAINER (frame), preview->widget); gtk_widget_show (preview->widget); @@ -1320,7 +1320,7 @@ alienmap2_dialog (void) static void dialog_update_preview (void) { - gimp_fixme_preview_update (preview, alienmap2_func, NULL); + gimp_old_preview_update (preview, alienmap2_func, NULL); } static void diff --git a/plug-ins/common/blinds.c b/plug-ins/common/blinds.c index a1b339278f..3cc6a83bea 100644 --- a/plug-ins/common/blinds.c +++ b/plug-ins/common/blinds.c @@ -80,7 +80,7 @@ typedef struct data gint bg_trans; } BlindVals; -static GimpFixMePreview *preview; +static GimpOldPreview *preview; typedef struct { @@ -102,21 +102,21 @@ static GimpDrawable *blindsdrawable; static void query (void); static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static gint blinds_dialog (void); static void blinds_scale_update (GtkAdjustment *adjustment, - gint *size_val); + gint *size_val); static void blinds_radio_update (GtkWidget *widget, - gpointer data); + gpointer data); static void blinds_button_update (GtkWidget *widget, - gpointer data); + gpointer data); static void dialog_update_preview (void); -static void cache_preview (void); +static void cache_preview (void); static void apply_blinds (void); GimpPlugInInfo PLUG_IN_INFO = @@ -156,18 +156,18 @@ query (void) }; gimp_install_procedure ("plug_in_blinds", - "Adds a blinds effect to the image. Rather like " - "putting the image on a set of window blinds and " - "the closing or opening the blinds", - "More here later", - "Andy Thomas", - "Andy Thomas", - "1997", - N_("/Filters/Distorts/_Blinds..."), - "RGB*, GRAY*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Adds a blinds effect to the image. Rather like " + "putting the image on a set of window blinds and " + "the closing or opening the blinds", + "More here later", + "Andy Thomas", + "Andy Thomas", + "1997", + N_("/Filters/Distorts/_Blinds..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -200,22 +200,22 @@ run (const gchar *name, case GIMP_RUN_INTERACTIVE: gimp_get_data ("plug_in_blinds", &bvals); if (! blinds_dialog()) - { - gimp_drawable_detach (drawable); - return; - } + { + gimp_drawable_detach (drawable); + return; + } break; case GIMP_RUN_NONINTERACTIVE: if (nparams != 7) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; if (status == GIMP_PDB_SUCCESS) - { - bvals.angledsp = param[3].data.d_int32; - bvals.numsegs = param[4].data.d_int32; - bvals.orientation = param[5].data.d_int32; - bvals.bg_trans = param[6].data.d_int32; - } + { + bvals.angledsp = param[3].data.d_int32; + bvals.numsegs = param[4].data.d_int32; + bvals.orientation = param[5].data.d_int32; + bvals.bg_trans = param[6].data.d_int32; + } break; case GIMP_RUN_WITH_LAST_VALS: @@ -234,10 +234,10 @@ run (const gchar *name, apply_blinds (); if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); + gimp_displays_flush (); if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_set_data ("plug_in_blinds", &bvals, sizeof (BlindVals)); + gimp_set_data ("plug_in_blinds", &bvals, sizeof (BlindVals)); } else { @@ -271,12 +271,12 @@ blinds_dialog (void) dlg = gimp_dialog_new (_("Blinds"), "blinds", NULL, 0, - gimp_standard_help_func, "filters/blinds.html", + gimp_standard_help_func, "filters/blinds.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); @@ -287,8 +287,8 @@ blinds_dialog (void) gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - preview = gimp_fixme_preview_new (NULL, TRUE); - gimp_fixme_preview_fill_scaled (preview, blindsdrawable); + preview = gimp_old_preview_new (NULL, TRUE); + gimp_old_preview_fill_scaled (preview, blindsdrawable); gtk_box_pack_start (GTK_BOX (hbox), preview->frame, FALSE, FALSE, 0); gtk_widget_show (preview->widget); @@ -298,13 +298,13 @@ blinds_dialog (void) frame = gimp_int_radio_group_new (TRUE, _("Orientation"), - G_CALLBACK (blinds_radio_update), - &bvals.orientation, bvals.orientation, + G_CALLBACK (blinds_radio_update), + &bvals.orientation, bvals.orientation, - _("_Horizontal"), HORIZONTAL, NULL, - _("_Vertical"), VERTICAL, NULL, + _("_Horizontal"), HORIZONTAL, NULL, + _("_Vertical"), VERTICAL, NULL, - NULL); + NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); @@ -346,22 +346,22 @@ blinds_dialog (void) gtk_widget_show (table); size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("_Displacement:"), SCALE_WIDTH, 0, - bvals.angledsp, 1, 90, 1, 15, 0, - TRUE, 0, 0, - NULL, NULL); + _("_Displacement:"), SCALE_WIDTH, 0, + bvals.angledsp, 1, 90, 1, 15, 0, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (size_data, "value_changed", G_CALLBACK (blinds_scale_update), &bvals.angledsp); size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("_Num Segments:"), SCALE_WIDTH, 0, - bvals.numsegs, 1, MAX_FANS, 1, 2, 0, - TRUE, 0, 0, - NULL, NULL); + _("_Num Segments:"), SCALE_WIDTH, 0, + bvals.numsegs, 1, MAX_FANS, 1, 2, 0, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (size_data, "value_changed", - G_CALLBACK (blinds_scale_update), - &bvals.numsegs); + G_CALLBACK (blinds_scale_update), + &bvals.numsegs); gtk_widget_show (dlg); @@ -376,7 +376,7 @@ blinds_dialog (void) static void blinds_radio_update (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_radio_button_update (widget, data); @@ -386,7 +386,7 @@ blinds_radio_update (GtkWidget *widget, static void blinds_button_update (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_toggle_button_update (widget, data); @@ -395,7 +395,7 @@ blinds_button_update (GtkWidget *widget, static void blinds_scale_update (GtkAdjustment *adjustment, - gint *value) + gint *value) { gimp_int_adjustment_update (adjustment, value); @@ -422,10 +422,10 @@ cache_preview (void) static void blindsapply (guchar *srow, - guchar *drow, - gint width, - gint bpp, - guchar *bg) + guchar *drow, + gint width, + gint bpp, + guchar *bg) { guchar *src; guchar *dst; @@ -449,9 +449,9 @@ blindsapply (guchar *srow, dst = &drow[i*bpp]; for (j = 0 ; j < bpp; j++) - { - dst[j] = bg[j]; - } + { + dst[j] = bg[j]; + } } /* Apply it */ @@ -479,9 +479,9 @@ blindsapply (guchar *srow, /* Copy pixels across */ for (j = 0 ; j < bpp; j++) - { - dst[j] = src[j]; - } + { + dst[j] = src[j]; + } } /* Disp for each point */ @@ -495,31 +495,31 @@ blindsapply (guchar *srow, int fw; for (i = 0 ; i < (fanwidths[k]/2) ; i++) - { - /* Copy pixels across of left half of fan */ - fw = fanwidths[k] / 2; - dx = (int) (ang * ((double) (fw - (double)(i % fw)))); + { + /* Copy pixels across of left half of fan */ + fw = fanwidths[k] / 2; + dx = (int) (ang * ((double) (fw - (double)(i % fw)))); - src = &srow[(available + i) * bpp]; - dst = &drow[(available + i + dx) * bpp]; + src = &srow[(available + i) * bpp]; + dst = &drow[(available + i + dx) * bpp]; - for (j = 0; j < bpp; j++) - { - dst[j] = src[j]; - } + for (j = 0; j < bpp; j++) + { + dst[j] = src[j]; + } - /* Right side */ - j = i + 1; - src = &srow[(available + fanwidths[k] - j - - (fanwidths[k] % 2)) * bpp]; - dst = &drow[(available + fanwidths[k] - j - - (fanwidths[k] % 2) - dx) * bpp]; + /* Right side */ + j = i + 1; + src = &srow[(available + fanwidths[k] - j + - (fanwidths[k] % 2)) * bpp]; + dst = &drow[(available + fanwidths[k] - j + - (fanwidths[k] % 2) - dx) * bpp]; - for (j = 0; j < bpp; j++) - { - dst[j] = src[j]; - } - } + for (j = 0; j < bpp; j++) + { + dst[j] = src[j]; + } + } available += fanwidths[k]; } @@ -541,11 +541,11 @@ dialog_update_preview (void) if (bvals.orientation) { for (y = 0; y < preview->height; y++) - { - blindsapply (p, buffer, preview->width, bint.img_bpp, bg); - gimp_fixme_preview_do_row (preview, y, preview->width, buffer); - p += preview->width * bint.img_bpp; - } + { + blindsapply (p, buffer, preview->width, bint.img_bpp, bg); + gimp_old_preview_do_row (preview, y, preview->width, buffer); + p += preview->width * bint.img_bpp; + } } else { @@ -561,22 +561,22 @@ dialog_update_preview (void) /* Fill in with background color ? */ for (i = 0 ; i < preview->width ; i++) - { - gint j; - gint bd = bint.img_bpp; - guchar *dst; - dst = &buffer[i * bd]; + { + gint j; + gint bd = bint.img_bpp; + guchar *dst; + dst = &buffer[i * bd]; - for (j = 0 ; j < bd; j++) - { - dst[j] = bg[j]; - } - } + for (j = 0 ; j < bd; j++) + { + dst[j] = bg[j]; + } + } for ( y = 0 ; y < preview->height; y++) - { - sr[y] = y+1; - } + { + sr[y] = y+1; + } /* Bit of a fiddle since blindsapply really works on an image * row not a set of bytes. - preview can't be > 255 @@ -585,21 +585,21 @@ dialog_update_preview (void) blindsapply (sr, dr, preview->height, 1, dummybg); for (y = 0; y < preview->height; y++) - { - if (dr[y] == 0) - { - /* Draw background line */ - p = buffer; - } - else - { - /* Draw line from src */ - p = preview->cache + - (preview->width * bint.img_bpp * (dr[y] - 1)); - } + { + if (dr[y] == 0) + { + /* Draw background line */ + p = buffer; + } + else + { + /* Draw line from src */ + p = preview->cache + + (preview->width * bint.img_bpp * (dr[y] - 1)); + } - gimp_fixme_preview_do_row (preview, y, preview->width, p); - } + gimp_old_preview_do_row (preview, y, preview->width, p); + } g_free (sr); g_free (dr); } @@ -631,15 +631,15 @@ apply_blinds (void) gimp_get_bg_guchar (blindsdrawable, bvals.bg_trans, bg); gimp_drawable_mask_bounds (blindsdrawable->drawable_id, &sel_x1, &sel_y1, - &sel_x2, &sel_y2); + &sel_x2, &sel_y2); sel_width = sel_x2 - sel_x1; sel_height = sel_y2 - sel_y1; gimp_pixel_rgn_init (&src_rgn, blindsdrawable, - sel_x1, sel_y1, sel_width, sel_height, FALSE, FALSE); + sel_x1, sel_y1, sel_width, sel_height, FALSE, FALSE); gimp_pixel_rgn_init (&des_rgn, blindsdrawable, - sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE); + sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE); src_rows = g_new (guchar, MAX (sel_width, sel_height) * 4 * STEP); des_rows = g_new (guchar, MAX (sel_width, sel_height) * 4 * STEP); @@ -647,37 +647,37 @@ apply_blinds (void) if (bvals.orientation) { for (y = 0; y < sel_height; y += STEP) - { - int rr; - int step; + { + int rr; + int step; - if((y + STEP) > sel_height) - step = sel_height - y; - else - step = STEP; + if((y + STEP) > sel_height) + step = sel_height - y; + else + step = STEP; - gimp_pixel_rgn_get_rect (&src_rgn, - src_rows, - sel_x1, - sel_y1 + y, - sel_width, - step); + gimp_pixel_rgn_get_rect (&src_rgn, + src_rows, + sel_x1, + sel_y1 + y, + sel_width, + step); - /* OK I could make this better */ - for (rr = 0; rr < STEP; rr++) - blindsapply (src_rows + (sel_width * rr * src_rgn.bpp), - des_rows + (sel_width * rr * src_rgn.bpp), - sel_width, src_rgn.bpp, bg); + /* OK I could make this better */ + for (rr = 0; rr < STEP; rr++) + blindsapply (src_rows + (sel_width * rr * src_rgn.bpp), + des_rows + (sel_width * rr * src_rgn.bpp), + sel_width, src_rgn.bpp, bg); - gimp_pixel_rgn_set_rect (&des_rgn, - des_rows, - sel_x1, - sel_y1 + y, - sel_width, - step); + gimp_pixel_rgn_set_rect (&des_rgn, + des_rows, + sel_x1, + sel_y1 + y, + sel_width, + step); - gimp_progress_update ((double) y / (double) sel_height); - } + gimp_progress_update ((double) y / (double) sel_height); + } } else { @@ -695,74 +695,74 @@ apply_blinds (void) memset (dummybg, 0, 4); memset (dr, 0, sel_height * 4); /* all dr rows are background rows */ for (y = 0; y < sel_height; y++) - { - sr[y] = y+1; - } + { + sr[y] = y+1; + } /* Hmmm. does this work portably? */ /* This "swaps the intergers around that are held in in the * sr & dr arrays. */ blindsapply ((guchar *) sr, (guchar *) dr, - sel_height, sizeof (gint), dummybg); + sel_height, sizeof (gint), dummybg); /* Fill in with background color ? */ for (i = 0 ; i < STEP ; i++) - { - int j; - guchar *bgdst; - bgdst = &dst[i * src_rgn.bpp]; + { + int j; + guchar *bgdst; + bgdst = &dst[i * src_rgn.bpp]; - for (j = 0 ; j < src_rgn.bpp; j++) - { - bgdst[j] = bg[j]; - } - } + for (j = 0 ; j < src_rgn.bpp; j++) + { + bgdst[j] = bg[j]; + } + } for (x = 0; x < sel_width; x += STEP) - { - int rr; - int step; - guchar *p; + { + int rr; + int step; + guchar *p; - if((x + STEP) > sel_width) - step = sel_width - x; - else - step = STEP; + if((x + STEP) > sel_width) + step = sel_width - x; + else + step = STEP; - gimp_pixel_rgn_get_rect (&src_rgn, - src_rows, - sel_x1 + x, - sel_y1, - step, - sel_height); + gimp_pixel_rgn_get_rect (&src_rgn, + src_rows, + sel_x1 + x, + sel_y1, + step, + sel_height); - /* OK I could make this better */ - for (rr = 0; rr < sel_height; rr++) - { - if(dr[rr] == 0) - { - /* Draw background line */ - p = dst; - } - else - { - /* Draw line from src */ - p = src_rows + (step * src_rgn.bpp * (dr[rr] - 1)); - } - memcpy (des_rows + (rr * step * src_rgn.bpp), p, - step * src_rgn.bpp); - } + /* OK I could make this better */ + for (rr = 0; rr < sel_height; rr++) + { + if(dr[rr] == 0) + { + /* Draw background line */ + p = dst; + } + else + { + /* Draw line from src */ + p = src_rows + (step * src_rgn.bpp * (dr[rr] - 1)); + } + memcpy (des_rows + (rr * step * src_rgn.bpp), p, + step * src_rgn.bpp); + } - gimp_pixel_rgn_set_rect (&des_rgn, - des_rows, - sel_x1 + x, - sel_y1, - step, - sel_height); + gimp_pixel_rgn_set_rect (&des_rgn, + des_rows, + sel_x1 + x, + sel_y1, + step, + sel_height); - gimp_progress_update ((double) x / (double) sel_width); - } + gimp_progress_update ((double) x / (double) sel_width); + } g_free (dst); g_free (sr); @@ -775,6 +775,6 @@ apply_blinds (void) gimp_drawable_flush (blindsdrawable); gimp_drawable_merge_shadow (blindsdrawable->drawable_id, TRUE); gimp_drawable_update (blindsdrawable->drawable_id, - sel_x1, sel_y1, sel_width, sel_height); + sel_x1, sel_y1, sel_width, sel_height); } diff --git a/plug-ins/common/flarefx.c b/plug-ins/common/flarefx.c index 0285aab9cf..5be01a79bf 100644 --- a/plug-ins/common/flarefx.c +++ b/plug-ins/common/flarefx.c @@ -60,12 +60,12 @@ /* --- Defines --- */ #define ENTRY_WIDTH 75 #define PREVIEW_MASK (GDK_EXPOSURE_MASK | \ - GDK_BUTTON_PRESS_MASK | \ - GDK_BUTTON1_MOTION_MASK) + GDK_BUTTON_PRESS_MASK | \ + GDK_BUTTON1_MOTION_MASK) -#define PREVIEW 0x1 -#define CURSOR 0x2 -#define ALL 0xf +#define PREVIEW 0x1 +#define CURSOR 0x2 +#define ALL 0xf /* --- Typedefs --- */ typedef struct @@ -99,7 +99,7 @@ typedef struct GtkObject *xadj; GtkObject *yadj; gint cursor; - gint curx, cury; /* x,y of cursor in preview */ + gint curx, cury; /* x,y of cursor in preview */ gint oldx, oldy; gint in_call; } FlareCenter; @@ -107,27 +107,27 @@ 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); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static void FlareFX (GimpDrawable *drawable, - gint preview_mode); + gint preview_mode); static gint flare_dialog (GimpDrawable *drawable); static GtkWidget * flare_center_create (GimpDrawable *drawable); -static void flare_center_destroy (GtkWidget *widget, - gpointer data); -static void flare_center_draw (FlareCenter *center, - gint update); -static void flare_center_adjustment_update (GtkAdjustment *adjustment, - gpointer data); -static void flare_center_cursor_update (FlareCenter *center); -static gint flare_center_preview_expose (GtkWidget *widget, - GdkEvent *event); -static gint flare_center_preview_events (GtkWidget *widget, - GdkEvent *event); +static void flare_center_destroy (GtkWidget *widget, + gpointer data); +static void flare_center_draw (FlareCenter *center, + gint update); +static void flare_center_adjustment_update (GtkAdjustment *adjustment, + gpointer data); +static void flare_center_cursor_update (FlareCenter *center); +static gint flare_center_preview_expose (GtkWidget *widget, + GdkEvent *event); +static gint flare_center_preview_events (GtkWidget *widget, + GdkEvent *event); static void mcolor (guchar *s, gfloat h); static void mglow (guchar *s, gfloat h); @@ -152,17 +152,17 @@ GimpPlugInInfo PLUG_IN_INFO = static FlareValues fvals = { - 128, 128 /* posx, posy */ + 128, 128 /* posx, posy */ }; -static gfloat scolor, sglow, sinner, souter; /* size */ -static gfloat shalo; -static gint xs, ys; -static gint numref; -static RGBfloat color, glow, inner, outer, halo; -static Reflect ref1[19]; -static GimpFixMePreview *preview; -static gboolean show_cursor = FALSE; +static gfloat scolor, sglow, sinner, souter; /* size */ +static gfloat shalo; +static gint xs, ys; +static gint numref; +static RGBfloat color, glow, inner, outer, halo; +static Reflect ref1[19]; +static GimpOldPreview *preview; +static gboolean show_cursor = FALSE; /* --- Functions --- */ MAIN () @@ -180,18 +180,18 @@ query (void) }; gimp_install_procedure ("plug_in_flarefx", - "Add lens flare effects", - "Adds a lens flare effects. Makes your image look like it was snapped with a cheap camera with a lot of lens :)", - "Karl-Johan Andersson", /* Author */ - "Karl-Johan Andersson", /* Copyright */ - "May 2000", - /* don't translate '' entry, - * it is keyword for the gtk toolkit */ - N_("/Filters/Light Effects/_FlareFX..."), - "RGB*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Add lens flare effects", + "Adds a lens flare effects. Makes your image look like it was snapped with a cheap camera with a lot of lens :)", + "Karl-Johan Andersson", /* Author */ + "Karl-Johan Andersson", /* Copyright */ + "May 2000", + /* don't translate '' entry, + * it is keyword for the gtk toolkit */ + N_("/Filters/Light Effects/_FlareFX..."), + "RGB*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -227,21 +227,21 @@ run (const gchar *name, /* First acquire information with a dialog */ if (! flare_dialog (drawable)) - { - gimp_drawable_detach (drawable); - return; - } + { + gimp_drawable_detach (drawable); + return; + } break; case GIMP_RUN_NONINTERACTIVE: /* Make sure all the arguments are there! */ if (nparams != 5) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; if (status == GIMP_PDB_SUCCESS) - { - fvals.posx = (gint) param[3].data.d_int32; - fvals.posy = (gint) param[4].data.d_int32; - } + { + fvals.posx = (gint) param[3].data.d_int32; + fvals.posy = (gint) param[4].data.d_int32; + } break; case GIMP_RUN_WITH_LAST_VALS: @@ -257,26 +257,26 @@ run (const gchar *name, { /* Make sure that the drawable is gray or RGB color */ if (gimp_drawable_is_rgb (drawable->drawable_id) || - gimp_drawable_is_gray (drawable->drawable_id)) - { - gimp_progress_init (_("Render Flare...")); - gimp_tile_cache_ntiles (2 * + gimp_drawable_is_gray (drawable->drawable_id)) + { + gimp_progress_init (_("Render Flare...")); + gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); - FlareFX (drawable, 0); + FlareFX (drawable, 0); - if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); + if (run_mode != GIMP_RUN_NONINTERACTIVE) + gimp_displays_flush (); - /* Store data */ - if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_set_data ("plug_in_flarefx", &fvals, sizeof (FlareValues)); - } + /* Store data */ + if (run_mode == GIMP_RUN_INTERACTIVE) + gimp_set_data ("plug_in_flarefx", &fvals, sizeof (FlareValues)); + } else - { - /* gimp_message ("FlareFX: cannot operate on indexed color images"); */ - status = GIMP_PDB_EXECUTION_ERROR; - } + { + /* gimp_message ("FlareFX: cannot operate on indexed color images"); */ + status = GIMP_PDB_EXECUTION_ERROR; + } } values[0].data.d_status = status; @@ -298,12 +298,12 @@ flare_dialog (GimpDrawable *drawable) dlg = gimp_dialog_new (_("FlareFX"), "flarefx", NULL, 0, - gimp_standard_help_func, "filters/flarefx.html", + gimp_standard_help_func, "filters/flarefx.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); /* parameter settings */ main_vbox = gtk_vbox_new (FALSE, 2); @@ -331,7 +331,7 @@ flare_dialog (GimpDrawable *drawable) /* --- Filter functions --- */ static void FlareFX (GimpDrawable *drawable, - gboolean preview_mode) + gboolean preview_mode) { GimpPixelRgn srcPR, destPR; gint width, height; @@ -402,54 +402,54 @@ FlareFX (GimpDrawable *drawable, for (row = y1; row < y2; row++) /* y-coord */ { if (preview_mode) - memcpy (cur_row, - preview->cache + preview->rowstride * row, - preview->rowstride); + memcpy (cur_row, + preview->cache + preview->rowstride * row, + preview->rowstride); else - gimp_pixel_rgn_get_row (&srcPR, cur_row, x1, row, x2-x1); + gimp_pixel_rgn_get_row (&srcPR, cur_row, x1, row, x2-x1); d = dest; s = cur_row; for (col = x1; col < x2; col++) /* x-coord */ - { - hyp = hypot (col-xs, row-ys); - mcolor (s, hyp); /* make color */ - mglow (s, hyp); /* make glow */ - minner (s, hyp); /* make inner */ - mouter (s, hyp); /* make outer */ - mhalo (s, hyp); /* make halo */ - for (i = 0; i < numref; i++) - { - switch (ref1[i].type) - { - case 1: - mrt1 (s, i, col, row); - break; - case 2: - mrt2 (s, i, col, row); - break; - case 3: - mrt3 (s, i, col, row); - break; - case 4: - mrt4 (s, i, col, row); - break; - } - } - s+=bytes; - } + { + hyp = hypot (col-xs, row-ys); + mcolor (s, hyp); /* make color */ + mglow (s, hyp); /* make glow */ + minner (s, hyp); /* make inner */ + mouter (s, hyp); /* make outer */ + mhalo (s, hyp); /* make halo */ + for (i = 0; i < numref; i++) + { + switch (ref1[i].type) + { + case 1: + mrt1 (s, i, col, row); + break; + case 2: + mrt2 (s, i, col, row); + break; + case 3: + mrt3 (s, i, col, row); + break; + case 4: + mrt4 (s, i, col, row); + break; + } + } + s+=bytes; + } if (preview_mode) - { - gimp_fixme_preview_do_row (preview, row, preview->width, cur_row); - } + { + gimp_old_preview_do_row (preview, row, preview->width, cur_row); + } else - { - /* store the dest */ - gimp_pixel_rgn_set_row (&destPR, cur_row, x1, row, (x2 - x1)); - } + { + /* store the dest */ + gimp_pixel_rgn_set_row (&destPR, cur_row, x1, row, (x2 - x1)); + } if ((row % 5) == 0 && !preview_mode) - gimp_progress_update ((double) row / (double) (y2 - y1)); + gimp_progress_update ((double) row / (double) (y2 - y1)); } if (preview_mode) @@ -470,7 +470,7 @@ FlareFX (GimpDrawable *drawable, static void mcolor (guchar *s, - gfloat h) + gfloat h) { static gfloat procent; @@ -500,7 +500,7 @@ mglow (guchar *s, static void minner (guchar *s, - gfloat h) + gfloat h) { static gfloat procent; @@ -515,7 +515,7 @@ minner (guchar *s, static void mouter (guchar *s, - gfloat h) + gfloat h) { static gfloat procent; @@ -540,8 +540,8 @@ mhalo (guchar *s, static void fixpix (guchar *data, - float procent, - RGBfloat colpro) + float procent, + RGBfloat colpro) { data[0] = data[0] + (255 - data[0]) * procent * colpro.r; data[1] = data[1] + (255 - data[1]) * procent * colpro.g; @@ -550,10 +550,10 @@ fixpix (guchar *data, static void initref (gint sx, - gint sy, - gint width, - gint height, - gint matt) + gint sy, + gint width, + gint height, + gint matt) { gint xh, yh, dx, dy; @@ -713,7 +713,7 @@ flare_center_create (GimpDrawable *drawable) center->drawable = drawable; center->dwidth = gimp_drawable_width(drawable->drawable_id ); center->dheight = gimp_drawable_height(drawable->drawable_id ); - center->bpp = gimp_drawable_bpp(drawable->drawable_id); + center->bpp = gimp_drawable_bpp(drawable->drawable_id); if (gimp_drawable_has_alpha (drawable->drawable_id)) center->bpp--; center->cursor = FALSE; @@ -741,7 +741,7 @@ flare_center_create (GimpDrawable *drawable) label = gtk_label_new_with_mnemonic (_("_X:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5 ); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); + GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); spinbutton = @@ -762,7 +762,7 @@ flare_center_create (GimpDrawable *drawable) label = gtk_label_new_with_mnemonic (_("_Y:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5 ); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, - GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); + GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); spinbutton = @@ -786,7 +786,7 @@ flare_center_create (GimpDrawable *drawable) gtk_table_attach (GTK_TABLE (table), pframe, 0, 4, 1, 2, 0, 0, 0, 0); /* PREVIEW */ - preview = gimp_fixme_preview_new (drawable, FALSE); + preview = gimp_old_preview_new (drawable, FALSE); gtk_widget_set_events (GTK_WIDGET (preview->widget), PREVIEW_MASK); gtk_container_add (GTK_CONTAINER (pframe), preview->widget); gtk_widget_show (preview->widget); @@ -808,7 +808,7 @@ flare_center_create (GimpDrawable *drawable) /* show / hide cursor */ check = gtk_check_button_new_with_mnemonic (_("_Show Cursor")); gtk_table_attach (GTK_TABLE (table), check, 0, 4, 2, 3, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), show_cursor); gtk_widget_show (check); @@ -831,7 +831,7 @@ flare_center_create (GimpDrawable *drawable) static void flare_center_destroy (GtkWidget *widget, - gpointer data) + gpointer data) { FlareCenter *center = data; g_free (center); @@ -845,7 +845,7 @@ flare_center_destroy (GtkWidget *widget, static void flare_center_draw (FlareCenter *center, - gint update) + gint update) { GtkWidget *prvw = preview->widget; @@ -859,32 +859,32 @@ flare_center_draw (FlareCenter *center, gdk_gc_set_function (prvw->style->black_gc, GDK_INVERT); if (show_cursor) - { - if (center->cursor) - { - gdk_draw_line (prvw->window, - prvw->style->black_gc, - center->oldx, 1, - center->oldx, - preview->height - 1); - gdk_draw_line (prvw->window, - prvw->style->black_gc, - 1, center->oldy, - preview->width - 1, - center->oldy); - } + { + if (center->cursor) + { + gdk_draw_line (prvw->window, + prvw->style->black_gc, + center->oldx, 1, + center->oldx, + preview->height - 1); + gdk_draw_line (prvw->window, + prvw->style->black_gc, + 1, center->oldy, + preview->width - 1, + center->oldy); + } - gdk_draw_line (prvw->window, - prvw->style->black_gc, - center->curx, 1, - center->curx, - preview->height - 1); - gdk_draw_line (prvw->window, - prvw->style->black_gc, - 1, center->cury, - preview->width - 1, - center->cury); - } + gdk_draw_line (prvw->window, + prvw->style->black_gc, + center->curx, 1, + center->curx, + preview->height - 1); + gdk_draw_line (prvw->window, + prvw->style->black_gc, + 1, center->cury, + preview->width - 1, + center->cury); + } /* current position of cursor is updated */ center->oldx = center->curx; @@ -902,7 +902,7 @@ flare_center_draw (FlareCenter *center, static void flare_center_adjustment_update (GtkAdjustment *adjustment, - gpointer data) + gpointer data) { FlareCenter *center; @@ -938,7 +938,7 @@ flare_center_cursor_update (FlareCenter *center) */ static gint flare_center_preview_expose (GtkWidget *widget, - GdkEvent *event) + GdkEvent *event) { FlareCenter *center; @@ -953,7 +953,7 @@ flare_center_preview_expose (GtkWidget *widget, static gint flare_center_preview_events (GtkWidget *widget, - GdkEvent *event) + GdkEvent *event) { FlareCenter *center; GdkEventButton *bevent; @@ -975,7 +975,7 @@ flare_center_preview_events (GtkWidget *widget, case GDK_MOTION_NOTIFY: mevent = (GdkEventMotion *) event; if (!mevent->state) - break; + break; center->curx = mevent->x; center->cury = mevent->y; mouse: diff --git a/plug-ins/common/glasstile.c b/plug-ins/common/glasstile.c index 626fda6221..9dc3821fae 100644 --- a/plug-ins/common/glasstile.c +++ b/plug-ins/common/glasstile.c @@ -85,7 +85,7 @@ static GlassValues gtvals = 20 /* tile height */ }; -static GimpFixMePreview *preview; +static GimpOldPreview *preview; /* --- Functions --- */ @@ -104,17 +104,17 @@ query (void) }; gimp_install_procedure ("plug_in_glasstile", - "Divide the image into square glassblocks", - "Divide the image into square glassblocks in " + "Divide the image into square glassblocks", + "Divide the image into square glassblocks in " "which the image is refracted.", - "Karl-Johan Andersson", /* Author */ - "Karl-Johan Andersson", /* Copyright */ - "May 2000", - N_("/Filters/Glass Effects/_Glass Tile..."), - "RGB*, GRAY*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Karl-Johan Andersson", /* Author */ + "Karl-Johan Andersson", /* Copyright */ + "May 2000", + N_("/Filters/Glass Effects/_Glass Tile..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -150,25 +150,25 @@ run (const gchar *name, /* First acquire information with a dialog */ if (! glass_dialog (drawable)) - { - gimp_drawable_detach (drawable); - return; - } + { + gimp_drawable_detach (drawable); + return; + } break; case GIMP_RUN_NONINTERACTIVE: /* Make sure all the arguments are there! */ if (nparams != 5) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; if (status == GIMP_PDB_SUCCESS) - { - gtvals.xblock = (gint) param[3].data.d_int32; - gtvals.yblock = (gint) param[4].data.d_int32; - } + { + gtvals.xblock = (gint) param[3].data.d_int32; + gtvals.yblock = (gint) param[4].data.d_int32; + } if (gtvals.xblock < 10 || gtvals.xblock > 50) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; if (gtvals.yblock < 10 || gtvals.yblock > 50) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; break; case GIMP_RUN_WITH_LAST_VALS: @@ -184,28 +184,28 @@ run (const gchar *name, { /* Make sure that the drawable is gray or RGB color */ if (gimp_drawable_is_rgb (drawable->drawable_id) || - gimp_drawable_is_gray (drawable->drawable_id)) - { - gimp_progress_init (_("Glass Tile...")); - gimp_tile_cache_ntiles (2 * + gimp_drawable_is_gray (drawable->drawable_id)) + { + gimp_progress_init (_("Glass Tile...")); + gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); - glasstile (drawable, FALSE); + glasstile (drawable, FALSE); - if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); - /* Store data */ - if (run_mode == GIMP_RUN_INTERACTIVE) - { - gimp_set_data ("plug_in_glasstile", >vals, - sizeof (GlassValues)); - gimp_fixme_preview_free (preview); + if (run_mode != GIMP_RUN_NONINTERACTIVE) + gimp_displays_flush (); + /* Store data */ + if (run_mode == GIMP_RUN_INTERACTIVE) + { + gimp_set_data ("plug_in_glasstile", >vals, + sizeof (GlassValues)); + gimp_old_preview_free (preview); } - } + } else - { - status = GIMP_PDB_EXECUTION_ERROR; - } + { + status = GIMP_PDB_EXECUTION_ERROR; + } } values[0].data.d_status = status; @@ -227,12 +227,12 @@ glass_dialog (GimpDrawable *drawable) dlg = gimp_dialog_new (_("Glass Tile"), "glasstile", NULL, 0, - gimp_standard_help_func, "filters/glasstile.html", + gimp_standard_help_func, "filters/glasstile.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); @@ -240,7 +240,7 @@ glass_dialog (GimpDrawable *drawable) main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); - preview = gimp_fixme_preview_new (drawable, TRUE); + preview = gimp_old_preview_new (drawable, TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), preview->frame, FALSE, FALSE, 0); gtk_widget_show (preview->widget); glasstile (drawable, TRUE); /* filter routine, initial pass */ @@ -260,10 +260,10 @@ glass_dialog (GimpDrawable *drawable) /* Horizontal scale - Width */ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("Tile _Width:"), 150, 0, - gtvals.xblock, 10, 50, 2, 10, 0, - TRUE, 0, 0, - NULL, NULL); + _("Tile _Width:"), 150, 0, + gtvals.xblock, 10, 50, 2, 10, 0, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), @@ -274,10 +274,10 @@ glass_dialog (GimpDrawable *drawable) /* Horizontal scale - Height */ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("Tile _Height:"), 150, 0, - gtvals.yblock, 10, 50, 2, 10, 0, - TRUE, 0, 0, - NULL, NULL); + _("Tile _Height:"), 150, 0, + gtvals.yblock, 10, 50, 2, 10, 0, + TRUE, 0, 0, + NULL, NULL); g_object_set_data (G_OBJECT (adj), "drawable", drawable); @@ -300,7 +300,7 @@ glass_dialog (GimpDrawable *drawable) /* - Filter function - I wish all filter functions had a pmode :) */ static void glasstile (GimpDrawable *drawable, - gboolean preview_mode) + gboolean preview_mode) { GimpPixelRgn srcPR, destPR; gint width, height; @@ -391,57 +391,57 @@ glasstile (GimpDrawable *drawable, ypixel2 = CLAMP (ypixel2, 0, y2 - 1); if (preview_mode) - { - memcpy (cur_row, preview->cache + ypixel2 * preview->rowstride, - preview->rowstride); - } + { + memcpy (cur_row, preview->cache + ypixel2 * preview->rowstride, + preview->rowstride); + } else - { - gimp_pixel_rgn_get_row (&srcPR, cur_row, x1, ypixel2, iwidth); - } + { + gimp_pixel_rgn_get_row (&srcPR, cur_row, x1, ypixel2, iwidth); + } yoffs++; /* if current offset = half, do a displacement next time around */ if (yoffs == yhalv) - { - ymitt += ruthojd; - yoffs = - (yhalv + yplus); - } + { + ymitt += ruthojd; + yoffs = - (yhalv + yplus); + } xmitt = 0; xoffs = 0; for (col = 0; col < x2 - x1; col++) /* one pixel */ - { - xpixel1 = (xmitt + xoffs) * bytes; - xpixel2 = (xmitt + xoffs * 2) * bytes; + { + xpixel1 = (xmitt + xoffs) * bytes; + xpixel2 = (xmitt + xoffs * 2) * bytes; - if (xpixel2 < ((x2 - x1) * bytes)) - { - if(xpixel2 < 0) - xpixel2 = 0; - for (i = 0; i < bytes; i++) - d[xpixel1 + i] = cur_row[xpixel2 + i]; - } - else - { - for (i = 0; i < bytes; i++) - d[xpixel1 + i] = cur_row[xpixel1 + i]; - } + if (xpixel2 < ((x2 - x1) * bytes)) + { + if(xpixel2 < 0) + xpixel2 = 0; + for (i = 0; i < bytes; i++) + d[xpixel1 + i] = cur_row[xpixel2 + i]; + } + else + { + for (i = 0; i < bytes; i++) + d[xpixel1 + i] = cur_row[xpixel1 + i]; + } - xoffs++; + xoffs++; - if (xoffs == xhalv) - { - xmitt += rutbredd; - xoffs = - (xhalv + xplus); - } - } + if (xoffs == xhalv) + { + xmitt += rutbredd; + xoffs = - (xhalv + xplus); + } + } /* Store the dest */ if (preview_mode) { - gimp_fixme_preview_do_row (preview, row, width, dest); + gimp_old_preview_do_row (preview, row, width, dest); } else { diff --git a/plug-ins/common/grid.c b/plug-ins/common/grid.c index 172d16ba66..b81b496f81 100644 --- a/plug-ins/common/grid.c +++ b/plug-ins/common/grid.c @@ -58,19 +58,19 @@ /* Declare local functions. */ static void query (void); static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static guchar best_cmap_match (const guchar *cmap, - gint ncolors, - const GimpRGB *color); + gint ncolors, + const GimpRGB *color); static void doit (gint32 image_ID, - GimpDrawable *drawable, - gboolean preview_mode); + GimpDrawable *drawable, + gboolean preview_mode); static gint dialog (gint32 image_ID, - GimpDrawable *drawable); + GimpDrawable *drawable); GimpPlugInInfo PLUG_IN_INFO = { @@ -85,7 +85,7 @@ static gint sx1, sy1, sx2, sy2; static GtkWidget *main_dialog = NULL; static GtkWidget *hcolor_button = NULL; static GtkWidget *vcolor_button = NULL; -static GimpFixMePreview *preview = NULL; +static GimpOldPreview *preview = NULL; typedef struct { @@ -142,17 +142,17 @@ void query (void) }; gimp_install_procedure ("plug_in_grid", - "Draws a grid.", - "Draws a grid using the specified colors. " - "The grid origin is the upper left corner.", - "Tim Newsome", - "Tim Newsome, Sven Neumann, Tom Rathborne, TC", - "1997 - 2000", - N_("/Filters/Render/Pattern/_Grid..."), - "RGB*, GRAY*, INDEXED*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Draws a grid.", + "Draws a grid using the specified colors. " + "The grid origin is the upper left corner.", + "Tim Newsome", + "Tim Newsome, Sven Neumann, Tom Rathborne, TC", + "1997 - 2000", + N_("/Filters/Render/Pattern/_Grid..."), + "RGB*, GRAY*, INDEXED*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -180,37 +180,37 @@ run (const gchar *name, if (run_mode == GIMP_RUN_NONINTERACTIVE) { if (n_params != 18) - status = GIMP_PDB_CALLING_ERROR; + status = GIMP_PDB_CALLING_ERROR; if (status == GIMP_PDB_SUCCESS) - { - grid_cfg.hwidth = MAX (0, param[3].data.d_int32); - grid_cfg.hspace = MAX (1, param[4].data.d_int32); - grid_cfg.hoffset = MAX (0, param[5].data.d_int32); - grid_cfg.hcolor = param[6].data.d_color; - - /* FIXME: this used to be the alpha value - param[7].data.d_int8; - */ - - grid_cfg.vwidth = MAX (0, param[8].data.d_int32); - grid_cfg.vspace = MAX (1, param[9].data.d_int32); - grid_cfg.voffset = MAX (0, param[10].data.d_int32); - grid_cfg.vcolor = param[11].data.d_color; + { + grid_cfg.hwidth = MAX (0, param[3].data.d_int32); + grid_cfg.hspace = MAX (1, param[4].data.d_int32); + grid_cfg.hoffset = MAX (0, param[5].data.d_int32); + grid_cfg.hcolor = param[6].data.d_color; /* FIXME: this used to be the alpha value - param[12].data.d_int8; - */ + param[7].data.d_int8; + */ - grid_cfg.iwidth = MAX (0, param[13].data.d_int32); - grid_cfg.ispace = MAX (0, param[14].data.d_int32); - grid_cfg.ioffset = MAX (0, param[15].data.d_int32); - grid_cfg.icolor = param[16].data.d_color; + grid_cfg.vwidth = MAX (0, param[8].data.d_int32); + grid_cfg.vspace = MAX (1, param[9].data.d_int32); + grid_cfg.voffset = MAX (0, param[10].data.d_int32); + grid_cfg.vcolor = param[11].data.d_color; - /* FIXME: this used to be the alpha value - param[17].data.d_int8); - */ - } + /* FIXME: this used to be the alpha value + param[12].data.d_int8; + */ + + grid_cfg.iwidth = MAX (0, param[13].data.d_int32); + grid_cfg.ispace = MAX (0, param[14].data.d_int32); + grid_cfg.ioffset = MAX (0, param[15].data.d_int32); + grid_cfg.icolor = param[16].data.d_color; + + /* FIXME: this used to be the alpha value + param[17].data.d_int8); + */ + } } else { @@ -221,11 +221,11 @@ run (const gchar *name, if (run_mode == GIMP_RUN_INTERACTIVE) { if (!dialog (image_ID, drawable)) - { - /* The dialog was closed, or something similarly evil happened. */ - status = GIMP_PDB_EXECUTION_ERROR; - } - gimp_fixme_preview_free (preview); + { + /* The dialog was closed, or something similarly evil happened. */ + status = GIMP_PDB_EXECUTION_ERROR; + } + gimp_old_preview_free (preview); } if (grid_cfg.hspace <= 0 || grid_cfg.vspace <= 0) @@ -241,10 +241,10 @@ run (const gchar *name, doit (image_ID, drawable, FALSE); if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); + gimp_displays_flush (); if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_set_data ("plug_in_grid", &grid_cfg, sizeof (grid_cfg)); + gimp_set_data ("plug_in_grid", &grid_cfg, sizeof (grid_cfg)); gimp_drawable_detach (drawable); } @@ -258,8 +258,8 @@ run (const gchar *name, static guchar best_cmap_match (const guchar *cmap, - gint ncolors, - const GimpRGB *color) + gint ncolors, + const GimpRGB *color) { guchar cmap_index = 0; gint max = MAXDIFF; @@ -278,10 +278,10 @@ best_cmap_match (const guchar *cmap, sum += SQR (diff); if (sum < max) - { - cmap_index = i; - max = sum; - } + { + cmap_index = i; + max = sum; + } } return cmap_index; @@ -289,10 +289,10 @@ best_cmap_match (const guchar *cmap, G_INLINE_FUNC void pix_composite (guchar *p1, - guchar p2[4], - gint bytes, - gboolean blend, - gboolean alpha) + guchar p2[4], + gint bytes, + gboolean blend, + gboolean alpha) { gint b; @@ -304,10 +304,10 @@ pix_composite (guchar *p1, if (blend) { for (b = 0; b < bytes; b++) - { - *p1 = *p1 * (1.0 - p2[3]/255.0) + p2[b] * p2[3]/255.0; - p1++; - } + { + *p1 = *p1 * (1.0 - p2[3]/255.0) + p2[b] * p2[3]/255.0; + p1++; + } } else { @@ -351,31 +351,31 @@ doit (gint32 image_ID, else { switch (gimp_image_base_type (image_ID)) - { - case GIMP_RGB: - blend = TRUE; - break; + { + case GIMP_RGB: + blend = TRUE; + break; - case GIMP_GRAY: - hcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.hcolor); - vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor); - vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor); - blend = TRUE; - break; + case GIMP_GRAY: + hcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.hcolor); + vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor); + vcolor[0] = gimp_rgb_intensity_uchar (&grid_cfg.vcolor); + blend = TRUE; + break; - case GIMP_INDEXED: - cmap = gimp_image_get_cmap (image_ID, &ncolors); - hcolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.hcolor); - vcolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.vcolor); - icolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.icolor); - g_free (cmap); - blend = FALSE; - break; + case GIMP_INDEXED: + cmap = gimp_image_get_cmap (image_ID, &ncolors); + hcolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.hcolor); + vcolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.vcolor); + icolor[0] = best_cmap_match (cmap, ncolors, &grid_cfg.icolor); + g_free (cmap); + blend = FALSE; + break; - default: - g_assert_not_reached (); - blend = FALSE; - } + default: + g_assert_not_reached (); + blend = FALSE; + } } if (preview_mode) @@ -408,77 +408,77 @@ doit (gint32 image_ID, for (y = sy1; y < sy2; y++) { if (preview_mode) - memcpy (dest, preview->cache + preview->rowstride * y, - preview->rowstride); + memcpy (dest, preview->cache + preview->rowstride * y, + preview->rowstride); else - gimp_pixel_rgn_get_row (&srcPR, dest, sx1, y, (sx2 - sx1)); + gimp_pixel_rgn_get_row (&srcPR, dest, sx1, y, (sx2 - sx1)); y_offset = y - grid_cfg.hoffset; while (y_offset < 0) - y_offset += grid_cfg.hspace; + y_offset += grid_cfg.hspace; if ((y_offset + (grid_cfg.hwidth / 2)) % grid_cfg.hspace < grid_cfg.hwidth) - { - for (x = sx1; x < sx2; x++) - { - pix_composite (&dest[(x-sx1) * bytes], hcolor, bytes, blend, alpha); - } - } + { + for (x = sx1; x < sx2; x++) + { + pix_composite (&dest[(x-sx1) * bytes], hcolor, bytes, blend, alpha); + } + } if ((y_offset + (grid_cfg.iwidth / 2)) % grid_cfg.hspace < grid_cfg.iwidth) { - for (x = sx1; x < sx2; x++) - { - x_offset = grid_cfg.vspace + x - grid_cfg.voffset; - while (x_offset < 0) - x_offset += grid_cfg.vspace; + for (x = sx1; x < sx2; x++) + { + x_offset = grid_cfg.vspace + x - grid_cfg.voffset; + while (x_offset < 0) + x_offset += grid_cfg.vspace; if ((x_offset % grid_cfg.vspace >= grid_cfg.ispace - && - x_offset % grid_cfg.vspace < grid_cfg.ioffset) - || - (grid_cfg.vspace - (x_offset % grid_cfg.vspace) >= grid_cfg.ispace - && - grid_cfg.vspace - (x_offset % grid_cfg.vspace) < grid_cfg.ioffset)) - { - pix_composite (&dest[(x-sx1) * bytes], icolor, bytes, blend, alpha); + && + x_offset % grid_cfg.vspace < grid_cfg.ioffset) + || + (grid_cfg.vspace - (x_offset % grid_cfg.vspace) >= grid_cfg.ispace + && + grid_cfg.vspace - (x_offset % grid_cfg.vspace) < grid_cfg.ioffset)) + { + pix_composite (&dest[(x-sx1) * bytes], icolor, bytes, blend, alpha); } - } + } } for (x = sx1; x < sx2; x++) { - x_offset = grid_cfg.vspace + x - grid_cfg.voffset; - while (x_offset < 0) - x_offset += grid_cfg.vspace; + x_offset = grid_cfg.vspace + x - grid_cfg.voffset; + while (x_offset < 0) + x_offset += grid_cfg.vspace; if ((x_offset + (grid_cfg.vwidth / 2)) % grid_cfg.vspace < grid_cfg.vwidth) { - pix_composite (&dest[(x-sx1) * bytes], vcolor, bytes, blend, alpha); + pix_composite (&dest[(x-sx1) * bytes], vcolor, bytes, blend, alpha); } if ((x_offset + (grid_cfg.iwidth / 2)) % grid_cfg.vspace < grid_cfg.iwidth - && - ((y_offset % grid_cfg.hspace >= grid_cfg.ispace - && - y_offset % grid_cfg.hspace < grid_cfg.ioffset) - || - (grid_cfg.hspace - (y_offset % grid_cfg.hspace) >= grid_cfg.ispace - && - grid_cfg.hspace - (y_offset % grid_cfg.hspace) < grid_cfg.ioffset))) + && + ((y_offset % grid_cfg.hspace >= grid_cfg.ispace + && + y_offset % grid_cfg.hspace < grid_cfg.ioffset) + || + (grid_cfg.hspace - (y_offset % grid_cfg.hspace) >= grid_cfg.ispace + && + grid_cfg.hspace - (y_offset % grid_cfg.hspace) < grid_cfg.ioffset))) { - pix_composite (&dest[(x-sx1) * bytes], icolor, bytes, blend, alpha); + pix_composite (&dest[(x-sx1) * bytes], icolor, bytes, blend, alpha); } } if (preview_mode) - { - gimp_fixme_preview_do_row (preview, y, width, dest); - } + { + gimp_old_preview_do_row (preview, y, width, dest); + } else - { - gimp_pixel_rgn_set_row (&destPR, dest, sx1, y, (sx2-sx1) ); - gimp_progress_update ((double) y / (double) (sy2 - sy1)); - } + { + gimp_pixel_rgn_set_row (&destPR, dest, sx1, y, (sx2-sx1) ); + gimp_progress_update ((double) y / (double) (sy2 - sy1)); + } } g_free (dest); @@ -549,7 +549,7 @@ update_preview (void) static void entry_callback (GtkWidget *widget, - gpointer data) + gpointer data) { static gdouble x = -1.0; static gdouble y = -1.0; @@ -562,15 +562,15 @@ entry_callback (GtkWidget *widget, if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data))) { if (new_x != x) - { - y = new_y = x = new_x; - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, y); - } + { + y = new_y = x = new_x; + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, y); + } if (new_y != y) - { - x = new_x = y = new_y; - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, x); - } + { + x = new_x = y = new_y; + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, x); + } } else { @@ -583,7 +583,7 @@ entry_callback (GtkWidget *widget, static void color_callback (GtkWidget *widget, - gpointer data) + gpointer data) { if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data))) { @@ -592,11 +592,11 @@ color_callback (GtkWidget *widget, gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget), &color); if (widget == vcolor_button) - gimp_color_button_set_color (GIMP_COLOR_BUTTON (hcolor_button), - &color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (hcolor_button), + &color); else if (widget == hcolor_button) - gimp_color_button_set_color (GIMP_COLOR_BUTTON (vcolor_button), - &color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (vcolor_button), + &color); } update_preview (); @@ -605,7 +605,7 @@ color_callback (GtkWidget *widget, static gint dialog (gint32 image_ID, - GimpDrawable *drawable) + GimpDrawable *drawable) { GtkWidget *dlg; GtkWidget *main_hbox; @@ -670,8 +670,8 @@ dialog (gint32 image_ID, gtk_container_add (GTK_CONTAINER (abox), frame); gtk_widget_show (frame); - preview = gimp_fixme_preview_new (NULL, FALSE); - gimp_fixme_preview_fill (preview, drawable); + preview = gimp_old_preview_new (NULL, FALSE); + gimp_old_preview_fill (preview, drawable); gtk_container_add (GTK_CONTAINER (frame), preview->widget); doit (image_ID, drawable, TRUE); /* render preview */ gtk_widget_show (preview->widget); @@ -691,13 +691,13 @@ dialog (gint32 image_ID, /* The width entries */ width = gimp_size_entry_new (3, /* number_of_fields */ - unit, /* unit */ - "%a", /* unit_format */ - TRUE, /* menu_show_pixels */ - TRUE, /* menu_show_percent */ - FALSE, /* show_refval */ - SPIN_BUTTON_WIDTH, /* spinbutton_usize */ - GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ + unit, /* unit */ + "%a", /* unit_format */ + TRUE, /* menu_show_pixels */ + TRUE, /* menu_show_percent */ + FALSE, /* show_refval */ + SPIN_BUTTON_WIDTH, /* spinbutton_usize */ + GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ /* set the unit back to pixels, since most times we will want pixels */ gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (width), GIMP_UNIT_PIXEL); @@ -714,11 +714,11 @@ dialog (gint32 image_ID, /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 0, 0.0, - drawable->width); + drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 1, 0.0, - drawable->height); + drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 2, 0.0, - MAX (drawable->width, drawable->height)); + MAX (drawable->width, drawable->height)); gtk_table_set_col_spacing (GTK_TABLE (width), 2, 12); gtk_table_set_col_spacing (GTK_TABLE (width), 3, 12); @@ -759,13 +759,13 @@ dialog (gint32 image_ID, /* The spacing entries */ space = gimp_size_entry_new (3, /* number_of_fields */ - unit, /* unit */ - "%a", /* unit_format */ - TRUE, /* menu_show_pixels */ - TRUE, /* menu_show_percent */ - FALSE, /* show_refval */ - SPIN_BUTTON_WIDTH, /* spinbutton_usize */ - GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ + unit, /* unit */ + "%a", /* unit_format */ + TRUE, /* menu_show_pixels */ + TRUE, /* menu_show_percent */ + FALSE, /* show_refval */ + SPIN_BUTTON_WIDTH, /* spinbutton_usize */ + GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (space), GIMP_UNIT_PIXEL); /* set the resolution to the image resolution */ @@ -780,11 +780,11 @@ dialog (gint32 image_ID, /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 0, 1.0, - drawable->width); + drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 1, 1.0, - drawable->height); + drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 2, 0.0, - MAX (drawable->width, drawable->height)); + MAX (drawable->width, drawable->height)); gtk_table_set_col_spacing (GTK_TABLE (space), 2, 12); gtk_table_set_col_spacing (GTK_TABLE (space), 3, 12); @@ -823,13 +823,13 @@ dialog (gint32 image_ID, /* The offset entries */ offset = gimp_size_entry_new (3, /* number_of_fields */ - unit, /* unit */ - "%a", /* unit_format */ - TRUE, /* menu_show_pixels */ - TRUE, /* menu_show_percent */ - FALSE, /* show_refval */ - SPIN_BUTTON_WIDTH, /* spinbutton_usize */ - GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ + unit, /* unit */ + "%a", /* unit_format */ + TRUE, /* menu_show_pixels */ + TRUE, /* menu_show_percent */ + FALSE, /* show_refval */ + SPIN_BUTTON_WIDTH, /* spinbutton_usize */ + GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */ gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (offset), GIMP_UNIT_PIXEL); /* set the resolution to the image resolution */ @@ -844,11 +844,11 @@ dialog (gint32 image_ID, /* set upper and lower limits (in pixels) */ gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 0, 0.0, - drawable->width); + drawable->width); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 1, 0.0, - drawable->height); + drawable->height); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 2, 0.0, - MAX (drawable->width, drawable->height)); + MAX (drawable->width, drawable->height)); gtk_table_set_col_spacing (GTK_TABLE (offset), 2, 12); gtk_table_set_col_spacing (GTK_TABLE (offset), 3, 12); @@ -898,9 +898,9 @@ dialog (gint32 image_ID, gtk_widget_show (align); hcolor_button = gimp_color_button_new (_("Horizontal Color"), - COLOR_BUTTON_WIDTH, 16, - &grid_cfg.hcolor, - GIMP_COLOR_AREA_SMALL_CHECKS); + COLOR_BUTTON_WIDTH, 16, + &grid_cfg.hcolor, + GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (hcolor_button), TRUE); gtk_container_add (GTK_CONTAINER (align), hcolor_button); gtk_widget_show (hcolor_button); @@ -917,9 +917,9 @@ dialog (gint32 image_ID, gtk_widget_show (align); vcolor_button = gimp_color_button_new (_("Vertical Color"), - COLOR_BUTTON_WIDTH, 16, - &grid_cfg.vcolor, - GIMP_COLOR_AREA_SMALL_CHECKS); + COLOR_BUTTON_WIDTH, 16, + &grid_cfg.vcolor, + GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (vcolor_button), TRUE); gtk_container_add (GTK_CONTAINER (align), vcolor_button); gtk_widget_show (vcolor_button); @@ -936,9 +936,9 @@ dialog (gint32 image_ID, gtk_widget_show (align); button = gimp_color_button_new (_("Intersection Color"), - COLOR_BUTTON_WIDTH, 16, - &grid_cfg.icolor, - GIMP_COLOR_AREA_SMALL_CHECKS); + COLOR_BUTTON_WIDTH, 16, + &grid_cfg.icolor, + GIMP_COLOR_AREA_SMALL_CHECKS); gimp_color_button_set_update (GIMP_COLOR_BUTTON (button), TRUE); gtk_container_add (GTK_CONTAINER (align), button); gtk_widget_show (button); diff --git a/plug-ins/common/illusion.c b/plug-ins/common/illusion.c index 52a5b45192..332ffd0695 100644 --- a/plug-ins/common/illusion.c +++ b/plug-ins/common/illusion.c @@ -5,8 +5,8 @@ * s1041150@u-aizu.ac.jp * * Preview and new mode added May 2000 by tim copperfield - * timecop@japan.co.jp - * http://www.ne.jp/asahi/linux/timecop + * timecop@japan.co.jp + * http://www.ne.jp/asahi/linux/timecop * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -44,10 +44,10 @@ static void query (void); static void run (const gchar *name, - gint nparam, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparam, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static void filter (GimpDrawable *drawable); static void filter_preview (void); @@ -76,8 +76,8 @@ static IllValues parameters = }; -static GimpFixMePreview *preview; -static GimpRunMode run_mode; +static GimpOldPreview *preview; +static GimpRunMode run_mode; MAIN () @@ -95,16 +95,16 @@ query (void) }; gimp_install_procedure (PLUG_IN_NAME, - "produce illusion", - "produce illusion", - "Hirotsuna Mizuno ", - "Hirotsuna Mizuno", - PLUG_IN_VERSION, - N_("/Filters/Map/_Illusion..."), - "RGB*, GRAY*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "produce illusion", + "produce illusion", + "Hirotsuna Mizuno ", + "Hirotsuna Mizuno", + PLUG_IN_VERSION, + N_("/Filters/Map/_Illusion..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -134,19 +134,19 @@ run (const gchar *name, case GIMP_RUN_INTERACTIVE: gimp_get_data (PLUG_IN_NAME, ¶meters); if (! dialog(drawable)) - return; + return; gimp_set_data (PLUG_IN_NAME, ¶meters, sizeof (IllValues)); - gimp_fixme_preview_free (preview); + gimp_old_preview_free (preview); break; case GIMP_RUN_NONINTERACTIVE: if (nparams != 5) - { - status = GIMP_PDB_CALLING_ERROR; - } + { + status = GIMP_PDB_CALLING_ERROR; + } else - { - parameters.division = params[3].data.d_int32; + { + parameters.division = params[3].data.d_int32; if (params[4].data.d_int32 == 0) { parameters.type1 = 1; @@ -157,7 +157,7 @@ run (const gchar *name, parameters.type1 = 0; parameters.type2 = 1; } - } + } break; case GIMP_RUN_WITH_LAST_VALS: @@ -168,18 +168,18 @@ run (const gchar *name, if (status == GIMP_PDB_SUCCESS) { if (gimp_drawable_is_rgb (drawable->drawable_id) || - gimp_drawable_is_gray (drawable->drawable_id)) - { - gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width() + 1)); - gimp_progress_init (_("Illusion...")); - filter (drawable); - if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); - } + gimp_drawable_is_gray (drawable->drawable_id)) + { + gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width() + 1)); + gimp_progress_init (_("Illusion...")); + filter (drawable); + if (run_mode != GIMP_RUN_NONINTERACTIVE) + gimp_displays_flush (); + } else - { - status = GIMP_PDB_EXECUTION_ERROR; - } + { + status = GIMP_PDB_EXECUTION_ERROR; + } } returnv[0].type = GIMP_PDB_STATUS; @@ -190,20 +190,20 @@ run (const gchar *name, typedef struct { GimpPixelFetcher *pft; - gdouble center_x; - gdouble center_y; - gdouble scale; - gdouble offset; - gboolean has_alpha; + gdouble center_x; + gdouble center_y; + gdouble scale; + gdouble offset; + gboolean has_alpha; } IllusionParam_t; static void illusion_func (gint x, - gint y, - const guchar *src, - guchar *dest, - gint bpp, - gpointer data) + gint y, + const guchar *src, + guchar *dest, + gint bpp, + gpointer data) { IllusionParam_t *param = (IllusionParam_t*) data; gint xx, yy, b; @@ -222,7 +222,7 @@ illusion_func (gint x, xx = x - param->offset * cos (angle); yy = y - param->offset * sin (angle); } - else /* Type 2 */ + else /* Type 2 */ { xx = x - param->offset * sin (angle); yy = y - param->offset * cos (angle); @@ -237,16 +237,16 @@ illusion_func (gint x, guint alpha = (1 - radius) * alpha1 + radius * alpha2; if ((dest[bpp - 1] = (alpha >> 1))) - { - for (b = 0; b < bpp - 1; b++) - dest[b] = ((1 - radius) * src[b] * alpha1 + - radius * pixel[b] * alpha2) / alpha; - } + { + for (b = 0; b < bpp - 1; b++) + dest[b] = ((1 - radius) * src[b] * alpha1 + + radius * pixel[b] * alpha2) / alpha; + } } else { for (b = 0; b < bpp; b++) - dest[b] = (1 - radius) * src[b] + radius * pixel[b]; + dest[b] = (1 - radius) * src[b] + radius * pixel[b]; } } @@ -307,8 +307,8 @@ filter_preview (void) pixels[y] = g_new (guchar, preview->rowstride); destpixels[y] = g_new (guchar, preview->rowstride); memcpy (pixels[y], - preview->cache + preview->rowstride * y, - preview->rowstride); + preview->cache + preview->rowstride * y, + preview->rowstride); } scale = sqrt (image_width * image_width + image_height * image_height) / 2; @@ -318,25 +318,25 @@ filter_preview (void) { cy = ((gdouble)y - center_y) / scale; for (x = 0; x < image_width; x++) - { - cx = ((gdouble)x - center_x) / scale; - angle = floor (atan2 (cy, cx) * parameters.division / G_PI_2) - * G_PI_2 / parameters.division + (G_PI / parameters.division); - radius = sqrt ((gdouble) (cx * cx + cy * cy)); + { + cx = ((gdouble)x - center_x) / scale; + angle = floor (atan2 (cy, cx) * parameters.division / G_PI_2) + * G_PI_2 / parameters.division + (G_PI / parameters.division); + radius = sqrt ((gdouble) (cx * cx + cy * cy)); - if (parameters.type1) - { - xx = x - offset * cos (angle); - yy = y - offset * sin (angle); - } - else /* Type 2 */ - { - xx = x - offset * sin (angle); - yy = y - offset * cos (angle); - } + if (parameters.type1) + { + xx = x - offset * cos (angle); + yy = y - offset * sin (angle); + } + else /* Type 2 */ + { + xx = x - offset * sin (angle); + yy = y - offset * cos (angle); + } - xx = CLAMP (xx, 0, image_width - 1); - yy = CLAMP (yy, 0, image_height - 1); + xx = CLAMP (xx, 0, image_width - 1); + yy = CLAMP (yy, 0, image_height - 1); if (image_bpp == 2 || image_bpp == 4) { @@ -344,7 +344,7 @@ filter_preview (void) gdouble alpha2 = pixels[yy][xx * image_bpp + image_bpp - 1]; gdouble alpha = (1 - radius) * alpha1 + radius * alpha2; - for (b = 0; alpha > 0 && b < image_bpp - 1; b++) + for (b = 0; alpha > 0 && b < image_bpp - 1; b++) { destpixels[y][x * image_bpp+b] = ((1-radius) * alpha1 * pixels[y][x * image_bpp + b] @@ -352,15 +352,15 @@ filter_preview (void) } destpixels[y][x * image_bpp + image_bpp-1] = alpha; } - else + else { - for (b = 0; b < image_bpp; b++) - destpixels[y][x*image_bpp+b] = - (1-radius) * pixels[y][x * image_bpp + b] - + radius * pixels[yy][xx * image_bpp + b]; + for (b = 0; b < image_bpp; b++) + destpixels[y][x*image_bpp+b] = + (1-radius) * pixels[y][x * image_bpp + b] + + radius * pixels[yy][xx * image_bpp + b]; } - } - gimp_fixme_preview_do_row (preview, y, image_width, destpixels[y]); + } + gimp_old_preview_do_row (preview, y, image_width, destpixels[y]); } for (y = 0; y < image_height; y++) @@ -391,12 +391,12 @@ dialog (GimpDrawable *mangle) dlg = gimp_dialog_new (_("Illusion"), "illusion", NULL, 0, - gimp_standard_help_func, "filters/illusion.html", + gimp_standard_help_func, "filters/illusion.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); @@ -404,7 +404,7 @@ dialog (GimpDrawable *mangle) TRUE, TRUE, 0); gtk_widget_show (main_vbox); - preview = gimp_fixme_preview_new (mangle, TRUE); + preview = gimp_old_preview_new (mangle, TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), preview->frame, FALSE, FALSE, 0); filter_preview(); gtk_widget_show (preview->widget); @@ -421,10 +421,10 @@ dialog (GimpDrawable *mangle) gtk_widget_show (table); spinbutton = gimp_spin_button_new (&adj, parameters.division, - -32, 64, 1, 10, 0, 1, 0); + -32, 64, 1, 10, 0, 1, 0); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("_Division:"), 1.0, 0.5, - spinbutton, 1, TRUE); + _("_Division:"), 1.0, 0.5, + spinbutton, 1, TRUE); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), diff --git a/plug-ins/common/jigsaw.c b/plug-ins/common/jigsaw.c index 46ad558170..451fd1dd44 100644 --- a/plug-ins/common/jigsaw.c +++ b/plug-ins/common/jigsaw.c @@ -378,7 +378,7 @@ static globals_t globals = }; /* preview globals */ -static GimpFixMePreview *preview; +static GimpOldPreview *preview; MAIN () @@ -547,7 +547,7 @@ jigsaw (gboolean preview_mode) for (y = 0; y < preview->height; y++) { - gimp_fixme_preview_do_row (preview, y, preview->width, + gimp_old_preview_do_row (preview, y, preview->width, &buffer[preview->rowstride * y]); } @@ -2550,7 +2550,7 @@ dialog_box (void) gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_hbox, TRUE, TRUE, 0); gtk_widget_show (main_hbox); - preview = gimp_fixme_preview_new (drawable, TRUE); + preview = gimp_old_preview_new (drawable, TRUE); gtk_box_pack_start (GTK_BOX (main_hbox), preview->frame, FALSE, FALSE, 0); jigsaw(TRUE); /* render preview */ gtk_widget_show (preview->widget); diff --git a/plug-ins/common/max_rgb.c b/plug-ins/common/max_rgb.c index 6c0cb9a5eb..36da169e51 100644 --- a/plug-ins/common/max_rgb.c +++ b/plug-ins/common/max_rgb.c @@ -39,22 +39,22 @@ /* Replace them with the right ones */ -#define PLUG_IN_NAME "plug_in_max_rgb" -#define SHORT_NAME "max_rgb" +#define PLUG_IN_NAME "plug_in_max_rgb" +#define SHORT_NAME "max_rgb" -static void query (void); -static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static GimpPDBStatusType main_function (GimpDrawable *drawable, - gboolean preview_mode); + gboolean preview_mode); -static gint dialog (GimpDrawable *drawable); +static gint dialog (GimpDrawable *drawable); static void radio_callback (GtkWidget *widget, - gpointer data); + gpointer data); GimpPlugInInfo PLUG_IN_INFO = @@ -81,8 +81,8 @@ static ValueType pvals = MAX_CHANNELS }; -static GimpRunMode run_mode; -static GimpFixMePreview *preview; +static GimpRunMode run_mode; +static GimpOldPreview *preview; MAIN () @@ -98,19 +98,19 @@ query (void) }; gimp_install_procedure (PLUG_IN_NAME, - "Return an image in which each pixel holds only " - "the channel that has the maximum value in three " - "(red, green, blue) channels, and other channels " - "are zero-cleared", - "the help is not yet written for this plug-in since none is needed.", - "Shuji Narazaki (narazaki@InetQ.or.jp)", - "Shuji Narazaki", - "May 2000", + "Return an image in which each pixel holds only " + "the channel that has the maximum value in three " + "(red, green, blue) channels, and other channels " + "are zero-cleared", + "the help is not yet written for this plug-in since none is needed.", + "Shuji Narazaki (narazaki@InetQ.or.jp)", + "Shuji Narazaki", + "May 2000", N_("/Filters/Colors/_Max RGB..."), - "RGB*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "RGB*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -141,12 +141,12 @@ run (const gchar *name, gimp_get_data (PLUG_IN_NAME, &pvals); /* Since a channel might be selected, we must check wheter RGB or not. */ if (!gimp_drawable_is_rgb (drawable->drawable_id)) - { - g_message (_("Can only operate on RGB drawables.")); - return; - } + { + g_message (_("Can only operate on RGB drawables.")); + return; + } if (! dialog (drawable)) - return; + return; break; case GIMP_RUN_NONINTERACTIVE: /* You must copy the values of parameters to pvals or dialog variables. */ @@ -175,9 +175,9 @@ typedef struct { static void max_rgb_func (const guchar *src, - guchar *dest, - gint bpp, - gpointer data) + guchar *dest, + gint bpp, + gpointer data) { MaxRgbParam_t *param = (MaxRgbParam_t*) data; gint ch, max_ch = 0; @@ -187,15 +187,15 @@ max_rgb_func (const guchar *src, for (ch = 0; ch < 3; ch++) if (param->flag * max <= param->flag * (tmp_value = (*src++))) { - if (max == tmp_value) - { - max_ch += 1 << ch; - } - else - { - max_ch = 1 << ch; /* clear memories of old channels */ - max = tmp_value; - } + if (max == tmp_value) + { + max_ch += 1 << ch; + } + else + { + max_ch = 1 << ch; /* clear memories of old channels */ + max = tmp_value; + } } dest[0] = (max_ch & (1 << 0)) ? max : 0; @@ -207,7 +207,7 @@ max_rgb_func (const guchar *src, static GimpPDBStatusType main_function (GimpDrawable *drawable, - gboolean preview_mode) + gboolean preview_mode) { MaxRgbParam_t param; @@ -217,7 +217,7 @@ main_function (GimpDrawable *drawable, if (preview_mode) { - gimp_fixme_preview_update (preview, max_rgb_func, ¶m); + gimp_old_preview_update (preview, max_rgb_func, ¶m); } else { @@ -247,12 +247,12 @@ dialog (GimpDrawable *drawable) dlg = gimp_dialog_new (_("Max RGB"), "max_rgb", NULL, 0, - gimp_standard_help_func, "filters/max_rgb.html", + gimp_standard_help_func, "filters/max_rgb.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); @@ -260,22 +260,22 @@ dialog (GimpDrawable *drawable) TRUE, TRUE, 0); gtk_widget_show (main_vbox); - preview = gimp_fixme_preview_new (drawable, TRUE); + preview = gimp_old_preview_new (drawable, TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), preview->frame, FALSE, FALSE, 0); main_function (drawable, TRUE); gtk_widget_show (preview->widget); frame = gimp_int_radio_group_new (TRUE, _("Parameter Settings"), - G_CALLBACK (radio_callback), - &pvals.max_p, pvals.max_p, + G_CALLBACK (radio_callback), + &pvals.max_p, pvals.max_p, - _("_Hold the Maximal Channels"), - MAX_CHANNELS, &max, + _("_Hold the Maximal Channels"), + MAX_CHANNELS, &max, - _("Ho_ld the Minimal Channels"), - MIN_CHANNELS, &min, + _("Ho_ld the Minimal Channels"), + MIN_CHANNELS, &min, - NULL); + NULL); g_object_set_data (G_OBJECT (max), "drawable", drawable); g_object_set_data (G_OBJECT (min), "drawable", drawable); @@ -294,7 +294,7 @@ dialog (GimpDrawable *drawable) static void radio_callback (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_radio_button_update (widget, data); diff --git a/plug-ins/common/nlfilt.c b/plug-ins/common/nlfilt.c index e6a13c8ed5..db7a4d9ea0 100644 --- a/plug-ins/common/nlfilt.c +++ b/plug-ins/common/nlfilt.c @@ -63,36 +63,36 @@ typedef enum } FilterType; static gint do_preview = TRUE; -static GimpFixMePreview *preview; +static GimpOldPreview *preview; static GtkWidget * mw_preview_new (GtkWidget *parent, - GimpDrawable *drawable); + GimpDrawable *drawable); /* function protos */ static void query (void); static void run (const gchar *name, - gint nparam, - const GimpParam *param, - gint *nretvals, - GimpParam **retvals); + gint nparam, + const GimpParam *param, + gint *nretvals, + GimpParam **retvals); static gint pluginCore (piArgs *argp); static gint pluginCoreIA (piArgs *argp, - GimpDrawable *drawable); + GimpDrawable *drawable); static void nlfilt_do_preview (GtkWidget *preview); static inline gint nlfiltInit (gdouble alpha, - gdouble radius, - FilterType filter); + gdouble radius, + FilterType filter); static inline void nlfiltRow (guchar *srclast, guchar *srcthis, guchar *srcnext, - guchar *dst, - gint width, - gint Bpp, - gint filtno); + guchar *dst, + gint width, + gint Bpp, + gint filtno); GimpPlugInInfo PLUG_IN_INFO = { @@ -118,16 +118,16 @@ query (void) }; gimp_install_procedure ("plug_in_nlfilt", - "Nonlinear swiss army knife filter", - "This is the pnmnlfilt, in gimp's clothing. See the pnmnlfilt manpage for details.", - "Graeme W. Gill, gimp 0.99 plugin by Eric L. Hernes", - "Graeme W. Gill, Eric L. Hernes", - "1997", - N_("/Filters/Enhance/_NL Filter..."), - "RGB,GRAY", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Nonlinear swiss army knife filter", + "This is the pnmnlfilt, in gimp's clothing. See the pnmnlfilt manpage for details.", + "Graeme W. Gill, gimp 0.99 plugin by Eric L. Hernes", + "Graeme W. Gill, Eric L. Hernes", + "1997", + N_("/Filters/Enhance/_NL Filter..."), + "RGB,GRAY", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -162,47 +162,47 @@ run (const gchar *name, case GIMP_RUN_INTERACTIVE: /* XXX: add code here for interactive running */ if (args.radius == -1) - { - args.alpha = (gdouble) 0.3; - args.radius = (gdouble) 0.3; - args.filter = 0; - } + { + args.alpha = (gdouble) 0.3; + args.radius = (gdouble) 0.3; + args.filter = 0; + } drawable = gimp_drawable_get (args.drw); if (pluginCoreIA (&args, drawable) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + } else - { - gimp_set_data ("plug_in_nlfilt", &args, sizeof (piArgs)); - } + { + gimp_set_data ("plug_in_nlfilt", &args, sizeof (piArgs)); + } break; case GIMP_RUN_NONINTERACTIVE: /* XXX: add code here for non-interactive running */ if (nparam != 6) - { - rvals[0].data.d_status = GIMP_PDB_CALLING_ERROR; - break; - } + { + rvals[0].data.d_status = GIMP_PDB_CALLING_ERROR; + break; + } args.alpha = param[3].data.d_float; args.radius = param[4].data.d_float; args.filter = param[5].data.d_int32; if (pluginCore (&args) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - break; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + break; + } break; case GIMP_RUN_WITH_LAST_VALS: /* XXX: add code here for last-values running */ if (pluginCore (&args) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + } break; } } @@ -254,7 +254,7 @@ pluginCore (piArgs *argp) for (y = 0; y < height - 1; y++) { if ((y % p_update) == 0) - gimp_progress_update ((gdouble) y / (gdouble) height); + gimp_progress_update ((gdouble) y / (gdouble) height); gimp_pixel_rgn_get_row (&srcPr, nextrow, 0, y + 1, width); memcpy (nextrow - bpp, nextrow, bpp); @@ -284,7 +284,7 @@ pluginCore (piArgs *argp) static void nlfilt_radio_button_update (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_radio_button_update (widget, data); @@ -294,7 +294,7 @@ nlfilt_radio_button_update (GtkWidget *widget, static void nlfilt_double_adjustment_update (GtkAdjustment *adjustment, - gpointer data) + gpointer data) { gimp_double_adjustment_update (adjustment, data); @@ -319,17 +319,17 @@ pluginCoreIA (piArgs *argp, GimpDrawable *drawable) dlg = gimp_dialog_new (_("NL Filter"), "nlfilt", NULL, 0, - gimp_standard_help_func, "filters/nlfilt.html", + gimp_standard_help_func, "filters/nlfilt.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_vbox, - TRUE, TRUE, 0); + TRUE, TRUE, 0); gtk_widget_show (main_vbox); hbox = gtk_hbox_new (FALSE, 4); @@ -341,17 +341,17 @@ pluginCoreIA (piArgs *argp, GimpDrawable *drawable) nlfilt_do_preview (preview); frame = gimp_int_radio_group_new (TRUE, _("Filter"), - G_CALLBACK (nlfilt_radio_button_update), - &argp->filter, argp->filter, + G_CALLBACK (nlfilt_radio_button_update), + &argp->filter, argp->filter, - _("_Alpha Trimmed Mean"), - filter_alpha_trim, NULL, - _("Op_timal Estimation"), - filter_opt_est, NULL, - _("_Edge Enhancement"), - filter_edge_enhance, NULL, + _("_Alpha Trimmed Mean"), + filter_alpha_trim, NULL, + _("Op_timal Estimation"), + filter_opt_est, NULL, + _("_Edge Enhancement"), + filter_edge_enhance, NULL, - NULL); + NULL); gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); @@ -369,19 +369,19 @@ pluginCoreIA (piArgs *argp, GimpDrawable *drawable) gtk_widget_show (table); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("A_lpha:"), 0, 0, - argp->alpha, 0.0, 1.0, 0.05, 0.1, 2, - TRUE, 0, 0, - NULL, NULL); + _("A_lpha:"), 0, 0, + argp->alpha, 0.0, 1.0, 0.05, 0.1, 2, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (nlfilt_double_adjustment_update), &argp->alpha); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("_Radius:"), 0, 0, - argp->radius, 1.0 / 3.0, 1.0, 0.05, 0.1, 2, - TRUE, 0, 0, - NULL, NULL); + _("_Radius:"), 0, 0, + argp->radius, 1.0 / 3.0, 1.0, 0.05, 0.1, 2, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (nlfilt_double_adjustment_update), &argp->radius); @@ -418,9 +418,9 @@ nlfilt_do_preview (GtkWidget *w) nlfiltRow (src0, src1, src2, dst + preview->bpp, preview->width - 2, preview->bpp, filtno); /* - We should probably fix the edges! + We should probably fix the edges! */ - gimp_fixme_preview_do_row (preview, y, preview->width, dst); + gimp_old_preview_do_row (preview, y, preview->width, dst); src0 = src1; src1 = src2; src2 += rowsize; } @@ -461,7 +461,7 @@ mw_preview_new (GtkWidget *parent, GimpDrawable *drawable) gtk_box_pack_start (GTK_BOX (vbox), pframe, FALSE, FALSE, 0); gtk_widget_show (pframe); - preview = gimp_fixme_preview_new (drawable, FALSE); + preview = gimp_old_preview_new (drawable, FALSE); gtk_container_add (GTK_CONTAINER (pframe), preview->widget); gtk_widget_show (preview->widget); @@ -552,9 +552,9 @@ mw_preview_new (GtkWidget *parent, GimpDrawable *drawable) /* and a rectangle */ static gdouble triang_area(gdouble, gdouble, gdouble, gdouble, gdouble, - gdouble, gdouble, gdouble, gint); + gdouble, gdouble, gdouble, gint); static gdouble rectang_area(gdouble, gdouble, gdouble, gdouble, - gdouble, gdouble, gdouble, gdouble); + gdouble, gdouble, gdouble, gdouble); static gdouble hex_area(gdouble, gdouble, gdouble, gdouble, gdouble); gint atfilt0(gint *p); diff --git a/plug-ins/common/noisify.c b/plug-ins/common/noisify.c index d8052fa175..c36daec545 100644 --- a/plug-ins/common/noisify.c +++ b/plug-ins/common/noisify.c @@ -65,19 +65,19 @@ typedef struct */ static void query (void); static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static void noisify (GimpDrawable *drawable, gboolean preview_mode); static gdouble gauss (GRand *gr); static gint noisify_dialog (GimpDrawable *drawable, - gint channels); + gint channels); static void noisify_double_adjustment_update (GtkAdjustment *adjustment, - gpointer data); + gpointer data); GimpPlugInInfo PLUG_IN_INFO = { @@ -99,8 +99,8 @@ static NoisifyInterface noise_int = { NULL, NULL, NULL, NULL } }; -static GimpRunMode run_mode; -static GimpFixMePreview *preview; +static GimpRunMode run_mode; +static GimpOldPreview *preview; MAIN () @@ -120,16 +120,16 @@ query (void) }; gimp_install_procedure ("plug_in_noisify", - "Adds random noise to a drawable's channels", - "More here later", - "Torsten Martinsen", - "Torsten Martinsen", - "May 2000", - N_("/Filters/Noise/_Noisify..."), - "RGB*, GRAY*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Adds random noise to a drawable's channels", + "More here later", + "Torsten Martinsen", + "Torsten Martinsen", + "May 2000", + N_("/Filters/Noise/_Noisify..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -164,26 +164,26 @@ run (const gchar *name, /* First acquire information with a dialog */ if (! noisify_dialog (drawable, drawable->bpp)) - { - gimp_drawable_detach (drawable); - return; - } + { + gimp_drawable_detach (drawable); + return; + } break; case GIMP_RUN_NONINTERACTIVE: /* Make sure all the arguments are there! */ if (nparams != 8) - { - status = GIMP_PDB_CALLING_ERROR; - } + { + status = GIMP_PDB_CALLING_ERROR; + } else - { - nvals.independent = param[3].data.d_int32 ? TRUE : FALSE; - nvals.noise[0] = param[4].data.d_float; - nvals.noise[1] = param[5].data.d_float; - nvals.noise[2] = param[6].data.d_float; - nvals.noise[3] = param[7].data.d_float; - } + { + nvals.independent = param[3].data.d_int32 ? TRUE : FALSE; + nvals.noise[0] = param[4].data.d_float; + nvals.noise[1] = param[5].data.d_float; + nvals.noise[2] = param[6].data.d_float; + nvals.noise[3] = param[7].data.d_float; + } break; case GIMP_RUN_WITH_LAST_VALS: @@ -206,11 +206,11 @@ run (const gchar *name, noisify (drawable, FALSE); if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); + gimp_displays_flush (); /* Store data */ if (run_mode == GIMP_RUN_INTERACTIVE) { - gimp_set_data ("plug_in_noisify", &nvals, sizeof (NoisifyVals)); + gimp_set_data ("plug_in_noisify", &nvals, sizeof (NoisifyVals)); } } else @@ -226,9 +226,9 @@ run (const gchar *name, static void noisify_func (const guchar *src, - guchar *dest, - gint bpp, - gpointer data) + guchar *dest, + gint bpp, + gpointer data) { GRand *gr = (GRand*) data; gint noise = 0, b; @@ -239,15 +239,15 @@ noisify_func (const guchar *src, for (b = 0; b < bpp; b++) { if (nvals.noise[b] > 0.0) - { - gint p; + { + gint p; if (nvals.independent) - noise = (gint) (nvals.noise[b] * gauss (gr) * 127); + noise = (gint) (nvals.noise[b] * gauss (gr) * 127); - p = src[b] + noise; - dest[b] = CLAMP0255 (p); - } + p = src[b] + noise; + dest[b] = CLAMP0255 (p); + } else { dest[b] = src[b]; @@ -257,14 +257,14 @@ noisify_func (const guchar *src, static void noisify (GimpDrawable *drawable, - gboolean preview_mode) + gboolean preview_mode) { GRand *gr; gr = g_rand_new (); if (preview_mode) - gimp_fixme_preview_update (preview, noisify_func, gr); + gimp_old_preview_update (preview, noisify_func, gr); else gimp_rgn_iterate2 (drawable, run_mode, noisify_func, gr); @@ -273,28 +273,28 @@ noisify (GimpDrawable *drawable, static void noisify_add_channel (GtkWidget *table, gint channel, gchar *name, - GimpDrawable *drawable) + GimpDrawable *drawable) { GtkObject *adj; adj = gimp_scale_entry_new (GTK_TABLE (table), 0, channel + 1, - name, SCALE_WIDTH, 0, - nvals.noise[channel], 0.0, 1.0, 0.01, 0.1, 2, - TRUE, 0, 0, - NULL, NULL); + name, SCALE_WIDTH, 0, + nvals.noise[channel], 0.0, 1.0, 0.01, 0.1, 2, + TRUE, 0, 0, + NULL, NULL); g_object_set_data (G_OBJECT (adj), "drawable", drawable); g_signal_connect (adj, "value_changed", - G_CALLBACK (noisify_double_adjustment_update), - &nvals.noise[channel]); + G_CALLBACK (noisify_double_adjustment_update), + &nvals.noise[channel]); noise_int.channel_adj[channel] = adj; } static gint noisify_dialog (GimpDrawable *drawable, - gint channels) + gint channels) { GtkWidget *dlg; GtkWidget *main_vbox; @@ -307,12 +307,12 @@ noisify_dialog (GimpDrawable *drawable, dlg = gimp_dialog_new (_("Noisify"), "noisify", NULL, 0, - gimp_standard_help_func, "filters/noisify.html", + gimp_standard_help_func, "filters/noisify.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); main_vbox = gtk_vbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 0); @@ -320,10 +320,10 @@ noisify_dialog (GimpDrawable *drawable, gtk_widget_show (main_vbox); /* preview */ - preview = gimp_fixme_preview_new (NULL, TRUE); + preview = gimp_old_preview_new (NULL, TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), preview->frame, FALSE, FALSE, 0); gtk_widget_show (preview->widget); - gimp_fixme_preview_fill (preview, drawable); + gimp_old_preview_fill (preview, drawable); noisify (drawable, TRUE); /* preview noisify */ /* parameter settings */ @@ -381,13 +381,13 @@ noisify_dialog (GimpDrawable *drawable, gint i; for (i = 0; i < channels; i++) - { - buffer = g_strdup_printf (_("Channel #%d:"), i); + { + buffer = g_strdup_printf (_("Channel #%d:"), i); - noisify_add_channel (table, i, buffer, drawable); + noisify_add_channel (table, i, buffer, drawable); - g_free (buffer); - } + g_free (buffer); + } } gtk_widget_show (dlg); @@ -424,7 +424,7 @@ gauss (GRand *gr) static void noisify_double_adjustment_update (GtkAdjustment *adjustment, - gpointer data) + gpointer data) { GimpDrawable *drawable; @@ -439,8 +439,8 @@ noisify_double_adjustment_update (GtkAdjustment *adjustment, gint i; for (i = 0; i < noise_int.channels; i++) - if (adjustment != GTK_ADJUSTMENT (noise_int.channel_adj[i])) - gtk_adjustment_set_value (GTK_ADJUSTMENT (noise_int.channel_adj[i]), - adjustment->value); + if (adjustment != GTK_ADJUSTMENT (noise_int.channel_adj[i])) + gtk_adjustment_set_value (GTK_ADJUSTMENT (noise_int.channel_adj[i]), + adjustment->value); } } diff --git a/plug-ins/common/nova.c b/plug-ins/common/nova.c index baef19b72b..a7f9d573b2 100644 --- a/plug-ins/common/nova.c +++ b/plug-ins/common/nova.c @@ -90,8 +90,8 @@ static char rcsid[] = "$Id$"; GDK_BUTTON_PRESS_MASK | \ GDK_BUTTON1_MOTION_MASK) -static GimpFixMePreview *preview; -static gboolean show_cursor = FALSE; +static GimpOldPreview *preview; +static gboolean show_cursor = FALSE; typedef struct { @@ -122,30 +122,30 @@ typedef struct */ static void query (void); static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static void nova (GimpDrawable *drawable, - gboolean preview_mode); + gboolean preview_mode); static gint nova_dialog (GimpDrawable *drawable); static GtkWidget * nova_center_create (GimpDrawable *drawable); static void nova_center_destroy (GtkWidget *widget, - gpointer data); + gpointer data); static void nova_center_draw (NovaCenter *center, - gint update); + gint update); static void nova_center_adjustment_update (GtkAdjustment *widget, - gpointer data); + gpointer data); static void nova_center_cursor_update (NovaCenter *center); static gint nova_center_preview_expose (GtkWidget *widget, - GdkEvent *event, - gpointer data); + GdkEvent *event, + gpointer data); static gint nova_center_preview_events (GtkWidget *widget, - GdkEvent *event, - gpointer data); + GdkEvent *event, + gpointer data); GimpPlugInInfo PLUG_IN_INFO = { @@ -186,14 +186,14 @@ query (void) gimp_install_procedure ("plug_in_nova", "Produce Supernova effect to the specified drawable", "This plug-in produces an effect like a supernova " - "burst. The amount of the light effect is " - "approximately in proportion to 1/r, where r is the " - "distance from the center of the star. It works with " - "RGB*, GRAY* image.", + "burst. The amount of the light effect is " + "approximately in proportion to 1/r, where r is the " + "distance from the center of the star. It works with " + "RGB*, GRAY* image.", "Eiichi Takamori", "Eiichi Takamori", "May 2000", - /* don't translate '' */ + /* don't translate '' */ N_("/Filters/Light Effects/Su_perNova..."), "RGB*, GRAY*", GIMP_PLUGIN, @@ -249,14 +249,14 @@ run (const gchar *name, { pvals.xcenter = param[3].data.d_int32; pvals.ycenter = param[4].data.d_int32; - pvals.color = param[5].data.d_color; + pvals.color = param[5].data.d_color; pvals.radius = param[6].data.d_int32; pvals.nspoke = param[7].data.d_int32; - pvals.randomhue = param[8].data.d_int32; + pvals.randomhue = param[8].data.d_int32; } if ((status == GIMP_PDB_SUCCESS) && - pvals.radius <= 0) + pvals.radius <= 0) status = GIMP_PDB_CALLING_ERROR; break; @@ -273,7 +273,7 @@ run (const gchar *name, { /* Make sure that the drawable is gray or RGB color */ if (gimp_drawable_is_rgb (drawable->drawable_id) || - gimp_drawable_is_gray (drawable->drawable_id)) + gimp_drawable_is_gray (drawable->drawable_id)) { gimp_progress_init (_("Rendering SuperNova...")); gimp_tile_cache_ntiles (TILE_CACHE_SIZE); @@ -318,12 +318,12 @@ nova_dialog (GimpDrawable *drawable) dlg = gimp_dialog_new (_("SuperNova"), "nova", NULL, 0, - gimp_standard_help_func, "filters/nova.html", + gimp_standard_help_func, "filters/nova.html", - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + NULL); /* parameter settings */ frame = gtk_frame_new (_("Parameter Settings")); @@ -343,11 +343,11 @@ nova_dialog (GimpDrawable *drawable) gtk_table_attach (GTK_TABLE (table), center_frame, 0, 3, 0, 1, 0, 0, 0, 0); button = gimp_color_button_new (_("SuperNova Color Picker"), - SCALE_WIDTH - 8, 16, - &pvals.color, GIMP_COLOR_AREA_FLAT); + SCALE_WIDTH - 8, 16, + &pvals.color, GIMP_COLOR_AREA_FLAT); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, - _("Co_lor:"), 1.0, 0.5, - button, 1, TRUE); + _("Co_lor:"), 1.0, 0.5, + button, 1, TRUE); g_signal_connect (button, "color_changed", G_CALLBACK (gimp_color_button_get_color), @@ -357,10 +357,10 @@ nova_dialog (GimpDrawable *drawable) drawable); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, - _("_Radius:"), SCALE_WIDTH, 8, - pvals.radius, 1, 100, 1, 10, 0, - FALSE, 1, GIMP_MAX_IMAGE_SIZE, - NULL, NULL); + _("_Radius:"), SCALE_WIDTH, 8, + pvals.radius, 1, 100, 1, 10, 0, + FALSE, 1, GIMP_MAX_IMAGE_SIZE, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.radius); @@ -368,10 +368,10 @@ nova_dialog (GimpDrawable *drawable) G_CALLBACK (nova), drawable); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4, - _("_Spokes:"), SCALE_WIDTH, 8, - pvals.nspoke, 1, 1024, 1, 16, 0, - TRUE, 0, 0, - NULL, NULL); + _("_Spokes:"), SCALE_WIDTH, 8, + pvals.nspoke, 1, 1024, 1, 16, 0, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.nspoke); @@ -380,10 +380,10 @@ nova_dialog (GimpDrawable *drawable) drawable); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5, - _("R_andom Hue:"), SCALE_WIDTH, 8, - pvals.randomhue, 0, 360, 1, 15, 0, - TRUE, 0, 0, - NULL, NULL); + _("R_andom Hue:"), SCALE_WIDTH, 8, + pvals.randomhue, 0, 360, 1, 15, 0, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), &pvals.randomhue); @@ -456,15 +456,15 @@ nova_center_create (GimpDrawable *drawable) label = gtk_label_new_with_mnemonic (_("_X:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); spinbutton = gimp_spin_button_new (¢er->xadj, - pvals.xcenter, G_MININT, G_MAXINT, - 1, 10, 10, 0, 0); + pvals.xcenter, G_MININT, G_MAXINT, + 1, 10, 10, 0, 0); gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (spinbutton); gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton); @@ -477,15 +477,15 @@ nova_center_create (GimpDrawable *drawable) label = gtk_label_new_with_mnemonic (_("_Y:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); spinbutton = gimp_spin_button_new (¢er->yadj, - pvals.ycenter, G_MININT, G_MAXINT, - 1, 10, 10, 0, 0); + pvals.ycenter, G_MININT, G_MAXINT, + 1, 10, 10, 0, 0); gtk_table_attach (GTK_TABLE (table), spinbutton, 3, 4, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (spinbutton); gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton); @@ -499,10 +499,10 @@ nova_center_create (GimpDrawable *drawable) pframe = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (pframe), GTK_SHADOW_IN); gtk_table_attach (GTK_TABLE (table), pframe, 0, 4, 1, 2, - 0, 0, 0, 0); + 0, 0, 0, 0); /* PREVIEW */ - preview = gimp_fixme_preview_new (drawable, FALSE); + preview = gimp_old_preview_new (drawable, FALSE); gtk_widget_set_events (preview->widget, PREVIEW_MASK); gtk_container_add (GTK_CONTAINER (pframe), preview->widget); gtk_widget_show (preview->widget); @@ -523,7 +523,7 @@ nova_center_create (GimpDrawable *drawable) check = gtk_check_button_new_with_mnemonic (_("S_how Cursor")); gtk_table_attach (GTK_TABLE (table), check, 0, 4, 2, 3, - GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), show_cursor); gtk_widget_show (check); @@ -545,7 +545,7 @@ nova_center_create (GimpDrawable *drawable) static void nova_center_destroy (GtkWidget *widget, - gpointer data) + gpointer data) { NovaCenter *center = data; g_free (center); @@ -559,7 +559,7 @@ nova_center_destroy (GtkWidget *widget, static void nova_center_draw (NovaCenter *center, - gint update) + gint update) { GtkWidget *prvw = preview->widget; @@ -572,28 +572,28 @@ nova_center_draw (NovaCenter *center, { gdk_gc_set_function (prvw->style->black_gc, GDK_INVERT); if (show_cursor) - { - if (center->cursor) - { - gdk_draw_line (prvw->window, - prvw->style->black_gc, - center->oldx, 1, center->oldx, - preview->height - 1); - gdk_draw_line (prvw->window, - prvw->style->black_gc, - 1, center->oldy, - preview->width - 1, center->oldy); - } + { + if (center->cursor) + { + gdk_draw_line (prvw->window, + prvw->style->black_gc, + center->oldx, 1, center->oldx, + preview->height - 1); + gdk_draw_line (prvw->window, + prvw->style->black_gc, + 1, center->oldy, + preview->width - 1, center->oldy); + } - gdk_draw_line (prvw->window, - prvw->style->black_gc, - center->curx, 1, center->curx, - preview->height - 1); - gdk_draw_line (prvw->window, - prvw->style->black_gc, - 1, center->cury, - preview->width - 1, center->cury); - } + gdk_draw_line (prvw->window, + prvw->style->black_gc, + center->curx, 1, center->curx, + preview->height - 1); + gdk_draw_line (prvw->window, + prvw->style->black_gc, + 1, center->cury, + preview->width - 1, center->cury); + } /* current position of cursor is updated */ center->oldx = center->curx; @@ -609,7 +609,7 @@ nova_center_draw (NovaCenter *center, static void nova_center_adjustment_update (GtkAdjustment *adjustment, - gpointer data) + gpointer data) { NovaCenter *center; @@ -646,7 +646,7 @@ nova_center_cursor_update (NovaCenter *center) static gint nova_center_preview_expose (GtkWidget *widget, GdkEvent *event, - gpointer data) + gpointer data) { printf("Before\n"); nova_center_draw ((NovaCenter*) data, ALL); @@ -660,8 +660,8 @@ nova_center_preview_expose (GtkWidget *widget, static gint nova_center_preview_events (GtkWidget *widget, - GdkEvent *event, - gpointer data) + GdkEvent *event, + gpointer data) { NovaCenter *center; GdkEventButton *bevent; @@ -683,18 +683,18 @@ nova_center_preview_events (GtkWidget *widget, case GDK_MOTION_NOTIFY: mevent = (GdkEventMotion *) event; if (!mevent->state) - break; + break; center->curx = mevent->x; center->cury = mevent->y; mouse: nova_center_draw (center, CURSOR); center->in_call = TRUE; gtk_adjustment_set_value (GTK_ADJUSTMENT (center->xadj), - center->curx * center->dwidth / - preview->width); + center->curx * center->dwidth / + preview->width); gtk_adjustment_set_value (GTK_ADJUSTMENT (center->yadj), - center->cury * center->dheight / - preview->height); + center->cury * center->dheight / + preview->height); center->in_call = FALSE; nova (center->drawable, 1); break; @@ -768,11 +768,11 @@ nova (GimpDrawable *drawable, spoke[i] = gauss (gr); hsv.h += ((gdouble) pvals.randomhue / 360.0) * - g_rand_double_range (gr, -0.5, 0.5); + g_rand_double_range (gr, -0.5, 0.5); if (hsv.h < 0) - hsv.h += 1.0; + hsv.h += 1.0; else if (hsv.h >= 1.0) - hsv.h -= 1.0; + hsv.h -= 1.0; gimp_hsv_to_rgb (&hsv, spokecolor + i); } @@ -798,9 +798,9 @@ nova (GimpDrawable *drawable, yc = pvals.ycenter; gimp_pixel_rgn_init (&src_rgn, drawable, - x1, y1, x2-x1, y2-y1, FALSE, FALSE); + x1, y1, x2-x1, y2-y1, FALSE, FALSE); gimp_pixel_rgn_init (&dest_rgn, drawable, - x1, y1, x2-x1, y2-y1, TRUE, TRUE); + x1, y1, x2-x1, y2-y1, TRUE, TRUE); } /* Initialize progress */ @@ -837,41 +837,41 @@ nova (GimpDrawable *drawable, nova_alpha = CLAMP (w, 0.0, 1.0); - /* blend two neighbored spokecolors */ - color = spokecolor[i]; - gimp_rgb_set_alpha (&color, 1.0); - gimp_rgb_set_alpha (spokecolor + ((i + 1) % pvals.nspoke), c); - gimp_rgb_composite (&color, - spokecolor + (i + 1) % pvals.nspoke, - GIMP_RGB_COMPOSITE_NORMAL); + /* blend two neighbored spokecolors */ + color = spokecolor[i]; + gimp_rgb_set_alpha (&color, 1.0); + gimp_rgb_set_alpha (spokecolor + ((i + 1) % pvals.nspoke), c); + gimp_rgb_composite (&color, + spokecolor + (i + 1) % pvals.nspoke, + GIMP_RGB_COMPOSITE_NORMAL); - if (w > 1.0) - { - gimp_rgb_multiply (&color, w); - gimp_rgb_clamp (&color); - } - else - { - gimp_rgba_set_uchar (&src_color, - src[0], src[1], src[2], 1.0); - gimp_rgb_set_alpha (&color, nova_alpha); - gimp_rgb_composite (&color, &src_color, - GIMP_RGB_COMPOSITE_BEHIND); - } + if (w > 1.0) + { + gimp_rgb_multiply (&color, w); + gimp_rgb_clamp (&color); + } + else + { + gimp_rgba_set_uchar (&src_color, + src[0], src[1], src[2], 1.0); + gimp_rgb_set_alpha (&color, nova_alpha); + gimp_rgb_composite (&color, &src_color, + GIMP_RGB_COMPOSITE_BEHIND); + } -/* c = CLAMP (w1 * w, 0.0, 1.0); */ -/* gimp_rgb_add (&color, c); */ +/* c = CLAMP (w1 * w, 0.0, 1.0); */ +/* gimp_rgb_add (&color, c); */ - gimp_rgb_get_uchar (&color, - dest, dest + 1, dest + 2); + gimp_rgb_get_uchar (&color, + dest, dest + 1, dest + 2); - src += bpp; + src += bpp; dest += bpp; } src_row += preview->rowstride; - gimp_fixme_preview_do_row (preview, row, y2, dest_row); + gimp_old_preview_do_row (preview, row, y2, dest_row); } gtk_widget_queue_draw (preview->widget); @@ -881,107 +881,107 @@ nova (GimpDrawable *drawable, #ifdef EEEEK for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn); - pr != NULL; pr = gimp_pixel_rgns_process (pr)) - { - src_row = src_rgn.data; - dest_row = dest_rgn.data; + pr != NULL; pr = gimp_pixel_rgns_process (pr)) + { + src_row = src_rgn.data; + dest_row = dest_rgn.data; - for (row = 0, y = src_rgn.y; row < src_rgn.h; row++, y++) - { - src = src_row; - dest = dest_row; + for (row = 0, y = src_rgn.y; row < src_rgn.h; row++, y++) + { + src = src_row; + dest = dest_row; - for (col = 0, x = src_rgn.x; col < src_rgn.w; col++, x++) - { - u = (gdouble) (x-xc) / pvals.radius; - v = (gdouble) (y-yc) / pvals.radius; - l = sqrt(u*u + v*v); + for (col = 0, x = src_rgn.x; col < src_rgn.w; col++, x++) + { + u = (gdouble) (x-xc) / pvals.radius; + v = (gdouble) (y-yc) / pvals.radius; + l = sqrt(u*u + v*v); - /* This algorithm is still under construction. */ - c = (atan2 (u, v) / (2 * G_PI) + .51) * pvals.nspoke; - i = (gint) floor (c); - c -= i; - i %= pvals.nspoke; - w1 = spoke[i] * (1 - c) + spoke[(i + 1) % pvals.nspoke] * c; - w1 = w1 * w1; + /* This algorithm is still under construction. */ + c = (atan2 (u, v) / (2 * G_PI) + .51) * pvals.nspoke; + i = (gint) floor (c); + c -= i; + i %= pvals.nspoke; + w1 = spoke[i] * (1 - c) + spoke[(i + 1) % pvals.nspoke] * c; + w1 = w1 * w1; - w = 1/(l+0.001)*0.9; + w = 1/(l+0.001)*0.9; - nova_alpha = CLAMP (w, 0.0, 1.0); + nova_alpha = CLAMP (w, 0.0, 1.0); - switch (bpp) - { - case 1: - gimp_rgba_set_uchar (&src_color, - src[0], src[0], src[0], 1.0); - break; - case 2: - gimp_rgba_set_uchar (&src_color, - src[0], src[0], src[0], src[1]); - break; - case 3: - gimp_rgba_set_uchar (&src_color, - src[0], src[1], src[2], 1.0); - break; - case 4: - gimp_rgba_set_uchar (&src_color, - src[0], src[1], src[2], src[3]); - break; - } + switch (bpp) + { + case 1: + gimp_rgba_set_uchar (&src_color, + src[0], src[0], src[0], 1.0); + break; + case 2: + gimp_rgba_set_uchar (&src_color, + src[0], src[0], src[0], src[1]); + break; + case 3: + gimp_rgba_set_uchar (&src_color, + src[0], src[1], src[2], 1.0); + break; + case 4: + gimp_rgba_set_uchar (&src_color, + src[0], src[1], src[2], src[3]); + break; + } - if (has_alpha) - { - src_alpha = (gdouble) src[alpha] / 255.0; - new_alpha = src_alpha + (1.0 - src_alpha) * nova_alpha; + if (has_alpha) + { + src_alpha = (gdouble) src[alpha] / 255.0; + new_alpha = src_alpha + (1.0 - src_alpha) * nova_alpha; - if (new_alpha != 0.0) - ratio = nova_alpha / new_alpha; - else - ratio = 0.0; - } - else - ratio = nova_alpha; + if (new_alpha != 0.0) + ratio = nova_alpha / new_alpha; + else + ratio = 0.0; + } + else + ratio = nova_alpha; - compl_ratio = 1.0 - ratio; + compl_ratio = 1.0 - ratio; - for (j = 0; j < alpha; j++) - { - spokecol = (gdouble)spokecolor[3*i+j]*(1.0-c) + - (gdouble)spokecolor[3*((i + 1) % pvals.nspoke)+j]*c; - if (w > 1.0) - color[j] = CLAMP (spokecol * w, 0, 255); - else - color[j] = src[j] * compl_ratio + spokecol * ratio; + for (j = 0; j < alpha; j++) + { + spokecol = (gdouble)spokecolor[3*i+j]*(1.0-c) + + (gdouble)spokecolor[3*((i + 1) % pvals.nspoke)+j]*c; + if (w > 1.0) + color[j] = CLAMP (spokecol * w, 0, 255); + else + color[j] = src[j] * compl_ratio + spokecol * ratio; - c = CLAMP (w1 * w, 0, 1); - color[j] = color[j] + 255 * c; + c = CLAMP (w1 * w, 0, 1); + color[j] = color[j] + 255 * c; - dest[j]= CLAMP (color[j], 0, 255); - } + dest[j]= CLAMP (color[j], 0, 255); + } - if (has_alpha) - dest[alpha] = new_alpha * 255.0; + if (has_alpha) + dest[alpha] = new_alpha * 255.0; - src += src_rgn.bpp; - dest += dest_rgn.bpp; - } - src_row += src_rgn.rowstride; - dest_row += dest_rgn.rowstride; - } + src += src_rgn.bpp; + dest += dest_rgn.bpp; + } + src_row += src_rgn.rowstride; + dest_row += dest_rgn.rowstride; + } - /* Update progress */ - progress += src_rgn.w * src_rgn.h; - gimp_progress_update ((gdouble) progress / (gdouble) max_progress); - } + /* Update progress */ + progress += src_rgn.w * src_rgn.h; + gimp_progress_update ((gdouble) progress / (gdouble) max_progress); + } gimp_drawable_flush (drawable); gimp_drawable_merge_shadow (drawable->drawable_id, TRUE); gimp_drawable_update (drawable->drawable_id, - x1, y1, (x2 - x1), (y2 - y1)); + x1, y1, (x2 - x1), (y2 - y1)); #else gimp_message ("Sorry, the SuperNova effect\n" - "is broken at the moment and\n" - "has been temporarily disabled."); + "is broken at the moment and\n" + "has been temporarily disabled."); #endif } diff --git a/plug-ins/common/plasma.c b/plug-ins/common/plasma.c index cec73306ef..84d426aa73 100644 --- a/plug-ins/common/plasma.c +++ b/plug-ins/common/plasma.c @@ -148,7 +148,7 @@ static PlasmaValues pvals = * Some globals to save passing too many paramaters that don't change. */ -static GimpFixMePreview *preview; +static GimpOldPreview *preview; static gint ix1, iy1, ix2, iy2; /* Selected image size. */ static gint bpp, alpha; static gboolean has_alpha; @@ -311,7 +311,7 @@ plasma_dialog (GimpDrawable *drawable, main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); - preview = gimp_fixme_preview_new2 (drawable_type, TRUE); + preview = gimp_old_preview_new2 (drawable_type, TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), preview->frame, FALSE, FALSE, 0); plasma (drawable, TRUE); /* preview image */ @@ -483,7 +483,7 @@ get_pixel (GimpPixelFetcher *pft, } else { - gimp_fixme_preview_get_pixel (preview, x, y, pixel); + gimp_old_preview_get_pixel (preview, x, y, pixel); } } @@ -500,7 +500,7 @@ put_pixel (GimpPixelFetcher *pft, } else { - gimp_fixme_preview_put_pixel (preview, x, y, pixel); + gimp_old_preview_put_pixel (preview, x, y, pixel); } } diff --git a/plug-ins/common/polar.c b/plug-ins/common/polar.c index 6d5c17ab58..7422bf7cac 100644 --- a/plug-ins/common/polar.c +++ b/plug-ins/common/polar.c @@ -93,7 +93,7 @@ typedef struct gint polrec; } polarize_vals_t; -static GimpFixMePreview *preview; +static GimpOldPreview *preview; /***** Prototypes *****/ @@ -609,7 +609,7 @@ polarize_dialog (void) gtk_container_add (GTK_CONTAINER (abox), pframe); gtk_widget_show (pframe); - preview = gimp_fixme_preview_new (drawable, FALSE); + preview = gimp_old_preview_new (drawable, FALSE); gtk_container_add (GTK_CONTAINER (pframe), preview->widget); gtk_widget_show (preview->widget); @@ -706,7 +706,7 @@ polarize_dialog (void) gtk_widget_destroy (dialog); - gimp_fixme_preview_free (preview); + gimp_old_preview_free (preview); return run; } @@ -776,7 +776,7 @@ dialog_update_preview (void) px += dx; } - gimp_fixme_preview_do_row (preview, y, preview->width, buffer); + gimp_old_preview_do_row (preview, y, preview->width, buffer); py += dy; } diff --git a/plug-ins/common/waves.c b/plug-ins/common/waves.c index 06ed8a40d9..6da909024f 100644 --- a/plug-ins/common/waves.c +++ b/plug-ins/common/waves.c @@ -55,38 +55,38 @@ typedef struct } piArgs; /* preview stuff -- to be removed as soon as we have a real libgimp preview */ -static gint do_preview = TRUE; -static GimpFixMePreview *preview; +static gint do_preview = TRUE; +static GimpOldPreview *preview; static GtkWidget *mw_preview_new (GtkWidget *parent, - GimpDrawable *drawable); + GimpDrawable *drawable); static void query (void); static void run (const gchar *name, - gint nparam, - const GimpParam *param, - gint *nretvals, - GimpParam **retvals); + gint nparam, + const GimpParam *param, + gint *nretvals, + GimpParam **retvals); static gint pluginCore (piArgs *argp, - GimpDrawable *drawable); + GimpDrawable *drawable); static gint pluginCoreIA (piArgs *argp, - GimpDrawable *drawable); + GimpDrawable *drawable); static void waves_do_preview (void); static void wave (guchar *src, - guchar *dest, - gint width, - gint height, - gint bypp, - gboolean has_alpha, - gdouble amplitude, - gdouble wavelength, - gdouble phase, - gint smear, - gint reflective, - gint verbose); + guchar *dest, + gint width, + gint height, + gint bypp, + gboolean has_alpha, + gdouble amplitude, + gdouble wavelength, + gdouble phase, + gint smear, + gint reflective, + gint verbose); #define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? TRUE : FALSE) @@ -116,16 +116,16 @@ query (void) }; gimp_install_procedure ("plug_in_waves", - "Distort the image with waves", - "none yet", - "Eric L. Hernes, Stephen Norris", - "Stephen Norris", - "1997", - N_("/Filters/Distorts/_Waves..."), - "RGB*, GRAY*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Distort the image with waves", + "none yet", + "Eric L. Hernes, Stephen Norris", + "Stephen Norris", + "1997", + N_("/Filters/Distorts/_Waves..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -160,32 +160,32 @@ run (const gchar *name, case GIMP_RUN_INTERACTIVE: /* XXX: add code here for interactive running */ if (args.type == -1) - { - args.amplitude = 10.0; - args.wavelength = 10; - args.phase = 0.0; - args.type = MODE_SMEAR; - args.reflective = 0; - } + { + args.amplitude = 10.0; + args.wavelength = 10; + args.phase = 0.0; + args.type = MODE_SMEAR; + args.reflective = 0; + } if (pluginCoreIA(&args, drawable) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + } else - { - gimp_set_data ("plug_in_waves", &args, sizeof (piArgs)); - } + { + gimp_set_data ("plug_in_waves", &args, sizeof (piArgs)); + } break; case GIMP_RUN_NONINTERACTIVE: /* XXX: add code here for non-interactive running */ if (nparam != 8) - { - rvals[0].data.d_status = GIMP_PDB_CALLING_ERROR; - break; - } + { + rvals[0].data.d_status = GIMP_PDB_CALLING_ERROR; + break; + } args.amplitude = param[3].data.d_float; args.phase = param[4].data.d_float; args.wavelength = param[5].data.d_float; @@ -193,25 +193,25 @@ run (const gchar *name, args.reflective = param[7].data.d_int32; if (pluginCore (&args, drawable) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - break; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + break; + } break; case GIMP_RUN_WITH_LAST_VALS: /* XXX: add code here for last-values running */ if (pluginCore (&args, drawable) == -1) - { - rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - } + { + rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + } break; } } static gint pluginCore (piArgs *argp, - GimpDrawable *drawable) + GimpDrawable *drawable) { gint retval=0; GimpPixelRgn srcPr, dstPr; @@ -248,7 +248,7 @@ pluginCore (piArgs *argp, static void waves_toggle_button_update (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_toggle_button_update (widget, data); waves_do_preview (); @@ -256,7 +256,7 @@ waves_toggle_button_update (GtkWidget *widget, static void waves_radio_button_update (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_radio_button_update (widget, data); @@ -266,7 +266,7 @@ waves_radio_button_update (GtkWidget *widget, static void waves_double_adjustment_update (GtkAdjustment *adjustment, - gpointer data) + gpointer data) { gimp_double_adjustment_update (adjustment, data); waves_do_preview (); @@ -274,7 +274,7 @@ waves_double_adjustment_update (GtkAdjustment *adjustment, static gint pluginCoreIA (piArgs *argp, - GimpDrawable *drawable) + GimpDrawable *drawable) { GtkWidget *dlg; GtkWidget *main_vbox; @@ -292,7 +292,7 @@ pluginCoreIA (piArgs *argp, dlg = gimp_dialog_new (_("Waves"), "waves", NULL, 0, - gimp_standard_help_func, "filters/waves.html", + gimp_standard_help_func, "filters/waves.html", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, @@ -302,7 +302,7 @@ pluginCoreIA (piArgs *argp, main_vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_vbox, - TRUE, TRUE, 0); + TRUE, TRUE, 0); gtk_widget_show (main_vbox); hbox = gtk_hbox_new (FALSE, 4); @@ -314,13 +314,13 @@ pluginCoreIA (piArgs *argp, waves_do_preview (); frame = gimp_int_radio_group_new (TRUE, _("Mode"), - G_CALLBACK (waves_radio_button_update), - &argp->type, argp->type, + G_CALLBACK (waves_radio_button_update), + &argp->type, argp->type, - _("_Smear"), MODE_SMEAR, NULL, - _("_Blacken"), MODE_BLACKEN, NULL, + _("_Smear"), MODE_SMEAR, NULL, + _("_Blacken"), MODE_BLACKEN, NULL, - NULL); + NULL); gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); gtk_widget_show (frame); @@ -351,28 +351,28 @@ pluginCoreIA (piArgs *argp, gtk_container_add (GTK_CONTAINER (frame), table); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("_Amplitude:"), 140, 6, - argp->amplitude, 0.0, 101.0, 1.0, 5.0, 2, - TRUE, 0, 0, - NULL, NULL); + _("_Amplitude:"), 140, 6, + argp->amplitude, 0.0, 101.0, 1.0, 5.0, 2, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (waves_double_adjustment_update), &argp->amplitude); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("_Phase:"), 140, 6, - argp->phase, 0.0, 360.0, 2.0, 5.0, 2, - TRUE, 0, 0, - NULL, NULL); + _("_Phase:"), 140, 6, + argp->phase, 0.0, 360.0, 2.0, 5.0, 2, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (waves_double_adjustment_update), &argp->phase); adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2, - _("_Wavelength:"), 140, 6, - argp->wavelength, 0.1, 50.0, 1.0, 5.0, 2, - TRUE, 0, 0, - NULL, NULL); + _("_Wavelength:"), 140, 6, + argp->wavelength, 0.1, 50.0, 1.0, 5.0, 2, + TRUE, 0, 0, + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (waves_double_adjustment_update), &argp->wavelength); @@ -403,14 +403,14 @@ waves_do_preview (void) wave (preview->cache, dst, preview->width, preview->height, preview->bpp, preview->bpp == 2 || preview->bpp == 4, - argp->amplitude * preview->scale_x, - argp->wavelength * preview->scale_x, - argp->phase, argp->type == 0, argp->reflective, 0); + argp->amplitude * preview->scale_x, + argp->wavelength * preview->scale_x, + argp->phase, argp->type == 0, argp->reflective, 0); for (y = 0; y < preview->height; y++) { - gimp_fixme_preview_do_row (preview, y, preview->width, - dst + y * preview->rowstride); + gimp_old_preview_do_row (preview, y, preview->width, + dst + y * preview->rowstride); } gtk_widget_queue_draw (preview->widget); @@ -450,9 +450,9 @@ mw_preview_new (GtkWidget *parent, GimpDrawable *drawable) gtk_box_pack_start (GTK_BOX (vbox), pframe, FALSE, FALSE, 0); gtk_widget_show (pframe); - preview = gimp_fixme_preview_new (drawable, FALSE); - /* FIXME: this forces gimp_fixme_preview to set its alpha correctly */ - gimp_fixme_preview_fill_scaled (preview, drawable); + preview = gimp_old_preview_new (drawable, FALSE); + /* FIXME: this forces gimp_old_preview to set its alpha correctly */ + gimp_old_preview_fill_scaled (preview, drawable); gtk_container_add (GTK_CONTAINER (pframe), preview->widget); gtk_widget_show (preview->widget); @@ -573,63 +573,63 @@ wave (guchar *src, dest = dst; if (verbose && (y % prog_interval == 0)) - gimp_progress_update ((double) y / (double) height); + gimp_progress_update ((double) y / (double) height); for (x = x1; x < x2; x++) - { - /* Distance from current point to wave center, scaled */ - dx = (x - cen_x) * xscale; - dy = (y - cen_y) * yscale; + { + /* Distance from current point to wave center, scaled */ + dx = (x - cen_x) * xscale; + dy = (y - cen_y) * yscale; - /* Distance^2 to center of *circle* (our scaled ellipse) */ - d = sqrt (dx * dx + dy * dy); + /* Distance^2 to center of *circle* (our scaled ellipse) */ + d = sqrt (dx * dx + dy * dy); - /* Use the formula described above. */ + /* Use the formula described above. */ - /* Calculate waved point and scale again to ellipsify */ + /* Calculate waved point and scale again to ellipsify */ - /* - * Reflective waves are strange - the effect is much - * more like a mirror which is in the shape of - * the wave than anything else. - */ + /* + * Reflective waves are strange - the effect is much + * more like a mirror which is in the shape of + * the wave than anything else. + */ - if (reflective) - { - amnt = amplitude * fabs (sin (((d / wavelength) * (2.0 * G_PI) + - phase))); + if (reflective) + { + amnt = amplitude * fabs (sin (((d / wavelength) * (2.0 * G_PI) + + phase))); - needx = (amnt * dx) / xscale + cen_x; - needy = (amnt * dy) / yscale + cen_y; - } - else - { - amnt = amplitude * sin (((d / wavelength) * (2.0 * G_PI) + - phase)); + needx = (amnt * dx) / xscale + cen_x; + needy = (amnt * dy) / yscale + cen_y; + } + else + { + amnt = amplitude * sin (((d / wavelength) * (2.0 * G_PI) + + phase)); - needx = (amnt + dx) / xscale + cen_x; - needy = (amnt + dy) / yscale + cen_y; - } + needx = (amnt + dx) / xscale + cen_x; + needy = (amnt + dy) / yscale + cen_y; + } - /* Calculations complete; now copy the proper pixel */ + /* Calculations complete; now copy the proper pixel */ - if (smear) - { - xi = CLAMP (needx, 0, width - 2); - yi = CLAMP (needy, 0, height - 2); - } - else - { - xi = needx; - yi = needy; - } + if (smear) + { + xi = CLAMP (needx, 0, width - 2); + yi = CLAMP (needy, 0, height - 2); + } + else + { + xi = needx; + yi = needy; + } - p = src + rowsiz * yi + xi * bypp; + p = src + rowsiz * yi + xi * bypp; - x1_in = WITHIN (0, xi, width - 1); - y1_in = WITHIN (0, yi, height - 1); - x2_in = WITHIN (0, xi + 1, width - 1); - y2_in = WITHIN (0, yi + 1, height - 1); + x1_in = WITHIN (0, xi, width - 1); + y1_in = WITHIN (0, yi, height - 1); + x2_in = WITHIN (0, xi + 1, width - 1); + y2_in = WITHIN (0, yi + 1, height - 1); if (x1_in && y1_in) values[0] = p; @@ -653,7 +653,7 @@ wave (guchar *src, gimp_bilinear_pixels_8 (dest, needx, needy, bypp, has_alpha, values); dest += bypp; - } + } dst += rowsiz; } diff --git a/plug-ins/common/wind.c b/plug-ins/common/wind.c index 7f3902f855..2be0ada2a1 100644 --- a/plug-ins/common/wind.c +++ b/plug-ins/common/wind.c @@ -73,66 +73,66 @@ typedef enum static void query (void); static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); static gint dialog_box (GimpDrawable *drawable); static void radio_callback (GtkWidget *widget, - gpointer data); + gpointer data); static gint render_effect (GimpDrawable *drawable, - gboolean preview_mode); + gboolean preview_mode); static void render_wind (GimpDrawable *drawable, - gint threshold, - gint strength, - direction_t direction, - edge_t edge, - gboolean preview_mode); + gint threshold, + gint strength, + direction_t direction, + edge_t edge, + gboolean preview_mode); static void render_blast (GimpDrawable *drawable, - gint threshold, - gint strength, - direction_t direction, - edge_t edge, - gboolean preview_mode); + gint threshold, + gint strength, + direction_t direction, + edge_t edge, + gboolean preview_mode); static gint render_blast_row (guchar *buffer, - gint bytes, - gint lpi, - gint threshold, - gint strength, - edge_t edge); + 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); + gint bytes, + gint lpi, + gint threshold, + gint strength, + edge_t edge); static void get_derivative (guchar *pixel_R1, - guchar *pixel_R2, - edge_t edge, - gboolean has_alpha, - gint *derivative_R, - gint *derivative_G, - gint *derivative_B, - gint *derivative_A); + guchar *pixel_R2, + edge_t edge, + gboolean has_alpha, + gint *derivative_R, + gint *derivative_G, + gint *derivative_B, + gint *derivative_A); static gint threshold_exceeded (guchar *pixel_R1, - guchar *pixel_R2, - edge_t edge, - gint threshold, - gboolean has_alpha); + guchar *pixel_R2, + edge_t edge, + gint threshold, + gboolean has_alpha); static void reverse_buffer (guchar *buffer, - gint length, - gint bytes); + gint length, + gint bytes); GimpPlugInInfo PLUG_IN_INFO = { - NULL, /* init_proc */ - NULL, /* quit_proc */ + NULL, /* init_proc */ + NULL, /* quit_proc */ query, /* query_proc */ - run /* run_proc */ + run /* run_proc */ }; @@ -144,7 +144,7 @@ struct config_tag { gint threshold; /* derivative comparison for edge detection */ direction_t direction; /* of wind, LEFT or RIGHT */ - gint strength; /* how many pixels to bleed */ + gint strength; /* how many pixels to bleed */ algorithm_t alg; /* which algorithm */ edge_t edge; /* controls abs, ne+ static guchar *preview_bits; + static GtkWidget *preview; @@ -161,7 +161,7 @@ config_t config = LEADING /* abs(derivative); */ }; -static GimpFixMePreview *preview; +static GimpOldPreview *preview; MAIN () @@ -181,16 +181,16 @@ query (void) }; gimp_install_procedure ("plug_in_wind", - "Renders a wind effect.", - "Renders a wind effect.", - "Nigel Wetten", - "Nigel Wetten", - "May 2000", - N_("/Filters/Distorts/Wi_nd..."), - "RGB*", - GIMP_PLUGIN, - G_N_ELEMENTS (args), 0, - args, NULL); + "Renders a wind effect.", + "Renders a wind effect.", + "Nigel Wetten", + "Nigel Wetten", + "May 2000", + N_("/Filters/Distorts/Wi_nd..."), + "RGB*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -215,34 +215,34 @@ run (const gchar *name, { case GIMP_RUN_NONINTERACTIVE: if (nparams != 8) - { - status = GIMP_PDB_CALLING_ERROR; - } + { + status = GIMP_PDB_CALLING_ERROR; + } else - { - config.threshold = param[3].data.d_int32; - config.direction = param[4].data.d_int32; - config.strength = param[5].data.d_int32; - config.alg = param[6].data.d_int32; - config.edge = param[7].data.d_int32; + { + config.threshold = param[3].data.d_int32; + config.direction = param[4].data.d_int32; + config.strength = param[5].data.d_int32; + config.alg = param[6].data.d_int32; + config.edge = param[7].data.d_int32; - if (render_effect(drawable, 0) == -1) - status = GIMP_PDB_EXECUTION_ERROR; - } + if (render_effect(drawable, 0) == -1) + status = GIMP_PDB_EXECUTION_ERROR; + } break; case GIMP_RUN_INTERACTIVE: gimp_get_data("plug_in_wind", &config); if (! dialog_box (drawable)) - { - status = GIMP_PDB_CANCEL; - break; - } + { + status = GIMP_PDB_CANCEL; + break; + } if (render_effect(drawable, 0) == -1) - { - status = GIMP_PDB_CALLING_ERROR; - break; - } + { + status = GIMP_PDB_CALLING_ERROR; + break; + } gimp_set_data("plug_in_wind", &config, sizeof(config_t)); gimp_displays_flush(); break; @@ -250,14 +250,14 @@ run (const gchar *name, case GIMP_RUN_WITH_LAST_VALS: gimp_get_data("plug_in_wind", &config); if (render_effect (drawable, FALSE) == -1) - { - status = GIMP_PDB_EXECUTION_ERROR; - gimp_message("An execution error occured."); - } + { + status = GIMP_PDB_EXECUTION_ERROR; + gimp_message("An execution error occured."); + } else - { - gimp_displays_flush (); - } + { + gimp_displays_flush (); + } } gimp_drawable_detach(drawable); @@ -270,28 +270,28 @@ run (const gchar *name, static gint render_effect (GimpDrawable *drawable, - gboolean preview_mode) + gboolean preview_mode) { if (config.alg == RENDER_WIND) { render_wind (drawable, config.threshold, config.strength, - config.direction, config.edge, preview_mode); + config.direction, config.edge, preview_mode); } else if (config.alg == RENDER_BLAST) { render_blast (drawable, config.threshold, config.strength, - config.direction, config.edge, preview_mode); + config.direction, config.edge, preview_mode); } return 0; } static void render_blast (GimpDrawable *drawable, - gint threshold, - gint strength, - direction_t direction, - edge_t edge, - gboolean preview_mode) + gint threshold, + gint strength, + direction_t direction, + edge_t edge, + gboolean preview_mode) { gint x1, x2, y1, y2; gint width; @@ -342,51 +342,51 @@ render_blast (GimpDrawable *drawable, gimp_pixel_rgn_get_row (&src_region, buffer, x1, row, width); if (direction == RIGHT) - { - reverse_buffer (buffer, row_stride, bytes); - } + { + reverse_buffer (buffer, row_stride, bytes); + } marker = render_blast_row (buffer, bytes, lpi, threshold, strength, edge); if (direction == RIGHT) - { - reverse_buffer (buffer, row_stride, bytes); - } + { + reverse_buffer (buffer, row_stride, bytes); + } if (preview_mode) - { - gimp_fixme_preview_do_row(preview, row, width, buffer); - } + { + gimp_old_preview_do_row(preview, row, width, buffer); + } else - { - gimp_pixel_rgn_set_row (&dest_region, buffer, x1, row, width); - gimp_progress_update ((double) (row - y1)/ (double) (height)); - } + { + gimp_pixel_rgn_set_row (&dest_region, buffer, x1, row, width); + gimp_progress_update ((double) (row - y1)/ (double) (height)); + } if (marker) - { - gint j, limit; + { + gint j, limit; - limit = 1 + g_random_int_range (0, 2); - for (j = 0; (j < limit) && (row < y2); j++) - { - row++; - if (row < y2) - { + limit = 1 + g_random_int_range (0, 2); + for (j = 0; (j < limit) && (row < y2); j++) + { + row++; + if (row < y2) + { if (preview_mode) - { - memcpy (buffer, preview->cache + (row * row_stride), row_stride); - gimp_fixme_preview_do_row(preview, row, width, buffer); - } - else - { - gimp_pixel_rgn_get_row (&src_region, buffer, x1, row, width); - gimp_pixel_rgn_set_row (&dest_region, buffer, x1, row, width); - } - } - } - marker = 0; - } + { + memcpy (buffer, preview->cache + (row * row_stride), row_stride); + gimp_old_preview_do_row(preview, row, width, buffer); + } + else + { + gimp_pixel_rgn_get_row (&src_region, buffer, x1, row, width); + gimp_pixel_rgn_set_row (&dest_region, buffer, x1, row, width); + } + } + } + marker = 0; + } } g_free(buffer); @@ -406,11 +406,11 @@ render_blast (GimpDrawable *drawable, static void render_wind (GimpDrawable *drawable, - gint threshold, - gint strength, - direction_t direction, - edge_t edge, - gboolean preview_mode) + gint threshold, + gint strength, + direction_t direction, + edge_t edge, + gboolean preview_mode) { GimpPixelRgn src_region, dest_region; gint width; @@ -458,27 +458,27 @@ render_wind (GimpDrawable *drawable, for (row = y1; row < y2; row++) { if (preview_mode) - memcpy (sb, preview->cache + (row * row_stride), row_stride); + memcpy (sb, preview->cache + (row * row_stride), row_stride); else - gimp_pixel_rgn_get_row (&src_region, sb, x1, row, width); + gimp_pixel_rgn_get_row (&src_region, sb, x1, row, width); if (direction == RIGHT) - reverse_buffer (sb, row_stride, bytes); + reverse_buffer (sb, row_stride, bytes); render_wind_row (sb, bytes, lpi, threshold, strength, edge); if (direction == RIGHT) - reverse_buffer(sb, row_stride, bytes); + reverse_buffer(sb, row_stride, bytes); if (preview_mode) - { - gimp_fixme_preview_do_row(preview, row, width, sb); - } + { + gimp_old_preview_do_row(preview, row, width, sb); + } else - { - gimp_pixel_rgn_set_row (&dest_region, sb, x1, row, width); - gimp_progress_update ((double) (row - y1)/ (double) (height)); - } + { + gimp_pixel_rgn_set_row (&dest_region, sb, x1, row, width); + gimp_progress_update ((double) (row - y1)/ (double) (height)); + } } g_free(sb); @@ -498,11 +498,11 @@ render_wind (GimpDrawable *drawable, static gint render_blast_row (guchar *buffer, - gint bytes, - gint lpi, - gint threshold, - gint strength, - edge_t edge) + gint bytes, + gint lpi, + gint threshold, + gint strength, + edge_t edge) { gint Ri, Gi, Bi, Ai= 0; gint sbi, lbi; @@ -516,74 +516,74 @@ render_blast_row (guchar *buffer, Ri = j; Gi = j + 1; Bi = j + 2; if(bytes > 3) - Ai = j + 3; + Ai = j + 3; if (threshold_exceeded(buffer+Ri, buffer+Ri+bytes, edge, threshold, (bytes > 3))) - { - /* we have found an edge, do bleeding */ - sbi = Ri; + { + /* we have found an edge, do bleeding */ + sbi = Ri; - weight = g_random_int_range (0, 10); - if (weight > 5) /* 40% */ - { - random_factor = 2; - } - else if (weight > 3) /* 20% */ - { - random_factor = 3; - } - else /* 40% */ - { - random_factor = 4; - } - bleed_length = 0; - switch (g_random_int_range (0, random_factor)) - { - case 3: - bleed_length += strength; - /* fall through to add up multiples of strength */ - case 2: - bleed_length += strength; - /* fall through */ - case 1: - bleed_length += strength; - /* fall through */ - case 0: - bleed_length += strength; - /* fall through */ - } + weight = g_random_int_range (0, 10); + if (weight > 5) /* 40% */ + { + random_factor = 2; + } + else if (weight > 3) /* 20% */ + { + random_factor = 3; + } + else /* 40% */ + { + random_factor = 4; + } + bleed_length = 0; + switch (g_random_int_range (0, random_factor)) + { + case 3: + bleed_length += strength; + /* fall through to add up multiples of strength */ + case 2: + bleed_length += strength; + /* fall through */ + case 1: + bleed_length += strength; + /* fall through */ + case 0: + bleed_length += strength; + /* fall through */ + } - lbi = sbi + bytes * bleed_length; - if (lbi > lpi) - { - lbi = lpi; - } + lbi = sbi + bytes * bleed_length; + if (lbi > lpi) + { + lbi = lpi; + } - for (i = sbi; i < lbi; i += bytes) - { - buffer[i] = buffer[Ri]; - buffer[i+1] = buffer[Gi]; - buffer[i+2] = buffer[Bi]; - if(bytes > 3) - buffer[i+3] = buffer[Ai]; - } - j = lbi - bytes; - if (g_random_int_range (0, 10) > 7) /* 20% */ - { - skip = 1; - } - } + for (i = sbi; i < lbi; i += bytes) + { + buffer[i] = buffer[Ri]; + buffer[i+1] = buffer[Gi]; + buffer[i+2] = buffer[Bi]; + if(bytes > 3) + buffer[i+3] = buffer[Ai]; + } + j = lbi - bytes; + if (g_random_int_range (0, 10) > 7) /* 20% */ + { + skip = 1; + } + } } return skip; } static void render_wind_row (guchar *sb, - gint bytes, - gint lpi, - gint threshold, - gint strength, - edge_t edge) + gint bytes, + gint lpi, + gint threshold, + gint strength, + edge_t edge) { gint i, j; gint bleed_length; @@ -594,7 +594,7 @@ render_wind_row (guchar *sb, gint bleed_variation; gint n; gint sbi; /* starting bleed index */ - gint lbi; /* last bleed index */ + gint lbi; /* last bleed index */ gdouble denominator; gint comp_stride = bytes * COMPARE_WIDTH; @@ -606,124 +606,124 @@ render_wind_row (guchar *sb, gint Ai = 0; if(bytes > 3) - Ai = j + 3; + Ai = j + 3; if (threshold_exceeded(sb+Ri, sb+Ri+comp_stride, edge, threshold,(bytes > 3))) - { - /* we have found an edge, do bleeding */ - sbi = Ri + comp_stride; - blend_colour_R = sb[Ri]; - blend_colour_G = sb[Gi]; - blend_colour_B = sb[Bi]; - target_colour_R = sb[sbi]; - target_colour_G = sb[sbi+1]; - target_colour_B = sb[sbi+2]; - bleed_length_max = strength; + { + /* we have found an edge, do bleeding */ + sbi = Ri + comp_stride; + blend_colour_R = sb[Ri]; + blend_colour_G = sb[Gi]; + blend_colour_B = sb[Bi]; + target_colour_R = sb[sbi]; + target_colour_G = sb[sbi+1]; + target_colour_B = sb[sbi+2]; + bleed_length_max = strength; - if(bytes > 3) - { - blend_colour_A = sb[Ai]; - target_colour_A = sb[sbi+3]; - } + if(bytes > 3) + { + blend_colour_A = sb[Ai]; + target_colour_A = sb[sbi+3]; + } - if (g_random_int_range (0, 3)) /* introduce weighted randomness */ - { - bleed_length_max = strength; - } - else - { - bleed_length_max = 4 * strength; - } + if (g_random_int_range (0, 3)) /* introduce weighted randomness */ + { + bleed_length_max = strength; + } + else + { + bleed_length_max = 4 * strength; + } - bleed_variation = 1 + (gint) (bleed_length_max * g_random_double ()); + bleed_variation = 1 + (gint) (bleed_length_max * g_random_double ()); - lbi = sbi + bleed_variation * bytes; - if (lbi > lpi) - { - lbi = lpi; /* stop overunning the buffer */ - } + lbi = sbi + bleed_variation * bytes; + if (lbi > lpi) + { + lbi = lpi; /* stop overunning the buffer */ + } - bleed_length = bleed_variation; + bleed_length = bleed_variation; - blend_amt_R = target_colour_R - blend_colour_R; - blend_amt_G = target_colour_G - blend_colour_G; - blend_amt_B = target_colour_B - blend_colour_B; - if(bytes > 3) - { - blend_amt_A = target_colour_A - blend_colour_A; - } - denominator = bleed_length * bleed_length + bleed_length; - denominator = 2.0 / denominator; - n = bleed_length; - for (i = sbi; i < lbi; i += bytes) - { + blend_amt_R = target_colour_R - blend_colour_R; + blend_amt_G = target_colour_G - blend_colour_G; + blend_amt_B = target_colour_B - blend_colour_B; + if(bytes > 3) + { + blend_amt_A = target_colour_A - blend_colour_A; + } + denominator = bleed_length * bleed_length + bleed_length; + denominator = 2.0 / denominator; + n = bleed_length; + for (i = sbi; i < lbi; i += bytes) + { - /* check against original colour */ - if (!threshold_exceeded(sb+Ri, sb+i, edge, threshold,(bytes>3)) - && g_random_boolean()) - { - break; - } + /* check against original colour */ + if (!threshold_exceeded(sb+Ri, sb+i, edge, threshold,(bytes>3)) + && g_random_boolean()) + { + break; + } - blend_colour_R += blend_amt_R * n * denominator; - blend_colour_G += blend_amt_G * n * denominator; - blend_colour_B += blend_amt_B * n * denominator; + blend_colour_R += blend_amt_R * n * denominator; + blend_colour_G += blend_amt_G * n * denominator; + blend_colour_B += blend_amt_B * n * denominator; - if(bytes > 3) - { - blend_colour_A += blend_amt_A * n * denominator; - if (blend_colour_A > 255) blend_colour_A = 255; - else if (blend_colour_A < 0) blend_colour_A = 0; - } + if(bytes > 3) + { + blend_colour_A += blend_amt_A * n * denominator; + if (blend_colour_A > 255) blend_colour_A = 255; + else if (blend_colour_A < 0) blend_colour_A = 0; + } - if (blend_colour_R > 255) blend_colour_R = 255; - else if (blend_colour_R < 0) blend_colour_R = 0; - if (blend_colour_G > 255) blend_colour_G = 255; - else if (blend_colour_G < 0) blend_colour_G = 0; - if (blend_colour_B > 255) blend_colour_B = 255; - else if (blend_colour_B < 0) blend_colour_B = 0; + if (blend_colour_R > 255) blend_colour_R = 255; + else if (blend_colour_R < 0) blend_colour_R = 0; + if (blend_colour_G > 255) blend_colour_G = 255; + else if (blend_colour_G < 0) blend_colour_G = 0; + if (blend_colour_B > 255) blend_colour_B = 255; + else if (blend_colour_B < 0) blend_colour_B = 0; - sb[i] = (blend_colour_R * 2 + sb[i]) / 3; - sb[i+1] = (blend_colour_G * 2 + sb[i+1]) / 3; - sb[i+2] = (blend_colour_B * 2 + sb[i+2]) / 3; + sb[i] = (blend_colour_R * 2 + sb[i]) / 3; + sb[i+1] = (blend_colour_G * 2 + sb[i+1]) / 3; + sb[i+2] = (blend_colour_B * 2 + sb[i+2]) / 3; - if(bytes > 3) - sb[i+3] = (blend_colour_A * 2 + sb[i+3]) / 3; + if(bytes > 3) + sb[i+3] = (blend_colour_A * 2 + sb[i+3]) / 3; - if (threshold_exceeded(sb+i, sb+i+comp_stride, BOTH, - threshold,(bytes>3))) - { - target_colour_R = sb[i+comp_stride]; - target_colour_G = sb[i+comp_stride+1]; - target_colour_B = sb[i+comp_stride+2]; - if(bytes > 3) - target_colour_A = sb[i+comp_stride+3]; - blend_amt_R = target_colour_R - blend_colour_R; - blend_amt_G = target_colour_G - blend_colour_G; - blend_amt_B = target_colour_B - blend_colour_B; - if(bytes > 3) - blend_amt_A = target_colour_A - blend_colour_A; - denominator = n * n + n; - denominator = 2.0 / denominator; - } - n--; - } - } + if (threshold_exceeded(sb+i, sb+i+comp_stride, BOTH, + threshold,(bytes>3))) + { + target_colour_R = sb[i+comp_stride]; + target_colour_G = sb[i+comp_stride+1]; + target_colour_B = sb[i+comp_stride+2]; + if(bytes > 3) + target_colour_A = sb[i+comp_stride+3]; + blend_amt_R = target_colour_R - blend_colour_R; + blend_amt_G = target_colour_G - blend_colour_G; + blend_amt_B = target_colour_B - blend_colour_B; + if(bytes > 3) + blend_amt_A = target_colour_A - blend_colour_A; + denominator = n * n + n; + denominator = 2.0 / denominator; + } + n--; + } + } } } static gint threshold_exceeded (guchar *pixel_R1, - guchar *pixel_R2, - edge_t edge, - gint threshold, - gboolean has_alpha) + guchar *pixel_R2, + edge_t edge, + gint threshold, + gboolean has_alpha) { gint derivative_R, derivative_G, derivative_B, derivative_A; gint return_value; get_derivative(pixel_R1, pixel_R2, edge, has_alpha, - &derivative_R, &derivative_G, &derivative_B, &derivative_A); + &derivative_R, &derivative_G, &derivative_B, &derivative_A); if(((derivative_R + derivative_G + @@ -741,13 +741,13 @@ threshold_exceeded (guchar *pixel_R1, static void get_derivative (guchar *pixel_R1, - guchar *pixel_R2, - edge_t edge, - gboolean has_alpha, - gint *derivative_R, - gint *derivative_G, - gint *derivative_B, - gint *derivative_A) + guchar *pixel_R2, + edge_t edge, + gboolean has_alpha, + gint *derivative_R, + gint *derivative_G, + gint *derivative_B, + gint *derivative_A) { guchar *pixel_G1 = pixel_R1 + 1; guchar *pixel_B1 = pixel_R1 + 2; @@ -793,8 +793,8 @@ get_derivative (guchar *pixel_R1, static void reverse_buffer (guchar *buffer, - gint length, - gint bytes) + gint length, + gint bytes) { gint i, si; gint temp; @@ -818,11 +818,11 @@ reverse_buffer (guchar *buffer, buffer[si+2] = (guchar) temp; if(bytes > 3) - { - temp = buffer[i+3]; - buffer[i+3] = buffer[si+3]; - buffer[si+3] = (guchar) temp; - } + { + temp = buffer[i+3]; + buffer[i+3] = buffer[si+3]; + buffer[si+3] = (guchar) temp; + } } return; @@ -834,7 +834,7 @@ reverse_buffer (guchar *buffer, static void radio_callback (GtkWidget *widget, - gpointer data) + gpointer data) { gimp_radio_button_update (widget, data); @@ -844,7 +844,7 @@ radio_callback (GtkWidget *widget, drawable = g_object_get_data (G_OBJECT (widget), "drawable"); if (drawable != NULL) - render_effect (drawable, TRUE); + render_effect (drawable, TRUE); } } @@ -870,7 +870,7 @@ dialog_box (GimpDrawable *drawable) dlg = gimp_dialog_new (_("Wind"), "wind", NULL, 0, - gimp_standard_help_func, "filters/wind.html", + gimp_standard_help_func, "filters/wind.html", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, @@ -882,8 +882,8 @@ dialog_box (GimpDrawable *drawable) gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); - preview = gimp_fixme_preview_new (NULL, TRUE); - gimp_fixme_preview_fill (preview, drawable); + preview = gimp_old_preview_new (NULL, TRUE); + gimp_old_preview_fill (preview, drawable); gtk_box_pack_start (GTK_BOX (vbox), preview->frame, FALSE, FALSE, 0); render_effect (drawable, TRUE); gtk_widget_show (preview->widget); @@ -913,18 +913,18 @@ dialog_box (GimpDrawable *drawable) frame = gimp_int_radio_group_new (TRUE, _("Style"), G_CALLBACK (radio_callback), - &config.alg, config.alg, + &config.alg, config.alg, - _("_Wind"), RENDER_WIND, &style1, - _("_Blast"), RENDER_BLAST, &style2, + _("_Wind"), RENDER_WIND, &style1, + _("_Blast"), RENDER_BLAST, &style2, - NULL); + NULL); g_object_set_data (G_OBJECT (style1), "drawable", drawable); g_object_set_data (G_OBJECT (style2), "drawable", drawable); gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_widget_show (frame); /****************************************************** @@ -933,18 +933,18 @@ dialog_box (GimpDrawable *drawable) frame = gimp_int_radio_group_new (TRUE, _("Direction"), G_CALLBACK (radio_callback), - &config.direction, config.direction, + &config.direction, config.direction, - _("_Left"), LEFT, &dir1, - _("_Right"), RIGHT, &dir2, + _("_Left"), LEFT, &dir1, + _("_Right"), RIGHT, &dir2, - NULL); + NULL); g_object_set_data (G_OBJECT (dir1), "drawable", drawable); g_object_set_data (G_OBJECT (dir2), "drawable", drawable); gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_widget_show (frame); /***************************************************** @@ -953,20 +953,20 @@ dialog_box (GimpDrawable *drawable) frame = gimp_int_radio_group_new (TRUE, _("Edge Affected"), G_CALLBACK (radio_callback), - &config.edge, config.edge, + &config.edge, config.edge, - _("L_eading"), LEADING, &edge1, - _("Tr_ailing"), TRAILING, &edge2, - _("Bot_h"), BOTH, &edge3, + _("L_eading"), LEADING, &edge1, + _("Tr_ailing"), TRAILING, &edge2, + _("Bot_h"), BOTH, &edge3, - NULL); + NULL); g_object_set_data (G_OBJECT (edge1), "drawable", drawable); g_object_set_data (G_OBJECT (edge2), "drawable", drawable); g_object_set_data (G_OBJECT (edge3), "drawable", drawable); gtk_table_attach (GTK_TABLE (table), frame, 2, 3, 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_widget_show (frame); gtk_widget_show (table); @@ -984,11 +984,11 @@ dialog_box (GimpDrawable *drawable) ***************************************************/ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("_Threshold:"), SCALE_WIDTH, 0, - config.threshold, - MIN_THRESHOLD, MAX_THRESHOLD, 1.0, 10, 0, - TRUE, 0, 0, - _("Higher values restrict the effect to fewer areas of the image"), NULL); + _("_Threshold:"), SCALE_WIDTH, 0, + config.threshold, + MIN_THRESHOLD, MAX_THRESHOLD, 1.0, 10, 0, + TRUE, 0, 0, + _("Higher values restrict the effect to fewer areas of the image"), NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), @@ -1003,11 +1003,11 @@ dialog_box (GimpDrawable *drawable) ****************************************************/ adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("_Strength:"), SCALE_WIDTH, 0, - config.strength, - MIN_STRENGTH, MAX_STRENGTH, 1.0, 10.0, 0, - TRUE, 0, 0, - _("Higher values increase the magnitude of the effect"), NULL); + _("_Strength:"), SCALE_WIDTH, 0, + config.strength, + MIN_STRENGTH, MAX_STRENGTH, 1.0, 10.0, 0, + TRUE, 0, 0, + _("Higher values increase the magnitude of the effect"), NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update),