1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* SuperNova plug-in
|
|
|
|
* Copyright (C) 1997 Eiichi Takamori <taka@ma1.seikyou.ne.jp>,
|
1999-09-04 07:14:44 +08:00
|
|
|
* Spencer Kimball, Federico Mena Quintero
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* 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 Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1999-09-04 07:14:44 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
1997-11-25 06:05:25 +08:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-05-23 21:00:40 +08:00
|
|
|
* version 1.200
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* This plug-in produces an effect like a supernova burst.
|
|
|
|
*
|
1999-09-04 07:14:44 +08:00
|
|
|
* Eiichi Takamori <taka@ma1.seikyou.ne.jp>
|
|
|
|
* http://ha1.seikyou.ne.jp/home/taka/gimp/
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2000-05-23 21:00:40 +08:00
|
|
|
* Preview render mode by timecop@japan.co.jp
|
|
|
|
* http://www.ne.jp/asahi/linux/timecop
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2000-05-23 21:00:40 +08:00
|
|
|
* Changes from version 1.122 to version 1.200 by tim copperfield:
|
|
|
|
* - preview mode now previews the nova with scale;
|
|
|
|
* - toggle for cursor show/hide during preview
|
|
|
|
*
|
1999-09-04 07:14:44 +08:00
|
|
|
* Changes from version 1.1115 to version 1.122 by Martin Weber:
|
|
|
|
* - Little bug fixes
|
|
|
|
* - Added random hue
|
|
|
|
* - Freeing memory
|
|
|
|
*
|
1997-11-25 06:05:25 +08:00
|
|
|
* Changes from version 1.1114 to version 1.1115:
|
|
|
|
* - Added gtk_rc_parse
|
|
|
|
* - Fixed bug that drawing preview of small height image
|
|
|
|
* (maybe image height < PREVIEW_SIZE) caused core dump.
|
|
|
|
* - Changed default value.
|
|
|
|
* - Moved to <Image>/Filters/Effects. right?
|
|
|
|
* - etc...
|
|
|
|
*
|
|
|
|
* Changes from version 1.1112 to version 1.1114:
|
2000-08-22 09:26:57 +08:00
|
|
|
* - Modified proc args to GIMP_PDB_COLOR, also included nspoke.
|
1997-11-25 06:05:25 +08:00
|
|
|
* - nova_int_entryscale_new(): Fixed caption was guchar -> gchar, etc.
|
|
|
|
* - Now nova renders properly with alpha channel.
|
|
|
|
* (Very thanks to Spencer Kimball and Federico Mena !)
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - clean up the code more
|
|
|
|
* - add notebook interface and so on
|
|
|
|
*/
|
|
|
|
|
2000-01-07 18:39:33 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2000-10-01 04:13:06 +08:00
|
|
|
#include <string.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <time.h>
|
2000-01-07 18:39:33 +08:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
2000-01-07 18:39:33 +08:00
|
|
|
|
1999-11-17 07:19:04 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-02 01:01:18 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifdef RCSID
|
|
|
|
static char rcsid[] = "$Id$";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Some useful macros */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#define DEBUG1 printf
|
|
|
|
#else
|
|
|
|
#define DEBUG1 dummy_printf
|
2000-01-16 23:38:38 +08:00
|
|
|
static void dummy_printf(char *fmt, ...) {}
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
#define ENTRY_WIDTH 50
|
2000-01-09 23:51:46 +08:00
|
|
|
#define SCALE_WIDTH 125
|
2000-01-16 23:38:38 +08:00
|
|
|
#define TILE_CACHE_SIZE 16
|
2000-05-23 21:00:40 +08:00
|
|
|
#define PREVIEW_SIZE 128
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-04 07:14:44 +08:00
|
|
|
#define PREVIEW 0x1
|
|
|
|
#define CURSOR 0x2
|
|
|
|
#define ALL 0xf
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
#define PREVIEW_MASK (GDK_EXPOSURE_MASK | \
|
|
|
|
GDK_BUTTON_PRESS_MASK | \
|
|
|
|
GDK_BUTTON1_MOTION_MASK)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
static guchar *preview_bits;
|
|
|
|
static GtkWidget *preview;
|
|
|
|
static gdouble preview_scale_x;
|
|
|
|
static gdouble preview_scale_y;
|
|
|
|
static gboolean show_cursor = FALSE;
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
gint xcenter;
|
|
|
|
gint ycenter;
|
|
|
|
GimpRGB color;
|
1999-09-04 07:14:44 +08:00
|
|
|
gint radius;
|
|
|
|
gint nspoke;
|
|
|
|
gint randomhue;
|
1997-11-25 06:05:25 +08:00
|
|
|
} NovaValues;
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
1997-11-25 06:05:25 +08:00
|
|
|
gint run;
|
|
|
|
} NovaInterface;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpDrawable *drawable;
|
2001-01-15 04:25:46 +08:00
|
|
|
gint dwidth;
|
|
|
|
gint dheight;
|
|
|
|
gint bpp;
|
|
|
|
GtkObject *xadj;
|
|
|
|
GtkObject *yadj;
|
|
|
|
gint cursor;
|
|
|
|
gint curx, cury; /* x,y of cursor in preview */
|
|
|
|
gint oldx, oldy;
|
|
|
|
gboolean in_call;
|
1997-11-25 06:05:25 +08:00
|
|
|
} NovaCenter;
|
|
|
|
|
|
|
|
|
|
|
|
/* Declare a local function.
|
|
|
|
*/
|
2000-01-16 23:38:38 +08:00
|
|
|
static void query (void);
|
2001-01-15 04:25:46 +08:00
|
|
|
static void run (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals);
|
|
|
|
|
|
|
|
static void fill_preview_with_thumb (GtkWidget *preview_widget,
|
|
|
|
gint32 drawable_ID);
|
2000-08-22 09:26:57 +08:00
|
|
|
static GtkWidget *preview_widget (GimpDrawable *drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
static void nova (GimpDrawable *drawable,
|
2001-01-15 04:25:46 +08:00
|
|
|
gboolean preview_mode);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
static gint nova_dialog (GimpDrawable *drawable);
|
2001-01-15 04:25:46 +08:00
|
|
|
static void nova_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
static GtkWidget * nova_center_create (GimpDrawable *drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
static void nova_center_destroy (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void nova_center_draw (NovaCenter *center,
|
|
|
|
gint update);
|
|
|
|
static void nova_center_adjustment_update (GtkAdjustment *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void nova_center_cursor_update (NovaCenter *center);
|
|
|
|
static gint nova_center_preview_expose (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
|
|
|
static gint nova_center_preview_events (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpPlugInInfo PLUG_IN_INFO =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
NULL, /* init_proc */
|
|
|
|
NULL, /* quit_proc */
|
|
|
|
query, /* query_proc */
|
|
|
|
run, /* run_proc */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static NovaValues pvals =
|
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
128, 128, /* xcenter, ycenter */
|
|
|
|
{ 0.35, 0.39, 1.0, 1.0 }, /* color */
|
|
|
|
20, /* radius */
|
|
|
|
100, /* nspoke */
|
|
|
|
0 /* random hue */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static NovaInterface pint =
|
|
|
|
{
|
1999-09-04 07:14:44 +08:00
|
|
|
FALSE /* run */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-05-02 01:01:18 +08:00
|
|
|
MAIN ()
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
query (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
static GimpParamDef args[]=
|
2000-05-02 01:01:18 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
|
|
|
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
|
|
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
|
|
|
{ GIMP_PDB_INT32, "xcenter", "X coordinates of the center of supernova" },
|
|
|
|
{ GIMP_PDB_INT32, "ycenter", "Y coordinates of the center of supernova" },
|
|
|
|
{ GIMP_PDB_COLOR, "color", "Color of supernova" },
|
|
|
|
{ GIMP_PDB_INT32, "radius", "Radius of supernova" },
|
|
|
|
{ GIMP_PDB_INT32, "nspoke", "Number of spokes" },
|
|
|
|
{ GIMP_PDB_INT32, "randomhue", "Random hue" }
|
2000-05-02 01:01:18 +08:00
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
2000-01-09 23:51:46 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_install_procedure ("plug_in_nova",
|
2000-01-31 10:32:30 +08:00
|
|
|
"Produce Supernova effect to the specified drawable",
|
2000-05-02 01:01:18 +08:00
|
|
|
"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.",
|
1999-09-04 07:14:44 +08:00
|
|
|
"Eiichi Takamori",
|
|
|
|
"Eiichi Takamori",
|
2000-05-23 21:00:40 +08:00
|
|
|
"May 2000",
|
2001-05-22 03:40:29 +08:00
|
|
|
/* don't translate '<Image>', it's a keyword
|
|
|
|
* of the gtk toolkit */
|
1999-11-24 04:29:20 +08:00
|
|
|
N_("<Image>/Filters/Light Effects/SuperNova..."),
|
1999-09-04 07:14:44 +08:00
|
|
|
"RGB*, GRAY*",
|
2000-08-22 09:26:57 +08:00
|
|
|
GIMP_PLUGIN,
|
2000-05-02 01:01:18 +08:00
|
|
|
nargs, 0,
|
|
|
|
args, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-01-15 04:25:46 +08:00
|
|
|
run (gchar *name,
|
|
|
|
gint nparams,
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpParam *param,
|
2001-01-15 04:25:46 +08:00
|
|
|
gint *nreturn_vals,
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpParam **return_vals)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpRunModeType run_mode;
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-17 22:39:11 +08:00
|
|
|
INIT_I18N_UI();
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
run_mode = param[0].data.d_int32;
|
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1997-11-25 06:05:25 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
|
|
|
|
/* Get the specified drawable */
|
|
|
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
|
|
|
|
|
|
|
switch (run_mode)
|
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_INTERACTIVE:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Possibly retrieve data */
|
|
|
|
gimp_get_data ("plug_in_nova", &pvals);
|
|
|
|
|
|
|
|
/* First acquire information with a dialog */
|
2000-01-16 23:38:38 +08:00
|
|
|
if (! nova_dialog (drawable))
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
|
|
|
gimp_drawable_detach (drawable);
|
|
|
|
return;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_NONINTERACTIVE:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Make sure all the arguments are there! */
|
1999-09-04 07:14:44 +08:00
|
|
|
if (nparams != 9)
|
2000-08-22 09:26:57 +08:00
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
pvals.xcenter = param[3].data.d_int32;
|
|
|
|
pvals.ycenter = param[4].data.d_int32;
|
2001-01-25 09:20:05 +08:00
|
|
|
pvals.color = param[5].data.d_color;
|
2000-01-16 23:38:38 +08:00
|
|
|
pvals.radius = param[6].data.d_int32;
|
|
|
|
pvals.nspoke = param[7].data.d_int32;
|
1999-09-04 07:14:44 +08:00
|
|
|
pvals.randomhue = param[8].data.d_int32;
|
|
|
|
}
|
2001-01-15 04:25:46 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if ((status == GIMP_PDB_SUCCESS) &&
|
2000-01-16 23:38:38 +08:00
|
|
|
pvals.radius <= 0)
|
2000-08-22 09:26:57 +08:00
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_WITH_LAST_VALS:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Possibly retrieve data */
|
|
|
|
gimp_get_data ("plug_in_nova", &pvals);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* Make sure that the drawable is gray or RGB color */
|
2001-06-15 04:07:38 +08:00
|
|
|
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
|
|
|
gimp_drawable_is_gray (drawable->drawable_id))
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
1999-11-17 07:19:04 +08:00
|
|
|
gimp_progress_init (_("Rendering SuperNova..."));
|
1999-09-04 07:14:44 +08:00
|
|
|
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
nova (drawable, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
1999-09-04 07:14:44 +08:00
|
|
|
gimp_displays_flush ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-04 07:14:44 +08:00
|
|
|
/* Store data */
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
1999-09-04 07:14:44 +08:00
|
|
|
gimp_set_data ("plug_in_nova", &pvals, sizeof (NovaValues));
|
2000-05-23 21:00:40 +08:00
|
|
|
g_free(preview_bits); /* this is allocated during preview render */
|
1999-09-04 07:14:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
|
|
|
/* gimp_message ("nova: cannot operate on indexed color images"); */
|
2000-08-22 09:26:57 +08:00
|
|
|
status = GIMP_PDB_EXECUTION_ERROR;
|
1999-09-04 07:14:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
values[0].data.d_status = status;
|
|
|
|
|
|
|
|
gimp_drawable_detach (drawable);
|
|
|
|
}
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
static GtkWidget *
|
2000-08-22 09:26:57 +08:00
|
|
|
preview_widget (GimpDrawable *drawable)
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
|
|
|
gint size;
|
|
|
|
GtkWidget *preview;
|
|
|
|
|
|
|
|
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
2001-06-15 04:07:38 +08:00
|
|
|
fill_preview_with_thumb (preview, drawable->drawable_id);
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
size = GTK_PREVIEW (preview)->rowstride *
|
|
|
|
GTK_PREVIEW (preview)->buffer_height;
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
preview_bits = g_malloc (size);
|
|
|
|
memcpy (preview_bits, GTK_PREVIEW (preview)->buffer, size);
|
|
|
|
|
|
|
|
return preview;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID)
|
|
|
|
{
|
|
|
|
guchar *drawable_data;
|
|
|
|
gint bpp;
|
|
|
|
gint x,y;
|
|
|
|
gint width = PREVIEW_SIZE;
|
|
|
|
gint height = PREVIEW_SIZE;
|
|
|
|
guchar *src;
|
2001-01-15 04:25:46 +08:00
|
|
|
GimpRGB color;
|
2000-05-23 21:00:40 +08:00
|
|
|
gdouble c0, c1;
|
|
|
|
guchar *p0, *p1;
|
|
|
|
guchar *even, *odd;
|
|
|
|
|
|
|
|
bpp = 0; /* Only returned */
|
|
|
|
|
|
|
|
drawable_data =
|
|
|
|
gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp);
|
|
|
|
|
|
|
|
if (width < 1 || height < 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
2001-01-15 04:25:46 +08:00
|
|
|
preview_scale_x =
|
|
|
|
(gdouble) width / (gdouble) gimp_drawable_width (drawable_ID);
|
|
|
|
preview_scale_y =
|
|
|
|
(gdouble) height / (gdouble) gimp_drawable_height (drawable_ID);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
even = g_malloc (width * 3);
|
|
|
|
odd = g_malloc (width * 3);
|
|
|
|
src = drawable_data;
|
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
gimp_rgba_set (&color, 1.0, 1.0, 1.0, 1.0);
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
{
|
|
|
|
p0 = even;
|
|
|
|
p1 = odd;
|
|
|
|
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
switch (bpp)
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
case 4:
|
|
|
|
gimp_rgba_set_uchar (&color,
|
|
|
|
src[x*4+0],
|
|
|
|
src[x*4+1],
|
|
|
|
src[x*4+2],
|
|
|
|
src[x*4+3]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
gimp_rgb_set_uchar (&color,
|
|
|
|
src[x*3+0],
|
|
|
|
src[x*3+1],
|
|
|
|
src[x*3+2]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
gimp_rgba_set_uchar (&color,
|
|
|
|
src[x*2+0],
|
|
|
|
src[x*2+0],
|
|
|
|
src[x*2+0],
|
|
|
|
src[x*2+1]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
gimp_rgb_set_uchar (&color,
|
|
|
|
src[x*2+0],
|
|
|
|
src[x*2+0],
|
|
|
|
src[x*2+0]);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((x / GIMP_CHECK_SIZE_SM) & 1)
|
|
|
|
{
|
|
|
|
c0 = GIMP_CHECK_LIGHT;
|
|
|
|
c1 = GIMP_CHECK_DARK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c0 = GIMP_CHECK_DARK;
|
|
|
|
c1 = GIMP_CHECK_LIGHT;
|
|
|
|
}
|
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
*p0++ = (c0 + (color.r - c0) * color.a) * 255.0;
|
|
|
|
*p0++ = (c0 + (color.g - c0) * color.a) * 255.0;
|
|
|
|
*p0++ = (c0 + (color.b - c0) * color.a) * 255.0;
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
*p1++ = (c1 + (color.r - c1) * color.a) * 255.0;
|
|
|
|
*p1++ = (c1 + (color.g - c1) * color.a) * 255.0;
|
|
|
|
*p1++ = (c1 + (color.b - c1) * color.a) * 255.0;
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
if ((y / GIMP_CHECK_SIZE_SM) & 1)
|
2001-01-15 04:25:46 +08:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget),
|
|
|
|
(guchar *)odd, 0, y, width);
|
2000-05-23 21:00:40 +08:00
|
|
|
else
|
2001-01-15 04:25:46 +08:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget),
|
|
|
|
(guchar *)even, 0, y, width);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
src += width * bpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (even);
|
|
|
|
g_free (odd);
|
|
|
|
g_free (drawable_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/*******************/
|
|
|
|
/* Main Dialog */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
static gint
|
2000-08-22 09:26:57 +08:00
|
|
|
nova_dialog (GimpDrawable *drawable)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *center_frame;
|
2000-01-16 23:38:38 +08:00
|
|
|
GtkObject *adj;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-02 01:01:18 +08:00
|
|
|
gimp_ui_init ("nova", TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-07 18:39:33 +08:00
|
|
|
dlg = gimp_dialog_new (_("SuperNova"), "nova",
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/nova.html",
|
2000-01-07 18:39:33 +08:00
|
|
|
GTK_WIN_POS_MOUSE,
|
|
|
|
FALSE, TRUE, FALSE,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-07 18:39:33 +08:00
|
|
|
_("OK"), nova_ok_callback,
|
|
|
|
NULL, NULL, NULL, TRUE, FALSE,
|
|
|
|
_("Cancel"), gtk_widget_destroy,
|
|
|
|
NULL, 1, NULL, FALSE, TRUE,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-07 18:39:33 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* parameter settings */
|
1999-11-17 07:19:04 +08:00
|
|
|
frame = gtk_frame_new (_("Parameter Settings"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
table = gtk_table_new (5, 3, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
1999-11-17 07:19:04 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
center_frame = nova_center_create (drawable);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), center_frame, 0, 3, 0, 1,
|
|
|
|
0, 0, 0, 0);
|
1999-11-17 07:19:04 +08:00
|
|
|
|
|
|
|
button = gimp_color_button_new (_("SuperNova Color Picker"),
|
|
|
|
SCALE_WIDTH - 8, 16,
|
2001-01-15 14:24:24 +08:00
|
|
|
&pvals.color, GIMP_COLOR_AREA_FLAT);
|
2001-01-11 06:49:45 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "color_changed",
|
2001-01-15 04:25:46 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_color_button_get_color),
|
|
|
|
&pvals.color);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "color_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova),
|
|
|
|
(gpointer)drawable);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
2000-01-16 23:38:38 +08:00
|
|
|
_("Color:"), 1.0, 0.5,
|
2000-01-31 11:13:02 +08:00
|
|
|
button, 1, TRUE);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3,
|
2000-01-16 23:38:38 +08:00
|
|
|
_("Radius:"), SCALE_WIDTH, 0,
|
|
|
|
pvals.radius, 1, 100, 1, 10, 0,
|
2000-02-05 06:18:50 +08:00
|
|
|
FALSE, 1, GIMP_MAX_IMAGE_SIZE,
|
2000-01-16 23:38:38 +08:00
|
|
|
NULL, NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
|
|
|
|
&pvals.radius);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_signal_connect_object (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova),
|
|
|
|
(gpointer)drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
|
2000-01-16 23:38:38 +08:00
|
|
|
_("Spokes:"), SCALE_WIDTH, 0,
|
|
|
|
pvals.nspoke, 1, 1024, 1, 16, 0,
|
2000-02-04 23:12:17 +08:00
|
|
|
TRUE, 0, 0,
|
2000-01-16 23:38:38 +08:00
|
|
|
NULL, NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
|
|
|
|
&pvals.nspoke);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_signal_connect_object (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova),
|
|
|
|
(gpointer)drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
|
2000-01-16 23:38:38 +08:00
|
|
|
_("Random Hue:"), SCALE_WIDTH, 0,
|
|
|
|
pvals.randomhue, 0, 360, 1, 15, 0,
|
2000-02-04 23:12:17 +08:00
|
|
|
TRUE, 0, 0,
|
2000-01-16 23:38:38 +08:00
|
|
|
NULL, NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
|
|
|
|
&pvals.randomhue);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_signal_connect_object (GTK_OBJECT (adj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova),
|
|
|
|
(gpointer)drawable);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
gtk_widget_show (dlg);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
gdk_flush ();
|
|
|
|
|
|
|
|
return pint.run;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
nova_ok_callback (GtkWidget *widget,
|
1999-11-17 07:19:04 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
pint.run = TRUE;
|
2000-01-16 23:38:38 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (data));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*=================================================================
|
|
|
|
CenterFrame
|
|
|
|
|
|
|
|
A frame that contains one preview and 2 entrys, used for positioning
|
|
|
|
of the center of Nova.
|
|
|
|
==================================================================*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create new CenterFrame, and return it (GtkFrame).
|
|
|
|
*/
|
|
|
|
static GtkWidget *
|
2000-08-22 09:26:57 +08:00
|
|
|
nova_center_create (GimpDrawable *drawable)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
NovaCenter *center;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *pframe;
|
|
|
|
GtkWidget *spinbutton;
|
2000-05-23 21:00:40 +08:00
|
|
|
GtkWidget *check;
|
2000-01-16 23:38:38 +08:00
|
|
|
|
|
|
|
center = g_new (NovaCenter, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
center->drawable = drawable;
|
2001-06-15 04:07:38 +08:00
|
|
|
center->dwidth = gimp_drawable_width (drawable->drawable_id);
|
|
|
|
center->dheight = gimp_drawable_height (drawable->drawable_id);
|
|
|
|
center->bpp = gimp_drawable_bpp (drawable->drawable_id);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2001-06-15 04:07:38 +08:00
|
|
|
if (gimp_drawable_has_alpha (drawable->drawable_id))
|
1997-11-25 06:05:25 +08:00
|
|
|
center->bpp--;
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
center->cursor = FALSE;
|
|
|
|
center->curx = 0;
|
|
|
|
center->cury = 0;
|
|
|
|
center->oldx = 0;
|
|
|
|
center->oldy = 0;
|
|
|
|
center->in_call = TRUE; /* to avoid side effects while initialization */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-17 07:19:04 +08:00
|
|
|
frame = gtk_frame_new (_("Center of SuperNova"));
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (frame), "destroy",
|
|
|
|
GTK_SIGNAL_FUNC (nova_center_destroy),
|
|
|
|
center);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
table = gtk_table_new (3, 4, FALSE);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 6);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
|
|
|
label = gtk_label_new (_("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_widget_show (label);
|
|
|
|
|
|
|
|
spinbutton =
|
|
|
|
gimp_spin_button_new (¢er->xadj,
|
|
|
|
pvals.xcenter, G_MININT, G_MAXINT,
|
|
|
|
1, 10, 10, 0, 0);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (center->xadj), center);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (center->xadj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova_center_adjustment_update),
|
|
|
|
&pvals.xcenter);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("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_widget_show (label);
|
|
|
|
|
|
|
|
spinbutton =
|
|
|
|
gimp_spin_button_new (¢er->yadj,
|
|
|
|
pvals.ycenter, G_MININT, G_MAXINT,
|
|
|
|
1, 10, 10, 0, 0);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (center->yadj), center);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (center->yadj), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (nova_center_adjustment_update),
|
|
|
|
&pvals.ycenter);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton, 3, 4, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* frame that contains preview */
|
|
|
|
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);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* PREVIEW */
|
2000-05-23 21:00:40 +08:00
|
|
|
preview = preview_widget (center->drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_widget_set_events (GTK_WIDGET (preview), PREVIEW_MASK);
|
|
|
|
gtk_signal_connect_after (GTK_OBJECT (preview), "expose_event",
|
|
|
|
GTK_SIGNAL_FUNC (nova_center_preview_expose),
|
|
|
|
center);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (preview), "event",
|
|
|
|
GTK_SIGNAL_FUNC (nova_center_preview_events),
|
|
|
|
center);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (pframe), preview);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_widget_show (preview);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_widget_show (pframe);
|
|
|
|
gtk_widget_show (table);
|
2000-05-23 21:00:40 +08:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (frame), center);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_widget_show (frame);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
check = gtk_check_button_new_with_label (_("Show Cursor"));
|
|
|
|
gtk_table_attach (GTK_TABLE (table), check, 0, 4, 2, 3,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), show_cursor);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (check), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
|
|
|
&show_cursor);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (check), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (nova),
|
|
|
|
(gpointer)drawable);
|
|
|
|
gtk_widget_show (check);
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
nova_center_cursor_update (center);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
center->cursor = FALSE; /* Make sure that the cursor has not been drawn */
|
1997-11-25 06:05:25 +08:00
|
|
|
center->in_call = FALSE; /* End of initialization */
|
2000-05-23 21:00:40 +08:00
|
|
|
nova (drawable, TRUE);
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
DEBUG1("pvals center=%d,%d\n", pvals.xcenter, pvals.ycenter);
|
|
|
|
DEBUG1("center cur=%d,%d\n", center->curx, center->cury);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-17 07:19:04 +08:00
|
|
|
nova_center_destroy (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
NovaCenter *center = data;
|
2000-05-23 21:00:40 +08:00
|
|
|
g_free (center);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Drawing CenterFrame
|
|
|
|
* if update & PREVIEW, draw preview
|
|
|
|
* if update & CURSOR, draw cross cursor
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1999-11-17 07:19:04 +08:00
|
|
|
nova_center_draw (NovaCenter *center,
|
|
|
|
gint update)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
if (update & PREVIEW)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
center->cursor = FALSE;
|
2000-01-16 23:38:38 +08:00
|
|
|
DEBUG1 ("draw-preview\n");
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
if (update & CURSOR)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
DEBUG1 ("draw-cursor %d old=%d,%d cur=%d,%d\n",
|
|
|
|
center->cursor, center->oldx, center->oldy,
|
|
|
|
center->curx, center->cury);
|
2000-05-23 21:00:40 +08:00
|
|
|
gdk_gc_set_function (preview->style->black_gc, GDK_INVERT);
|
|
|
|
if (show_cursor)
|
|
|
|
{
|
|
|
|
if (center->cursor)
|
|
|
|
{
|
|
|
|
gdk_draw_line (preview->window,
|
|
|
|
preview->style->black_gc,
|
|
|
|
center->oldx, 1, center->oldx,
|
|
|
|
(GTK_PREVIEW (preview)->buffer_height) - 1);
|
|
|
|
gdk_draw_line (preview->window,
|
|
|
|
preview->style->black_gc,
|
|
|
|
1, center->oldy,
|
2001-01-15 04:25:46 +08:00
|
|
|
(GTK_PREVIEW (preview)->buffer_width) - 1, center->oldy);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gdk_draw_line (preview->window,
|
|
|
|
preview->style->black_gc,
|
|
|
|
center->curx, 1, center->curx,
|
|
|
|
(GTK_PREVIEW (preview)->buffer_height) - 1);
|
|
|
|
gdk_draw_line (preview->window,
|
|
|
|
preview->style->black_gc,
|
|
|
|
1, center->cury,
|
2001-01-15 04:25:46 +08:00
|
|
|
(GTK_PREVIEW (preview)->buffer_width) - 1, center->cury);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
2001-01-15 04:25:46 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* current position of cursor is updated */
|
|
|
|
center->oldx = center->curx;
|
|
|
|
center->oldy = center->cury;
|
|
|
|
center->cursor = TRUE;
|
2000-05-23 21:00:40 +08:00
|
|
|
gdk_gc_set_function (preview->style->black_gc, GDK_COPY);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CenterFrame entry callback
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
nova_center_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
NovaCenter *center;
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
gimp_int_adjustment_update (adjustment, data);
|
|
|
|
|
|
|
|
center = gtk_object_get_user_data (GTK_OBJECT (adjustment));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
if (!center->in_call)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
nova_center_cursor_update (center);
|
|
|
|
nova_center_draw (center, CURSOR);
|
2000-05-23 21:00:40 +08:00
|
|
|
nova (center->drawable, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the cross cursor's coordinates accoding to pvals.[xy]center
|
|
|
|
* but not redraw it
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1999-11-17 07:19:04 +08:00
|
|
|
nova_center_cursor_update (NovaCenter *center)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
center->curx = pvals.xcenter *
|
|
|
|
GTK_PREVIEW (preview)->buffer_width / center->dwidth;
|
|
|
|
center->cury = pvals.ycenter *
|
|
|
|
GTK_PREVIEW (preview)->buffer_height / center->dheight;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
if (center->curx < 0)
|
|
|
|
center->curx = 0;
|
2000-05-23 21:00:40 +08:00
|
|
|
else if (center->curx >= GTK_PREVIEW (preview)->buffer_width)
|
|
|
|
center->curx = GTK_PREVIEW (preview)->buffer_width - 1;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
if (center->cury < 0)
|
|
|
|
center->cury = 0;
|
2000-05-23 21:00:40 +08:00
|
|
|
else if (center->cury >= GTK_PREVIEW (preview)->buffer_height)
|
|
|
|
center->cury = GTK_PREVIEW (preview)->buffer_height - 1;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle the expose event on the preview
|
|
|
|
*/
|
|
|
|
static gint
|
1999-11-17 07:19:04 +08:00
|
|
|
nova_center_preview_expose (GtkWidget *widget,
|
2000-01-16 23:38:38 +08:00
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
NovaCenter *center;
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
center = (NovaCenter *) data;
|
|
|
|
nova_center_draw (center, ALL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle other events on the preview
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gint
|
1999-11-17 07:19:04 +08:00
|
|
|
nova_center_preview_events (GtkWidget *widget,
|
2000-01-16 23:38:38 +08:00
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
NovaCenter *center;
|
|
|
|
GdkEventButton *bevent;
|
|
|
|
GdkEventMotion *mevent;
|
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
center = (NovaCenter *) data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
bevent = (GdkEventButton *) event;
|
|
|
|
center->curx = bevent->x;
|
|
|
|
center->cury = bevent->y;
|
|
|
|
goto mouse;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
mevent = (GdkEventMotion *) event;
|
2000-01-16 23:38:38 +08:00
|
|
|
if (!mevent->state)
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
center->curx = mevent->x;
|
|
|
|
center->cury = mevent->y;
|
|
|
|
mouse:
|
2000-01-16 23:38:38 +08:00
|
|
|
nova_center_draw (center, CURSOR);
|
1997-11-25 06:05:25 +08:00
|
|
|
center->in_call = TRUE;
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (center->xadj),
|
|
|
|
center->curx * center->dwidth /
|
2000-05-23 21:00:40 +08:00
|
|
|
GTK_PREVIEW (preview)->buffer_width);
|
2000-01-16 23:38:38 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (center->yadj),
|
|
|
|
center->cury * center->dheight /
|
2000-05-23 21:00:40 +08:00
|
|
|
GTK_PREVIEW (preview)->buffer_height);
|
1997-11-25 06:05:25 +08:00
|
|
|
center->in_call = FALSE;
|
2000-05-23 21:00:40 +08:00
|
|
|
nova (center->drawable, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2000-01-16 23:38:38 +08:00
|
|
|
################################################################
|
|
|
|
## ##
|
|
|
|
## Main Calculation ##
|
|
|
|
## ##
|
|
|
|
################################################################
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
static gdouble
|
2000-01-09 23:51:46 +08:00
|
|
|
gauss (void)
|
|
|
|
{
|
2000-01-26 01:46:56 +08:00
|
|
|
gdouble sum = 0;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
sum += (gdouble) rand () / G_MAXRAND;
|
|
|
|
|
|
|
|
return sum / 6;
|
2000-01-09 23:51:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-08-22 09:26:57 +08:00
|
|
|
nova (GimpDrawable *drawable,
|
2001-01-15 04:25:46 +08:00
|
|
|
gboolean preview_mode)
|
2000-01-09 23:51:46 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
GimpPixelRgn src_rgn;
|
|
|
|
GimpPixelRgn dest_rgn;
|
|
|
|
guchar *src_row, *dest_row;
|
|
|
|
guchar *src, *dest;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
gint row, col;
|
|
|
|
gint x, y;
|
|
|
|
gint alpha, bpp;
|
|
|
|
gint progress, max_progress;
|
|
|
|
gboolean has_alpha;
|
|
|
|
gint xc, yc; /* center of nova */
|
|
|
|
gdouble u, v;
|
|
|
|
gdouble l;
|
|
|
|
gdouble w, w1, c;
|
|
|
|
gdouble *spoke;
|
|
|
|
gdouble nova_alpha;
|
|
|
|
GimpRGB color;
|
|
|
|
GimpRGB src_color;
|
|
|
|
GimpRGB *spokecolor;
|
|
|
|
GimpHSV hsv;
|
|
|
|
gint i;
|
|
|
|
|
1999-09-04 07:14:44 +08:00
|
|
|
/* initialize */
|
2001-06-15 04:07:38 +08:00
|
|
|
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
1999-09-04 07:14:44 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
srand (time (NULL));
|
|
|
|
spoke = g_new (gdouble, pvals.nspoke);
|
2001-01-15 04:25:46 +08:00
|
|
|
spokecolor = g_new (GimpRGB, pvals.nspoke);
|
1999-09-04 07:14:44 +08:00
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
gimp_rgb_set_alpha (&pvals.color, 1.0);
|
|
|
|
gimp_rgb_to_hsv (&pvals.color, &hsv);
|
1999-09-04 07:14:44 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
for (i = 0; i < pvals.nspoke; i++)
|
|
|
|
{
|
|
|
|
spoke[i] = gauss();
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
hsv.h += ((gdouble) pvals.randomhue / 360.0) *
|
|
|
|
((gdouble) rand() / (gdouble) G_MAXRAND - 0.5);
|
|
|
|
if (hsv.h < 0)
|
|
|
|
hsv.h += 1.0;
|
|
|
|
else if (hsv.h >= 1.0)
|
|
|
|
hsv.h -= 1.0;
|
|
|
|
|
|
|
|
gimp_hsv_to_rgb (&hsv, spokecolor + i);
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
if (preview_mode)
|
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
xc = (gdouble) pvals.xcenter * preview_scale_x;
|
|
|
|
yc = (gdouble) pvals.ycenter * preview_scale_y;
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
x1 = y1 = 0;
|
|
|
|
x2 = GTK_PREVIEW (preview)->buffer_width;
|
|
|
|
y2 = GTK_PREVIEW (preview)->buffer_height;
|
|
|
|
bpp = GTK_PREVIEW (preview)->bpp;
|
2001-01-15 04:25:46 +08:00
|
|
|
has_alpha = FALSE;
|
2000-05-23 21:00:40 +08:00
|
|
|
alpha = bpp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-15 04:07:38 +08:00
|
|
|
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
|
|
|
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
2000-05-23 21:00:40 +08:00
|
|
|
alpha = (has_alpha) ? bpp - 1 : bpp;
|
|
|
|
xc = pvals.xcenter;
|
|
|
|
yc = pvals.ycenter;
|
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
gimp_pixel_rgn_init (&src_rgn, drawable,
|
|
|
|
x1, y1, x2-x1, y2-y1, FALSE, FALSE);
|
|
|
|
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
|
|
|
x1, y1, x2-x1, y2-y1, TRUE, TRUE);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
1999-09-04 07:14:44 +08:00
|
|
|
|
|
|
|
/* Initialize progress */
|
2001-01-15 04:25:46 +08:00
|
|
|
progress = 0;
|
1999-09-04 07:14:44 +08:00
|
|
|
max_progress = (x2 - x1) * (y2 - y1);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
if (preview_mode)
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
src_row = g_malloc (y2 * GTK_PREVIEW (preview)->rowstride);
|
2000-05-24 02:52:14 +08:00
|
|
|
memcpy (src_row, preview_bits, y2 * GTK_PREVIEW (preview)->rowstride);
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
dest_row = g_malloc (GTK_PREVIEW (preview)->rowstride);
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
for (row = 0, y = 0; row < y2; row++, y++)
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
src = src_row;
|
1999-09-04 07:14:44 +08:00
|
|
|
dest = dest_row;
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
for (col = 0, x = 0; col < x2; col++, x++)
|
1999-09-04 07:14:44 +08:00
|
|
|
{
|
2001-01-15 04:25:46 +08:00
|
|
|
u = (gdouble) (x - xc) / (pvals.radius * preview_scale_x);
|
|
|
|
v = (gdouble) (y - yc) / (pvals.radius * preview_scale_y);
|
|
|
|
l = sqrt (u*u + v*v);
|
1999-09-04 07:14:44 +08:00
|
|
|
|
|
|
|
/* This algorithm is still under construction. */
|
2000-01-16 23:38:38 +08:00
|
|
|
c = (atan2 (u, v) / (2 * G_PI) + .51) * pvals.nspoke;
|
2001-01-15 04:25:46 +08:00
|
|
|
i = (gint) floor (c);
|
1999-09-04 07:14:44 +08:00
|
|
|
c -= i;
|
|
|
|
i %= pvals.nspoke;
|
|
|
|
w1 = spoke[i] * (1 - c) + spoke[(i + 1) % pvals.nspoke] * c;
|
|
|
|
w1 = w1 * w1;
|
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
w = 1.0 / (l + 0.001) * 0.9;
|
1999-09-04 07:14:44 +08:00
|
|
|
|
|
|
|
nova_alpha = CLAMP (w, 0.0, 1.0);
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
/* 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);
|
1999-09-04 07:14:44 +08:00
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
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); */
|
|
|
|
|
|
|
|
gimp_rgb_get_uchar (&color,
|
|
|
|
dest, dest + 1, dest + 2);
|
|
|
|
|
|
|
|
src += bpp;
|
2000-05-23 21:00:40 +08:00
|
|
|
dest += bpp;
|
1999-09-04 07:14:44 +08:00
|
|
|
}
|
2001-01-15 04:25:46 +08:00
|
|
|
|
2000-05-24 02:52:14 +08:00
|
|
|
src_row += GTK_PREVIEW (preview)->rowstride;
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (preview), dest_row, 0, row, y2);
|
1999-09-04 07:14:44 +08:00
|
|
|
}
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
gtk_widget_queue_draw (preview);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* normal mode */
|
2001-01-15 04:25:46 +08:00
|
|
|
|
|
|
|
#ifdef EEEEK
|
2000-05-23 21:00:40 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* This algorithm is still under construction. */
|
|
|
|
c = (atan2 (u, v) / (2 * G_PI) + .51) * pvals.nspoke;
|
2001-01-15 04:25:46 +08:00
|
|
|
i = (gint) floor (c);
|
2000-05-23 21:00:40 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
nova_alpha = CLAMP (w, 0.0, 1.0);
|
|
|
|
|
2001-01-15 04:25:46 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
c = CLAMP (w1 * w, 0, 1);
|
|
|
|
color[j] = color[j] + 255 * c;
|
|
|
|
|
|
|
|
dest[j]= CLAMP (color[j], 0, 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update progress */
|
|
|
|
progress += src_rgn.w * src_rgn.h;
|
2001-01-15 04:25:46 +08:00
|
|
|
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_flush (drawable);
|
2001-06-15 04:07:38 +08:00
|
|
|
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
|
|
|
|
gimp_drawable_update (drawable->drawable_id,
|
|
|
|
x1, y1, (x2 - x1), (y2 - y1));
|
2001-01-15 04:25:46 +08:00
|
|
|
#else
|
|
|
|
gimp_message ("Sorry, the SuperNova effect\n"
|
|
|
|
"is broken at the moment and\n"
|
|
|
|
"has been temporarily disabled.");
|
|
|
|
#endif
|
1999-09-04 07:14:44 +08:00
|
|
|
}
|
|
|
|
|
2000-05-02 01:01:18 +08:00
|
|
|
g_free (spoke);
|
|
|
|
g_free (spokecolor);
|
2000-01-09 23:51:46 +08:00
|
|
|
}
|