mirror of https://github.com/GNOME/gimp.git
updated CEL plugin added psd plugin and autoconfed for byte order
updated CEL plugin added psd plugin and autoconfed for byte order -Yosh
This commit is contained in:
parent
8137f724ef
commit
644a0060f5
|
@ -1,3 +1,9 @@
|
||||||
|
Sun Apr 26 02:34:21 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
|
* updated CEL plugin
|
||||||
|
|
||||||
|
* added PSD plugin and autoconf for byte order
|
||||||
|
|
||||||
Thu Apr 23 19:08:16 PDT 1998 Manish Singh <yosh@gimp.org>
|
Thu Apr 23 19:08:16 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* Added sharpen to stable dist
|
* Added sharpen to stable dist
|
||||||
|
|
|
@ -46,6 +46,10 @@
|
||||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
#undef TIME_WITH_SYS_TIME
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
|
/* Define if your processor stores words with the most significant
|
||||||
|
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
|
#undef WORDS_BIGENDIAN
|
||||||
|
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
#undef HAVE_DOPRNT
|
#undef HAVE_DOPRNT
|
||||||
#undef HAVE_IPC_H
|
#undef HAVE_IPC_H
|
||||||
|
|
|
@ -42,7 +42,7 @@ fi)
|
||||||
|
|
||||||
AC_DEFUN(AC_GIMP_CHECK,
|
AC_DEFUN(AC_GIMP_CHECK,
|
||||||
[
|
[
|
||||||
AM_PATH_GTK(0.99.7,,
|
AM_PATH_GTK(1.0.0,,
|
||||||
AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
|
AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
|
||||||
X_LIBS=$GTK_LIBS
|
X_LIBS=$GTK_LIBS
|
||||||
X_CFLAGS=$GTK_CFLAGS
|
X_CFLAGS=$GTK_CFLAGS
|
||||||
|
@ -262,13 +262,16 @@ AC_HEADER_TIME
|
||||||
AC_CHECK_HEADER(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
|
AC_CHECK_HEADER(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
|
||||||
AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
|
AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
|
||||||
|
|
||||||
|
dnl for the psd plugin
|
||||||
|
AC_C_BIGENDIAN
|
||||||
|
|
||||||
AC_TYPE_PID_T
|
AC_TYPE_PID_T
|
||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
|
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
|
|
||||||
# Check for sys/select.h
|
dnl Check for sys/select.h
|
||||||
|
|
||||||
AC_MSG_CHECKING([fd_set and sys/select])
|
AC_MSG_CHECKING([fd_set and sys/select])
|
||||||
AC_TRY_COMPILE([#include <sys/types.h>],
|
AC_TRY_COMPILE([#include <sys/types.h>],
|
||||||
|
@ -546,6 +549,7 @@ plug-ins/gfig/Makefile
|
||||||
plug-ins/gfig/gfig-examples/Makefile
|
plug-ins/gfig/gfig-examples/Makefile
|
||||||
plug-ins/screenshot/Makefile
|
plug-ins/screenshot/Makefile
|
||||||
plug-ins/sharpen/Makefile
|
plug-ins/sharpen/Makefile
|
||||||
|
plug-ins/psd/Makefile
|
||||||
app/Makefile
|
app/Makefile
|
||||||
docs/Makefile
|
docs/Makefile
|
||||||
data/Makefile
|
data/Makefile
|
||||||
|
|
|
@ -10,8 +10,12 @@
|
||||||
* 0.2 Default palette (nice yellows) is automatically used
|
* 0.2 Default palette (nice yellows) is automatically used
|
||||||
* 0.3 Support for the older (pre KISS/GS) cell format
|
* 0.3 Support for the older (pre KISS/GS) cell format
|
||||||
* 0.4 First support for saving images
|
* 0.4 First support for saving images
|
||||||
* Future additions:
|
* 0.5 Show copyright date, not version number, thanks to DbBrowser
|
||||||
* + Automagically or via dialog box choose a KCF palette
|
* 0.6 File dialogs, palette handling, better magic behaviour
|
||||||
|
* 0.7 Handle interactivity settings, tidy up
|
||||||
|
* 1.0 Fixed for GIMP 0.99.27 running on GTK+ 1.0.0, and released
|
||||||
|
*
|
||||||
|
* Possible future additions:
|
||||||
* + Save (perhaps optionally?) the palette in a KCF
|
* + Save (perhaps optionally?) the palette in a KCF
|
||||||
* + Support offsets -- like GIF?
|
* + Support offsets -- like GIF?
|
||||||
*/
|
*/
|
||||||
|
@ -23,14 +27,14 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
||||||
#define VERSION "0.4"
|
|
||||||
|
|
||||||
static void query(void);
|
static void query(void);
|
||||||
static void run(char *name, int nparams, GParam *param,
|
static void run(char *name, int nparams, GParam *param,
|
||||||
int *nreturn_vals, GParam **return_vals);
|
int *nreturn_vals, GParam **return_vals);
|
||||||
|
static gint load_palette(FILE *fp, guchar palette[]);
|
||||||
static gint32 load_image(char *file, char *brief);
|
static gint32 load_image(char *file, char *brief);
|
||||||
static gint save_image(char *file, char *brief,
|
static gint save_image(char *file, char *brief,
|
||||||
gint32 image, gint32 layer);
|
gint32 image, gint32 layer);
|
||||||
|
static gint palette_dialog(char *title);
|
||||||
|
|
||||||
/* Globals... */
|
/* Globals... */
|
||||||
|
|
||||||
|
@ -42,10 +46,13 @@ GPlugInInfo PLUG_IN_INFO =
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char *palette_file= NULL;
|
||||||
|
size_t data_length= 0;
|
||||||
|
|
||||||
/* Let GIMP library handle initialisation (and inquisitive users) */
|
/* Let GIMP library handle initialisation (and inquisitive users) */
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
return (gimp_main(argc, argv));
|
return gimp_main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GIMP queries plug-in for parameters etc. */
|
/* GIMP queries plug-in for parameters etc. */
|
||||||
|
@ -54,8 +61,9 @@ static void query(void) {
|
||||||
static GParamDef load_args[] =
|
static GParamDef load_args[] =
|
||||||
{
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_STRING, "filename", "The name of the file to load" },
|
{ PARAM_STRING, "filename", "Filename to load image from" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
{ PARAM_STRING, "raw_filename", "Name entered" },
|
||||||
|
{ PARAM_STRING, "palette_filename", "Filename to load palette from" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static GParamDef load_return_vals[] =
|
static GParamDef load_return_vals[] =
|
||||||
|
@ -66,11 +74,12 @@ static void query(void) {
|
||||||
static int nload_return_vals = sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
static int nload_return_vals = sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
||||||
static GParamDef save_args[] =
|
static GParamDef save_args[] =
|
||||||
{
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_IMAGE, "image", "Input image" },
|
{ PARAM_IMAGE, "image", "Input image" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
||||||
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
|
{ PARAM_STRING, "filename", "Filename to save image to" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" },
|
{ PARAM_STRING, "raw_filename", "Name entered" },
|
||||||
|
{ PARAM_STRING, "palette_filename", "Filename to save palette to" },
|
||||||
};
|
};
|
||||||
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||||
|
|
||||||
|
@ -78,17 +87,16 @@ static void query(void) {
|
||||||
gimp_install_procedure("file_cel_load",
|
gimp_install_procedure("file_cel_load",
|
||||||
"Loads files in KISS CEL file format",
|
"Loads files in KISS CEL file format",
|
||||||
"This plug-in loads individual KISS cell files.",
|
"This plug-in loads individual KISS cell files.",
|
||||||
"Nick Lamb", "Nick Lamb", VERSION,
|
"Nick Lamb", "Nick Lamb", "April 1998", "<Load>/CEL", NULL, PROC_PLUG_IN,
|
||||||
"<Load>/CEL", NULL, PROC_PLUG_IN,
|
|
||||||
nload_args, nload_return_vals, load_args, load_return_vals);
|
nload_args, nload_return_vals, load_args, load_return_vals);
|
||||||
|
|
||||||
gimp_register_magic_load_handler("file_cel_load", "cel",
|
gimp_register_magic_load_handler("file_cel_load", "cel",
|
||||||
"", "0,string,KiSS");
|
"", "0,string,KiSS\040");
|
||||||
|
|
||||||
gimp_install_procedure("file_cel_save",
|
gimp_install_procedure("file_cel_save",
|
||||||
"Saves files in KISS CEL file format",
|
"Saves files in KISS CEL file format",
|
||||||
"This plug-in saves individual KISS cell files.",
|
"This plug-in saves individual KISS cell files.",
|
||||||
"Nick Lamb", "Nick Lamb", VERSION, "<Save>/CEL", "INDEXED*",
|
"Nick Lamb", "Nick Lamb", "April 1998", "<Save>/CEL", "INDEXED*",
|
||||||
PROC_PLUG_IN, nsave_args, 0, save_args, NULL);
|
PROC_PLUG_IN, nsave_args, 0, save_args, NULL);
|
||||||
|
|
||||||
gimp_register_save_handler("file_cel_save", "cel", "");
|
gimp_register_save_handler("file_cel_save", "cel", "");
|
||||||
|
@ -98,17 +106,42 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
int *nreturn_vals, GParam **return_vals) {
|
int *nreturn_vals, GParam **return_vals) {
|
||||||
|
|
||||||
gint32 image; /* image ID after load */
|
gint32 image; /* image ID after load */
|
||||||
|
gint status; /* status after save */
|
||||||
static GParam values[2]; /* Return values */
|
static GParam values[2]; /* Return values */
|
||||||
|
GRunModeType run_mode;
|
||||||
|
|
||||||
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
/* Set up default return values */
|
/* Set up default return values */
|
||||||
|
|
||||||
|
*nreturn_vals = 1;
|
||||||
values[0].type = PARAM_STATUS;
|
values[0].type = PARAM_STATUS;
|
||||||
values[0].data.d_status = STATUS_SUCCESS;
|
values[0].data.d_status = STATUS_SUCCESS;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
|
||||||
if (strcmp(name, "file_cel_load") == 0) {
|
if (strcmp(name, "file_cel_load") == 0) {
|
||||||
|
if (run_mode != RUN_NONINTERACTIVE) {
|
||||||
|
gimp_get_data ("file_cel_save:length", &data_length);
|
||||||
|
if (data_length > 0) {
|
||||||
|
palette_file= (char *) g_malloc(data_length);
|
||||||
|
gimp_get_data ("file_cel_save:data", palette_file);
|
||||||
|
} else {
|
||||||
|
palette_file= g_strdup("*.kcf");
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (run_mode == RUN_NONINTERACTIVE) {
|
||||||
|
palette_file= param[3].data.d_string;
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
} else if (run_mode == RUN_INTERACTIVE) {
|
||||||
|
|
||||||
|
/* Let user choose KCF palette (cancel ignores) */
|
||||||
|
palette_dialog("Load KISS Palette");
|
||||||
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
|
}
|
||||||
|
|
||||||
image = load_image(param[1].data.d_string, param[2].data.d_string);
|
image = load_image(param[1].data.d_string, param[2].data.d_string);
|
||||||
|
|
||||||
if (image != -1) {
|
if (image != -1) {
|
||||||
|
@ -120,8 +153,15 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (strcmp (name, "file_cel_save") == 0) {
|
} else if (strcmp (name, "file_cel_save") == 0) {
|
||||||
save_image(param[3].data.d_string, param[4].data.d_string,
|
|
||||||
param[1].data.d_int32, param[2].data.d_int32);
|
status = save_image(param[3].data.d_string, param[4].data.d_string,
|
||||||
|
param[1].data.d_int32, param[2].data.d_int32);
|
||||||
|
if (status != TRUE) {
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
} else {
|
||||||
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +171,7 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
|
|
||||||
static gint32 load_image(char *file, char *brief) {
|
static gint32 load_image(char *file, char *brief) {
|
||||||
FILE* fp; /* Read file pointer */
|
FILE* fp; /* Read file pointer */
|
||||||
char progress[255]; /* Title for progress display */
|
char *progress; /* Title for progress display */
|
||||||
guchar header[32]; /* File header */
|
guchar header[32]; /* File header */
|
||||||
int height, width, /* Dimensions of image */
|
int height, width, /* Dimensions of image */
|
||||||
colours; /* Number of colours */
|
colours; /* Number of colours */
|
||||||
|
@ -150,6 +190,12 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
/* Open the file for reading */
|
/* Open the file for reading */
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
|
|
||||||
|
if (fp == NULL) {
|
||||||
|
g_print("Can't open file\n");
|
||||||
|
gimp_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
progress= g_malloc(strlen(brief) + 10);
|
||||||
sprintf(progress, "Loading %s:", brief);
|
sprintf(progress, "Loading %s:", brief);
|
||||||
gimp_progress_init(progress);
|
gimp_progress_init(progress);
|
||||||
|
|
||||||
|
@ -157,11 +203,11 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
|
|
||||||
fread(header, 4, 1, fp);
|
fread(header, 4, 1, fp);
|
||||||
|
|
||||||
if (strncmp((char *)header, "KiSS", 4)) {
|
if (strncmp(header, "KiSS", 4)) {
|
||||||
colours= 16;
|
colours= 16;
|
||||||
width= header[0] + (256 * header[1]);
|
width= header[0] + (256 * header[1]);
|
||||||
height= header[2] + (256 * header[3]);
|
height= header[2] + (256 * header[3]);
|
||||||
} else {
|
} else { /* New-style image file, read full header */
|
||||||
fread(header, 28, 1, fp);
|
fread(header, 28, 1, fp);
|
||||||
colours= (1 << header[1]);
|
colours= (1 << header[1]);
|
||||||
width= header[4] + (256 * header[5]);
|
width= header[4] + (256 * header[5]);
|
||||||
|
@ -177,14 +223,6 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
|
|
||||||
gimp_image_set_filename(image, file);
|
gimp_image_set_filename(image, file);
|
||||||
|
|
||||||
palette = g_new(guchar, colours*3);
|
|
||||||
|
|
||||||
/* FIXME Default palette -- hopefully nasty enough to encourage a fix */
|
|
||||||
for (i= 1; i < colours; ++i)
|
|
||||||
palette[i*3+1]= palette[i*3]= i * 256 / colours;
|
|
||||||
|
|
||||||
gimp_image_set_cmap(image, palette, colours);
|
|
||||||
|
|
||||||
/* Create an indexed-alpha layer to hold the image... */
|
/* Create an indexed-alpha layer to hold the image... */
|
||||||
|
|
||||||
layer = gimp_layer_new(image, "Background", width, height,
|
layer = gimp_layer_new(image, "Background", width, height,
|
||||||
|
@ -203,7 +241,7 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
buffer = g_new(guchar, width);
|
buffer = g_new(guchar, width);
|
||||||
line = g_new(guchar, (width+1) * 2);
|
line = g_new(guchar, (width+1) * 2);
|
||||||
|
|
||||||
for (i = 0; i < height; ++i) {
|
for (i = 0; i < height && !feof(fp); ++i) {
|
||||||
|
|
||||||
switch (colours) {
|
switch (colours) {
|
||||||
case 16:
|
case 16:
|
||||||
|
@ -228,11 +266,35 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
gimp_progress_update((float) i / (float) height);
|
gimp_progress_update((float) i / (float) height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close files, give back allocated memory */
|
/* Close image files, give back allocated memory */
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
|
/* Use palette from file or otherwise default grey palette */
|
||||||
|
palette = g_new(guchar, colours*3);
|
||||||
|
|
||||||
|
/* Open the file for reading if user picked one */
|
||||||
|
if (palette_file == NULL) {
|
||||||
|
fp= NULL;
|
||||||
|
} else {
|
||||||
|
fp = fopen(palette_file, "r");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fp != NULL) {
|
||||||
|
colours= load_palette(fp, palette);
|
||||||
|
} else {
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
palette[i*3]= palette[i*3+1]= palette[i*3+2]= i * 256 / colours;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_image_set_cmap(image, palette, colours);
|
||||||
|
|
||||||
|
/* Close palette file, give back allocated memory */
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
free(palette);
|
free(palette);
|
||||||
|
|
||||||
/* Now get everything redrawn and hand back the finished image */
|
/* Now get everything redrawn and hand back the finished image */
|
||||||
|
@ -243,9 +305,43 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
return (image);
|
return (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint load_palette(FILE *fp, guchar palette[]) {
|
||||||
|
guchar header[32]; /* File header */
|
||||||
|
guchar buffer[2];
|
||||||
|
int i, bpp, colours= 0;
|
||||||
|
|
||||||
|
fread(header, 4, 1, fp);
|
||||||
|
if (!strncmp(header, "KiSS", 4)) {
|
||||||
|
fread(header+4, 28, 1, fp);
|
||||||
|
bpp= header[5];
|
||||||
|
colours= header[8] + header[9] * 256;
|
||||||
|
if (bpp == 12) {
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
fread(buffer, 1, 2, fp);
|
||||||
|
palette[i*3]= buffer[0] & 0xf0;
|
||||||
|
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
||||||
|
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fread(palette, colours, 3, fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
colours= 16; bpp= 12;
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
fread(buffer, 1, 2, fp);
|
||||||
|
palette[i*3]= buffer[0] & 0xf0;
|
||||||
|
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
||||||
|
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colours;
|
||||||
|
}
|
||||||
|
|
||||||
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
FILE* fp; /* Write file pointer */
|
FILE* fp; /* Write file pointer */
|
||||||
char progress[255]; /* Title for progress display */
|
char *progress; /* Title for progress display */
|
||||||
guchar header[32]; /* File header */
|
guchar header[32]; /* File header */
|
||||||
gint colours, type; /* Number of colours, type of layer */
|
gint colours, type; /* Number of colours, type of layer */
|
||||||
|
|
||||||
|
@ -268,12 +364,13 @@ static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
/* Open the file for writing */
|
/* Open the file for writing */
|
||||||
fp = fopen(file, "w");
|
fp = fopen(file, "w");
|
||||||
|
|
||||||
|
progress= g_malloc(strlen(brief) + 9);
|
||||||
sprintf(progress, "Saving %s:", brief);
|
sprintf(progress, "Saving %s:", brief);
|
||||||
gimp_progress_init(progress);
|
gimp_progress_init(progress);
|
||||||
|
|
||||||
/* Headers */
|
/* Headers */
|
||||||
memset(header,(int)0,(size_t)32);
|
memset(header, 0, 32);
|
||||||
strcpy((char *)header, "KiSS");
|
strcpy(header, "KiSS");
|
||||||
header[4]= 0x20;
|
header[4]= 0x20;
|
||||||
|
|
||||||
/* Work out whether to save as 8bit or 4bit */
|
/* Work out whether to save as 8bit or 4bit */
|
||||||
|
@ -327,3 +424,43 @@ static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void palette_ok (GtkWidget *widget, GtkWidget **fs) {
|
||||||
|
|
||||||
|
g_free(palette_file);
|
||||||
|
palette_file= g_strdup(gtk_file_selection_get_filename
|
||||||
|
(GTK_FILE_SELECTION(fs)));
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (fs));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void palette_cancel (GtkWidget *widget, GtkWidget **window) {
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint palette_dialog(char *title) {
|
||||||
|
gchar **argv;
|
||||||
|
gint argc = 1;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
argv= g_malloc(sizeof(gchar *));
|
||||||
|
argv[0]= strdup("CEL file-filter");
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
|
dialog= gtk_file_selection_new(title);
|
||||||
|
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
|
gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), palette_file);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (dialog)->ok_button),
|
||||||
|
"clicked", (GtkSignalFunc) palette_ok, dialog);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (dialog),
|
||||||
|
"destroy", (GtkSignalFunc) palette_cancel, NULL);
|
||||||
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (dialog)->cancel_button), "clicked", (GtkSignalFunc) palette_cancel, GTK_OBJECT (dialog));
|
||||||
|
|
||||||
|
gtk_widget_show(dialog);
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
gdk_flush ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ SUBDIRS = \
|
||||||
polar \
|
polar \
|
||||||
print \
|
print \
|
||||||
ps \
|
ps \
|
||||||
|
psd \
|
||||||
randomize \
|
randomize \
|
||||||
ripple \
|
ripple \
|
||||||
rotate \
|
rotate \
|
||||||
|
|
|
@ -10,8 +10,12 @@
|
||||||
* 0.2 Default palette (nice yellows) is automatically used
|
* 0.2 Default palette (nice yellows) is automatically used
|
||||||
* 0.3 Support for the older (pre KISS/GS) cell format
|
* 0.3 Support for the older (pre KISS/GS) cell format
|
||||||
* 0.4 First support for saving images
|
* 0.4 First support for saving images
|
||||||
* Future additions:
|
* 0.5 Show copyright date, not version number, thanks to DbBrowser
|
||||||
* + Automagically or via dialog box choose a KCF palette
|
* 0.6 File dialogs, palette handling, better magic behaviour
|
||||||
|
* 0.7 Handle interactivity settings, tidy up
|
||||||
|
* 1.0 Fixed for GIMP 0.99.27 running on GTK+ 1.0.0, and released
|
||||||
|
*
|
||||||
|
* Possible future additions:
|
||||||
* + Save (perhaps optionally?) the palette in a KCF
|
* + Save (perhaps optionally?) the palette in a KCF
|
||||||
* + Support offsets -- like GIF?
|
* + Support offsets -- like GIF?
|
||||||
*/
|
*/
|
||||||
|
@ -23,14 +27,14 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
||||||
#define VERSION "0.4"
|
|
||||||
|
|
||||||
static void query(void);
|
static void query(void);
|
||||||
static void run(char *name, int nparams, GParam *param,
|
static void run(char *name, int nparams, GParam *param,
|
||||||
int *nreturn_vals, GParam **return_vals);
|
int *nreturn_vals, GParam **return_vals);
|
||||||
|
static gint load_palette(FILE *fp, guchar palette[]);
|
||||||
static gint32 load_image(char *file, char *brief);
|
static gint32 load_image(char *file, char *brief);
|
||||||
static gint save_image(char *file, char *brief,
|
static gint save_image(char *file, char *brief,
|
||||||
gint32 image, gint32 layer);
|
gint32 image, gint32 layer);
|
||||||
|
static gint palette_dialog(char *title);
|
||||||
|
|
||||||
/* Globals... */
|
/* Globals... */
|
||||||
|
|
||||||
|
@ -42,10 +46,13 @@ GPlugInInfo PLUG_IN_INFO =
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char *palette_file= NULL;
|
||||||
|
size_t data_length= 0;
|
||||||
|
|
||||||
/* Let GIMP library handle initialisation (and inquisitive users) */
|
/* Let GIMP library handle initialisation (and inquisitive users) */
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
return (gimp_main(argc, argv));
|
return gimp_main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GIMP queries plug-in for parameters etc. */
|
/* GIMP queries plug-in for parameters etc. */
|
||||||
|
@ -54,8 +61,9 @@ static void query(void) {
|
||||||
static GParamDef load_args[] =
|
static GParamDef load_args[] =
|
||||||
{
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_STRING, "filename", "The name of the file to load" },
|
{ PARAM_STRING, "filename", "Filename to load image from" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
{ PARAM_STRING, "raw_filename", "Name entered" },
|
||||||
|
{ PARAM_STRING, "palette_filename", "Filename to load palette from" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static GParamDef load_return_vals[] =
|
static GParamDef load_return_vals[] =
|
||||||
|
@ -66,11 +74,12 @@ static void query(void) {
|
||||||
static int nload_return_vals = sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
static int nload_return_vals = sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
||||||
static GParamDef save_args[] =
|
static GParamDef save_args[] =
|
||||||
{
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_IMAGE, "image", "Input image" },
|
{ PARAM_IMAGE, "image", "Input image" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
||||||
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
|
{ PARAM_STRING, "filename", "Filename to save image to" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" },
|
{ PARAM_STRING, "raw_filename", "Name entered" },
|
||||||
|
{ PARAM_STRING, "palette_filename", "Filename to save palette to" },
|
||||||
};
|
};
|
||||||
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||||
|
|
||||||
|
@ -78,17 +87,16 @@ static void query(void) {
|
||||||
gimp_install_procedure("file_cel_load",
|
gimp_install_procedure("file_cel_load",
|
||||||
"Loads files in KISS CEL file format",
|
"Loads files in KISS CEL file format",
|
||||||
"This plug-in loads individual KISS cell files.",
|
"This plug-in loads individual KISS cell files.",
|
||||||
"Nick Lamb", "Nick Lamb", VERSION,
|
"Nick Lamb", "Nick Lamb", "April 1998", "<Load>/CEL", NULL, PROC_PLUG_IN,
|
||||||
"<Load>/CEL", NULL, PROC_PLUG_IN,
|
|
||||||
nload_args, nload_return_vals, load_args, load_return_vals);
|
nload_args, nload_return_vals, load_args, load_return_vals);
|
||||||
|
|
||||||
gimp_register_magic_load_handler("file_cel_load", "cel",
|
gimp_register_magic_load_handler("file_cel_load", "cel",
|
||||||
"", "0,string,KiSS");
|
"", "0,string,KiSS\040");
|
||||||
|
|
||||||
gimp_install_procedure("file_cel_save",
|
gimp_install_procedure("file_cel_save",
|
||||||
"Saves files in KISS CEL file format",
|
"Saves files in KISS CEL file format",
|
||||||
"This plug-in saves individual KISS cell files.",
|
"This plug-in saves individual KISS cell files.",
|
||||||
"Nick Lamb", "Nick Lamb", VERSION, "<Save>/CEL", "INDEXED*",
|
"Nick Lamb", "Nick Lamb", "April 1998", "<Save>/CEL", "INDEXED*",
|
||||||
PROC_PLUG_IN, nsave_args, 0, save_args, NULL);
|
PROC_PLUG_IN, nsave_args, 0, save_args, NULL);
|
||||||
|
|
||||||
gimp_register_save_handler("file_cel_save", "cel", "");
|
gimp_register_save_handler("file_cel_save", "cel", "");
|
||||||
|
@ -98,17 +106,42 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
int *nreturn_vals, GParam **return_vals) {
|
int *nreturn_vals, GParam **return_vals) {
|
||||||
|
|
||||||
gint32 image; /* image ID after load */
|
gint32 image; /* image ID after load */
|
||||||
|
gint status; /* status after save */
|
||||||
static GParam values[2]; /* Return values */
|
static GParam values[2]; /* Return values */
|
||||||
|
GRunModeType run_mode;
|
||||||
|
|
||||||
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
/* Set up default return values */
|
/* Set up default return values */
|
||||||
|
|
||||||
|
*nreturn_vals = 1;
|
||||||
values[0].type = PARAM_STATUS;
|
values[0].type = PARAM_STATUS;
|
||||||
values[0].data.d_status = STATUS_SUCCESS;
|
values[0].data.d_status = STATUS_SUCCESS;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
|
||||||
if (strcmp(name, "file_cel_load") == 0) {
|
if (strcmp(name, "file_cel_load") == 0) {
|
||||||
|
if (run_mode != RUN_NONINTERACTIVE) {
|
||||||
|
gimp_get_data ("file_cel_save:length", &data_length);
|
||||||
|
if (data_length > 0) {
|
||||||
|
palette_file= (char *) g_malloc(data_length);
|
||||||
|
gimp_get_data ("file_cel_save:data", palette_file);
|
||||||
|
} else {
|
||||||
|
palette_file= g_strdup("*.kcf");
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (run_mode == RUN_NONINTERACTIVE) {
|
||||||
|
palette_file= param[3].data.d_string;
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
} else if (run_mode == RUN_INTERACTIVE) {
|
||||||
|
|
||||||
|
/* Let user choose KCF palette (cancel ignores) */
|
||||||
|
palette_dialog("Load KISS Palette");
|
||||||
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
|
}
|
||||||
|
|
||||||
image = load_image(param[1].data.d_string, param[2].data.d_string);
|
image = load_image(param[1].data.d_string, param[2].data.d_string);
|
||||||
|
|
||||||
if (image != -1) {
|
if (image != -1) {
|
||||||
|
@ -120,8 +153,15 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (strcmp (name, "file_cel_save") == 0) {
|
} else if (strcmp (name, "file_cel_save") == 0) {
|
||||||
save_image(param[3].data.d_string, param[4].data.d_string,
|
|
||||||
param[1].data.d_int32, param[2].data.d_int32);
|
status = save_image(param[3].data.d_string, param[4].data.d_string,
|
||||||
|
param[1].data.d_int32, param[2].data.d_int32);
|
||||||
|
if (status != TRUE) {
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
} else {
|
||||||
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +171,7 @@ static void run(char *name, int nparams, GParam *param,
|
||||||
|
|
||||||
static gint32 load_image(char *file, char *brief) {
|
static gint32 load_image(char *file, char *brief) {
|
||||||
FILE* fp; /* Read file pointer */
|
FILE* fp; /* Read file pointer */
|
||||||
char progress[255]; /* Title for progress display */
|
char *progress; /* Title for progress display */
|
||||||
guchar header[32]; /* File header */
|
guchar header[32]; /* File header */
|
||||||
int height, width, /* Dimensions of image */
|
int height, width, /* Dimensions of image */
|
||||||
colours; /* Number of colours */
|
colours; /* Number of colours */
|
||||||
|
@ -150,6 +190,12 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
/* Open the file for reading */
|
/* Open the file for reading */
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
|
|
||||||
|
if (fp == NULL) {
|
||||||
|
g_print("Can't open file\n");
|
||||||
|
gimp_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
progress= g_malloc(strlen(brief) + 10);
|
||||||
sprintf(progress, "Loading %s:", brief);
|
sprintf(progress, "Loading %s:", brief);
|
||||||
gimp_progress_init(progress);
|
gimp_progress_init(progress);
|
||||||
|
|
||||||
|
@ -157,11 +203,11 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
|
|
||||||
fread(header, 4, 1, fp);
|
fread(header, 4, 1, fp);
|
||||||
|
|
||||||
if (strncmp((char *)header, "KiSS", 4)) {
|
if (strncmp(header, "KiSS", 4)) {
|
||||||
colours= 16;
|
colours= 16;
|
||||||
width= header[0] + (256 * header[1]);
|
width= header[0] + (256 * header[1]);
|
||||||
height= header[2] + (256 * header[3]);
|
height= header[2] + (256 * header[3]);
|
||||||
} else {
|
} else { /* New-style image file, read full header */
|
||||||
fread(header, 28, 1, fp);
|
fread(header, 28, 1, fp);
|
||||||
colours= (1 << header[1]);
|
colours= (1 << header[1]);
|
||||||
width= header[4] + (256 * header[5]);
|
width= header[4] + (256 * header[5]);
|
||||||
|
@ -177,14 +223,6 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
|
|
||||||
gimp_image_set_filename(image, file);
|
gimp_image_set_filename(image, file);
|
||||||
|
|
||||||
palette = g_new(guchar, colours*3);
|
|
||||||
|
|
||||||
/* FIXME Default palette -- hopefully nasty enough to encourage a fix */
|
|
||||||
for (i= 1; i < colours; ++i)
|
|
||||||
palette[i*3+1]= palette[i*3]= i * 256 / colours;
|
|
||||||
|
|
||||||
gimp_image_set_cmap(image, palette, colours);
|
|
||||||
|
|
||||||
/* Create an indexed-alpha layer to hold the image... */
|
/* Create an indexed-alpha layer to hold the image... */
|
||||||
|
|
||||||
layer = gimp_layer_new(image, "Background", width, height,
|
layer = gimp_layer_new(image, "Background", width, height,
|
||||||
|
@ -203,7 +241,7 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
buffer = g_new(guchar, width);
|
buffer = g_new(guchar, width);
|
||||||
line = g_new(guchar, (width+1) * 2);
|
line = g_new(guchar, (width+1) * 2);
|
||||||
|
|
||||||
for (i = 0; i < height; ++i) {
|
for (i = 0; i < height && !feof(fp); ++i) {
|
||||||
|
|
||||||
switch (colours) {
|
switch (colours) {
|
||||||
case 16:
|
case 16:
|
||||||
|
@ -228,11 +266,35 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
gimp_progress_update((float) i / (float) height);
|
gimp_progress_update((float) i / (float) height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close files, give back allocated memory */
|
/* Close image files, give back allocated memory */
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
|
/* Use palette from file or otherwise default grey palette */
|
||||||
|
palette = g_new(guchar, colours*3);
|
||||||
|
|
||||||
|
/* Open the file for reading if user picked one */
|
||||||
|
if (palette_file == NULL) {
|
||||||
|
fp= NULL;
|
||||||
|
} else {
|
||||||
|
fp = fopen(palette_file, "r");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fp != NULL) {
|
||||||
|
colours= load_palette(fp, palette);
|
||||||
|
} else {
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
palette[i*3]= palette[i*3+1]= palette[i*3+2]= i * 256 / colours;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_image_set_cmap(image, palette, colours);
|
||||||
|
|
||||||
|
/* Close palette file, give back allocated memory */
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
free(palette);
|
free(palette);
|
||||||
|
|
||||||
/* Now get everything redrawn and hand back the finished image */
|
/* Now get everything redrawn and hand back the finished image */
|
||||||
|
@ -243,9 +305,43 @@ static gint32 load_image(char *file, char *brief) {
|
||||||
return (image);
|
return (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint load_palette(FILE *fp, guchar palette[]) {
|
||||||
|
guchar header[32]; /* File header */
|
||||||
|
guchar buffer[2];
|
||||||
|
int i, bpp, colours= 0;
|
||||||
|
|
||||||
|
fread(header, 4, 1, fp);
|
||||||
|
if (!strncmp(header, "KiSS", 4)) {
|
||||||
|
fread(header+4, 28, 1, fp);
|
||||||
|
bpp= header[5];
|
||||||
|
colours= header[8] + header[9] * 256;
|
||||||
|
if (bpp == 12) {
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
fread(buffer, 1, 2, fp);
|
||||||
|
palette[i*3]= buffer[0] & 0xf0;
|
||||||
|
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
||||||
|
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fread(palette, colours, 3, fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
colours= 16; bpp= 12;
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
for (i= 0; i < colours; ++i) {
|
||||||
|
fread(buffer, 1, 2, fp);
|
||||||
|
palette[i*3]= buffer[0] & 0xf0;
|
||||||
|
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
||||||
|
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colours;
|
||||||
|
}
|
||||||
|
|
||||||
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
FILE* fp; /* Write file pointer */
|
FILE* fp; /* Write file pointer */
|
||||||
char progress[255]; /* Title for progress display */
|
char *progress; /* Title for progress display */
|
||||||
guchar header[32]; /* File header */
|
guchar header[32]; /* File header */
|
||||||
gint colours, type; /* Number of colours, type of layer */
|
gint colours, type; /* Number of colours, type of layer */
|
||||||
|
|
||||||
|
@ -268,12 +364,13 @@ static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
/* Open the file for writing */
|
/* Open the file for writing */
|
||||||
fp = fopen(file, "w");
|
fp = fopen(file, "w");
|
||||||
|
|
||||||
|
progress= g_malloc(strlen(brief) + 9);
|
||||||
sprintf(progress, "Saving %s:", brief);
|
sprintf(progress, "Saving %s:", brief);
|
||||||
gimp_progress_init(progress);
|
gimp_progress_init(progress);
|
||||||
|
|
||||||
/* Headers */
|
/* Headers */
|
||||||
memset(header,(int)0,(size_t)32);
|
memset(header, 0, 32);
|
||||||
strcpy((char *)header, "KiSS");
|
strcpy(header, "KiSS");
|
||||||
header[4]= 0x20;
|
header[4]= 0x20;
|
||||||
|
|
||||||
/* Work out whether to save as 8bit or 4bit */
|
/* Work out whether to save as 8bit or 4bit */
|
||||||
|
@ -327,3 +424,43 @@ static gint save_image(char *file, char *brief, gint32 image, gint32 layer) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void palette_ok (GtkWidget *widget, GtkWidget **fs) {
|
||||||
|
|
||||||
|
g_free(palette_file);
|
||||||
|
palette_file= g_strdup(gtk_file_selection_get_filename
|
||||||
|
(GTK_FILE_SELECTION(fs)));
|
||||||
|
data_length= strlen(palette_file) + 1;
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (fs));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void palette_cancel (GtkWidget *widget, GtkWidget **window) {
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint palette_dialog(char *title) {
|
||||||
|
gchar **argv;
|
||||||
|
gint argc = 1;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
argv= g_malloc(sizeof(gchar *));
|
||||||
|
argv[0]= strdup("CEL file-filter");
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
|
dialog= gtk_file_selection_new(title);
|
||||||
|
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
|
gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), palette_file);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (dialog)->ok_button),
|
||||||
|
"clicked", (GtkSignalFunc) palette_ok, dialog);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (dialog),
|
||||||
|
"destroy", (GtkSignalFunc) palette_cancel, NULL);
|
||||||
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (dialog)->cancel_button), "clicked", (GtkSignalFunc) palette_cancel, GTK_OBJECT (dialog));
|
||||||
|
|
||||||
|
gtk_widget_show(dialog);
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
gdk_flush ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,6 @@
|
||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
|
.deps
|
||||||
|
_libs
|
||||||
|
.libs
|
||||||
|
psd
|
|
@ -0,0 +1,39 @@
|
||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
pluginlibdir = $(gimpplugindir)/plug-ins
|
||||||
|
|
||||||
|
pluginlib_PROGRAMS = psd
|
||||||
|
|
||||||
|
psd_SOURCES = \
|
||||||
|
psd.c
|
||||||
|
|
||||||
|
INCLUDES = \
|
||||||
|
$(X_CFLAGS) \
|
||||||
|
-I$(top_srcdir) \
|
||||||
|
-I$(includedir)
|
||||||
|
|
||||||
|
LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
|
$(X_LIBS) \
|
||||||
|
\
|
||||||
|
-lc
|
||||||
|
|
||||||
|
DEPS = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
|
$(top_builddir)/libgimp/libgimp.la
|
||||||
|
|
||||||
|
psd_DEPENDENCIES = $(DEPS)
|
||||||
|
|
||||||
|
.PHONY: files
|
||||||
|
|
||||||
|
files:
|
||||||
|
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||||
|
echo $$p; \
|
||||||
|
done
|
||||||
|
@for subdir in $(SUBDIRS); do \
|
||||||
|
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||||
|
for file in $$files; do \
|
||||||
|
echo $$subdir/$$file; \
|
||||||
|
done; \
|
||||||
|
done
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue