mirror of https://github.com/GNOME/gimp.git
parent
23f00ee6f0
commit
2a783d04a7
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Wed Oct 20 03:42:08 MEST 1999 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/common/Makefile.am
|
||||||
|
* plug-ins/common/pix.c
|
||||||
|
* plug-ins/common/plugin-defs.pl
|
||||||
|
* plug-ins/common/png.c
|
||||||
|
* plug-ins/common/psp.c
|
||||||
|
* plug-ins/fits/Makefile.am
|
||||||
|
* plug-ins/fits/fits.c
|
||||||
|
* plug-ins/sgi/Makefile.am
|
||||||
|
* plug-ins/sgi/sgi.c: made more save plug-ins export-aware.
|
||||||
|
Hopefully I have converted them all now. If you find one that I
|
||||||
|
missed or experience any problems, please drop me a mail.
|
||||||
|
|
||||||
Tue Oct 19 17:56:29 PDT 1999 Manish Singh <yosh@gimp.org>
|
Tue Oct 19 17:56:29 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* plug-ins/common/bz2.c
|
* plug-ins/common/bz2.c
|
||||||
|
|
|
@ -778,8 +778,9 @@ pix_SOURCES = \
|
||||||
pix.c
|
pix.c
|
||||||
|
|
||||||
pix_LDADD = \
|
pix_LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GLIB_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
||||||
pixelize_SOURCES = \
|
pixelize_SOURCES = \
|
||||||
|
@ -854,6 +855,7 @@ psp_SOURCES = \
|
||||||
psp.c
|
psp.c
|
||||||
|
|
||||||
psp_LDADD = \
|
psp_LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(LIBZ) \
|
$(LIBZ) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
|
|
|
@ -47,7 +47,9 @@ static char ident[] = "@(#) GIMP Alias|Wavefront pix image file-plugin v1.0 24-
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <libgimp/gimp.h>
|
#include "gtk/gtk.h"
|
||||||
|
#include "libgimp/gimp.h"
|
||||||
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
/* #define PIX_DEBUG */
|
/* #define PIX_DEBUG */
|
||||||
|
|
||||||
|
@ -63,19 +65,19 @@ static char ident[] = "@(#) GIMP Alias|Wavefront pix image file-plugin v1.0 24-
|
||||||
|
|
||||||
/* Standard Plug-in Functions */
|
/* Standard Plug-in Functions */
|
||||||
|
|
||||||
static void query ();
|
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 );
|
||||||
|
|
||||||
/* Local Helper Functions */
|
/* Local Helper Functions */
|
||||||
|
|
||||||
static gint32 load_image( char *filename );
|
static gint32 load_image (char *filename );
|
||||||
static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID );
|
static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID );
|
||||||
|
|
||||||
static guint16 get_short( FILE * file );
|
static guint16 get_short (FILE * file );
|
||||||
static void put_short( guint16 value, FILE * file );
|
static void put_short (guint16 value, FILE * file );
|
||||||
static guint32 get_long( FILE * file );
|
|
||||||
static gchar get_char( FILE * file );
|
static void init_gtk (void);
|
||||||
|
|
||||||
/******************
|
/******************
|
||||||
* Implementation *
|
* Implementation *
|
||||||
|
@ -97,39 +99,43 @@ static void query ()
|
||||||
* Register the services provided by this plug-in
|
* Register the services provided by this plug-in
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static GParamDef load_args[] = {
|
static GParamDef load_args[] =
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{
|
||||||
{ PARAM_STRING, "filename", "The name of the file to load" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name entered" },
|
{ PARAM_STRING, "filename", "The name of the file to load" },
|
||||||
};
|
{ PARAM_STRING, "raw_filename", "The name entered" },
|
||||||
static GParamDef load_return_vals[] = {
|
};
|
||||||
{ PARAM_IMAGE, "image", "Output image" },
|
static int nload_args =
|
||||||
};
|
sizeof (load_args) / sizeof (load_args[0]);
|
||||||
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
|
|
||||||
static int nload_return_vals = sizeof (load_return_vals) /
|
|
||||||
sizeof (load_return_vals[0]);
|
|
||||||
|
|
||||||
static GParamDef save_args[] = {
|
static GParamDef load_return_vals[] =
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{
|
||||||
{ PARAM_IMAGE, "image", "Input image" },
|
{ PARAM_IMAGE, "image", "Output image" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
};
|
||||||
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
|
static int nload_return_vals =
|
||||||
{ PARAM_STRING, "raw_filename",
|
sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
||||||
"The name of the file to save the image in" }
|
|
||||||
};
|
|
||||||
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
|
||||||
|
|
||||||
gimp_install_procedure ("file_pix_load",
|
static GParamDef save_args[] =
|
||||||
"loads files of the PIX file format",
|
{
|
||||||
"loads files of the PIX file format",
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
"Michael Taylor",
|
{ PARAM_IMAGE, "image", "Input image" },
|
||||||
"Michael Taylor",
|
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
||||||
"1997",
|
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
|
||||||
"<Load>/PIX",
|
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" }
|
||||||
NULL,
|
};
|
||||||
PROC_PLUG_IN,
|
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||||
nload_args, nload_return_vals,
|
|
||||||
load_args, load_return_vals);
|
gimp_install_procedure ("file_pix_load",
|
||||||
|
"loads files of the PIX file format",
|
||||||
|
"loads files of the PIX file format",
|
||||||
|
"Michael Taylor",
|
||||||
|
"Michael Taylor",
|
||||||
|
"1997",
|
||||||
|
"<Load>/PIX",
|
||||||
|
NULL,
|
||||||
|
PROC_PLUG_IN,
|
||||||
|
nload_args, nload_return_vals,
|
||||||
|
load_args, load_return_vals);
|
||||||
|
|
||||||
gimp_install_procedure ("file_pix_save",
|
gimp_install_procedure ("file_pix_save",
|
||||||
"save file in the Alias|Wavefront pix/matte file format",
|
"save file in the Alias|Wavefront pix/matte file format",
|
||||||
|
@ -143,12 +149,16 @@ static void query ()
|
||||||
nsave_args, 0,
|
nsave_args, 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
gimp_register_load_handler ("file_pix_load", "pix,matte,mask,alpha,als", "");
|
gimp_register_load_handler ("file_pix_load", "pix,matte,mask,alpha,als", "");
|
||||||
gimp_register_save_handler ("file_pix_save", "pix,matte,mask,alpha,als", "");
|
gimp_register_save_handler ("file_pix_save", "pix,matte,mask,alpha,als", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run ( char *name, int nparams, GParam *param, int *nreturn_vals,
|
static void
|
||||||
GParam **return_vals )
|
run (char *name,
|
||||||
|
int nparams,
|
||||||
|
GParam *param,
|
||||||
|
int *nreturn_vals,
|
||||||
|
GParam **return_vals )
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* perform registered plug-in function
|
* perform registered plug-in function
|
||||||
|
@ -161,103 +171,114 @@ static void run ( char *name, int nparams, GParam *param, int *nreturn_vals,
|
||||||
* return_vals - parameters returned by the function
|
* return_vals - parameters returned by the function
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static GParam values[2];
|
static GParam values[2];
|
||||||
GRunModeType run_mode;
|
GRunModeType run_mode;
|
||||||
GStatusType status = STATUS_SUCCESS;
|
GStatusType status = STATUS_SUCCESS;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
|
GimpExportReturnType export = EXPORT_CANCEL;
|
||||||
|
|
||||||
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
*nreturn_vals = 1;
|
||||||
|
*return_vals = values;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
values[0].type = PARAM_STATUS;
|
||||||
*return_vals = values;
|
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||||
|
|
||||||
values[0].type = PARAM_STATUS;
|
if (strcmp (name, "file_pix_load") == 0)
|
||||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
{
|
||||||
|
/* Perform the image load */
|
||||||
if (strcmp (name, "file_pix_load") == 0) {
|
image_ID = load_image (param[1].data.d_string);
|
||||||
/* Perform the image load */
|
if (image_ID != -1)
|
||||||
image_ID = load_image (param[1].data.d_string);
|
{
|
||||||
if (image_ID != -1) {
|
/* The image load was successful */
|
||||||
/* The image load was successful */
|
*nreturn_vals = 2;
|
||||||
*nreturn_vals = 2;
|
values[0].data.d_status = STATUS_SUCCESS;
|
||||||
values[0].data.d_status = STATUS_SUCCESS;
|
values[1].type = PARAM_IMAGE;
|
||||||
values[1].type = PARAM_IMAGE;
|
values[1].data.d_image = image_ID;
|
||||||
values[1].data.d_image = image_ID;
|
|
||||||
} else {
|
|
||||||
/* The image load falied */
|
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
|
||||||
}
|
|
||||||
} else if (strcmp (name, "file_pix_save") == 0) {
|
|
||||||
if (status == STATUS_SUCCESS) {
|
|
||||||
if ( !save_image ( param[3].data.d_string, param[1].data.d_int32,
|
|
||||||
param[2].data.d_int32))
|
|
||||||
{
|
|
||||||
status = STATUS_EXECUTION_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
values[0].data.d_status = status;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
g_assert (FALSE);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The image load falied */
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp (name, "file_pix_save") == 0)
|
||||||
|
{
|
||||||
|
image_ID = param[1].data.d_int32;
|
||||||
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
|
/* eventually export the image */
|
||||||
|
switch (run_mode)
|
||||||
|
{
|
||||||
|
case RUN_INTERACTIVE:
|
||||||
|
case RUN_WITH_LAST_VALS:
|
||||||
|
init_gtk ();
|
||||||
|
export = gimp_export_image (&image_ID, &drawable_ID, "PIX",
|
||||||
|
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_ALPHA));
|
||||||
|
if (export == EXPORT_CANCEL)
|
||||||
|
{
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
if ( !save_image (param[3].data.d_string, image_ID, drawable_ID))
|
||||||
|
{
|
||||||
|
status = STATUS_EXECUTION_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
values[0].data.d_status = status;
|
||||||
|
|
||||||
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert (FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static guint16 get_short( FILE * file )
|
static guint16
|
||||||
|
get_short (FILE *file)
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* Reads a 16-bit integer from a file in such a way that the machine's
|
* Reads a 16-bit integer from a file in such a way that the machine's
|
||||||
* bit ordering should not matter
|
* bit ordering should not matter
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
guchar buf[2];
|
guchar buf[2];
|
||||||
|
|
||||||
fread( buf, 2, 1, file);
|
fread (buf, 2, 1, file);
|
||||||
return ( buf[0] << 8 ) + ( buf[1] << 0 );
|
return ( buf[0] << 8 ) + ( buf[1] << 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_short( guint16 value, FILE * file )
|
static void
|
||||||
|
put_short (guint16 value,
|
||||||
|
FILE *file)
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* Reads a 16-bit integer from a file in such a way that the machine's
|
* Reads a 16-bit integer from a file in such a way that the machine's
|
||||||
* bit ordering should not matter
|
* bit ordering should not matter
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
guchar buf[2];
|
guchar buf[2];
|
||||||
buf[0] = (guchar)( value >> 8 );
|
buf[0] = (guchar)( value >> 8 );
|
||||||
buf[1] = (guchar)( value % 256 );
|
buf[1] = (guchar)( value % 256 );
|
||||||
|
|
||||||
fwrite( buf, 2, 1, file);
|
fwrite( buf, 2, 1, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32 get_long( FILE * file )
|
|
||||||
/*
|
|
||||||
* Description:
|
|
||||||
* Reads a 16-bit integer from a file in such a way that the machine's
|
|
||||||
* bit ordering should not matter
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
guchar buf[4];
|
|
||||||
|
|
||||||
fread( buf, 4, 1, file );
|
static gint32
|
||||||
return ( buf[0] << 24 ) + ( buf[1] << 16 )
|
load_image (char *filename)
|
||||||
+ ( buf[2] << 8 ) + ( buf[3] << 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
static gchar get_char( FILE * file )
|
|
||||||
/*
|
|
||||||
* Description:
|
|
||||||
* Reads a byte from a file. Provided for convenience;
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
gchar result;
|
|
||||||
|
|
||||||
fread( &result, 1, 1, file );
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint32 load_image (char *filename)
|
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* load the given image into gimp
|
* load the given image into gimp
|
||||||
|
@ -270,154 +291,175 @@ static gint32 load_image (char *filename)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
gint i, j, tile_height, row;
|
gint i, j, tile_height, row;
|
||||||
FILE * file = NULL;
|
FILE * file = NULL;
|
||||||
gchar * progMessage;
|
gchar * progMessage;
|
||||||
guchar * dest;
|
guchar * dest;
|
||||||
guchar * dest_base;
|
guchar * dest_base;
|
||||||
GDrawable * drawable;
|
GDrawable * drawable;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
gint32 layer_ID;
|
gint32 layer_ID;
|
||||||
GPixelRgn pixel_rgn;
|
GPixelRgn pixel_rgn;
|
||||||
gushort width, height, depth;
|
gushort width, height, depth;
|
||||||
|
|
||||||
GImageType imgtype;
|
GImageType imgtype;
|
||||||
GDrawableType gdtype;
|
GDrawableType gdtype;
|
||||||
|
|
||||||
/* Set up progress display */
|
/* Set up progress display */
|
||||||
progMessage = malloc (strlen (filename) + 12);
|
progMessage = malloc (strlen (filename) + 12);
|
||||||
if (!progMessage) gimp_quit ();
|
if (!progMessage)
|
||||||
sprintf (progMessage, "Loading %s:", filename);
|
gimp_quit ();
|
||||||
gimp_progress_init (progMessage);
|
sprintf (progMessage, "Loading %s:", filename);
|
||||||
free (progMessage);
|
gimp_progress_init (progMessage);
|
||||||
|
free (progMessage);
|
||||||
|
|
||||||
PIX_DEBUG_PRINT("Opening file: %s\n",filename);
|
PIX_DEBUG_PRINT("Opening file: %s\n",filename);
|
||||||
|
|
||||||
/* Open the file */
|
/* Open the file */
|
||||||
file = fopen( filename, "r" );
|
file = fopen( filename, "r" );
|
||||||
if ( NULL == file ) {
|
if ( NULL == file )
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read header information */
|
/* Read header information */
|
||||||
width = get_short( file );
|
width = get_short( file );
|
||||||
height = get_short( file );
|
height = get_short( file );
|
||||||
get_short( file ); /* Discard obsolete fields */
|
get_short( file ); /* Discard obsolete fields */
|
||||||
get_short( file ); /* Discard obsolete fields */
|
get_short( file ); /* Discard obsolete fields */
|
||||||
depth = get_short( file );
|
depth = get_short( file );
|
||||||
|
|
||||||
PIX_DEBUG_PRINT( "Width %hu\n", width );
|
PIX_DEBUG_PRINT( "Width %hu\n", width );
|
||||||
PIX_DEBUG_PRINT( "Height %hu\n", height );
|
PIX_DEBUG_PRINT( "Height %hu\n", height );
|
||||||
|
|
||||||
if ( depth == 8 ) {
|
if ( depth == 8 )
|
||||||
/* Loading a matte file */
|
{
|
||||||
imgtype = GRAY;
|
/* Loading a matte file */
|
||||||
gdtype = GRAY_IMAGE;
|
imgtype = GRAY;
|
||||||
} else if ( depth == 24 ) {
|
gdtype = GRAY_IMAGE;
|
||||||
/* Loading an RGB file */
|
}
|
||||||
imgtype = RGB;
|
else if ( depth == 24 )
|
||||||
gdtype = RGB_IMAGE;
|
{
|
||||||
} else {
|
/* Loading an RGB file */
|
||||||
/* Header is invalid */
|
imgtype = RGB;
|
||||||
fclose( file );
|
gdtype = RGB_IMAGE;
|
||||||
return -1;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
/* Header is invalid */
|
||||||
|
fclose( file );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
image_ID = gimp_image_new ( width, height, imgtype );
|
image_ID = gimp_image_new ( width, height, imgtype );
|
||||||
gimp_image_set_filename ( image_ID, filename );
|
gimp_image_set_filename ( image_ID, filename );
|
||||||
layer_ID = gimp_layer_new ( image_ID, "Background",
|
layer_ID = gimp_layer_new ( image_ID, "Background",
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
gdtype, 100, NORMAL_MODE );
|
gdtype, 100, NORMAL_MODE );
|
||||||
gimp_image_add_layer ( image_ID, layer_ID, 0);
|
gimp_image_add_layer ( image_ID, layer_ID, 0);
|
||||||
drawable = gimp_drawable_get ( layer_ID );
|
drawable = gimp_drawable_get ( layer_ID );
|
||||||
gimp_pixel_rgn_init ( &pixel_rgn, drawable, 0, 0, drawable->width,
|
gimp_pixel_rgn_init ( &pixel_rgn, drawable, 0, 0, drawable->width,
|
||||||
drawable->height, TRUE, FALSE );
|
drawable->height, TRUE, FALSE );
|
||||||
|
|
||||||
tile_height = gimp_tile_height();
|
tile_height = gimp_tile_height();
|
||||||
|
|
||||||
if ( depth == 24 ) {
|
if ( depth == 24 )
|
||||||
/* Read a 24-bit Pix image */
|
{
|
||||||
guchar record[4];
|
/* Read a 24-bit Pix image */
|
||||||
gint readlen;
|
guchar record[4];
|
||||||
tile_height = gimp_tile_height();
|
gint readlen;
|
||||||
|
tile_height = gimp_tile_height();
|
||||||
|
|
||||||
dest_base = dest = g_new (guchar, 3 * width * tile_height);
|
dest_base = dest = g_new (guchar, 3 * width * tile_height);
|
||||||
|
|
||||||
for (i = 0; i < height;) {
|
for (i = 0; i < height;)
|
||||||
for ( dest = dest_base, row = 0;
|
{
|
||||||
row < tile_height && i < height;
|
for ( dest = dest_base, row = 0;
|
||||||
i += 1, row += 1)
|
row < tile_height && i < height;
|
||||||
{
|
i += 1, row += 1)
|
||||||
guchar count;
|
{
|
||||||
|
guchar count;
|
||||||
|
|
||||||
/* Read a row of the image */
|
/* Read a row of the image */
|
||||||
j = 0;
|
j = 0;
|
||||||
while ( j < width ) {
|
while ( j < width )
|
||||||
readlen = fread( record, 1, 4, file );
|
{
|
||||||
if ( readlen < 4 ) break;
|
readlen = fread( record, 1, 4, file );
|
||||||
|
if ( readlen < 4 )
|
||||||
|
break;
|
||||||
|
|
||||||
for ( count = 0; count < record[0]; ++count ) {
|
for ( count = 0; count < record[0]; ++count )
|
||||||
dest[0] = record[3];
|
{
|
||||||
dest[1] = record[2];
|
dest[0] = record[3];
|
||||||
dest[2] = record[1];
|
dest[1] = record[2];
|
||||||
dest += 3;
|
dest[2] = record[1];
|
||||||
j++;
|
dest += 3;
|
||||||
if ( j >= width ) break;
|
j++;
|
||||||
}
|
if ( j >= width )
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
gimp_pixel_rgn_set_rect (&pixel_rgn, dest_base, 0, i-row,
|
|
||||||
width, row);
|
|
||||||
gimp_progress_update ((double) i / (double) height);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free( dest_base );
|
gimp_pixel_rgn_set_rect (&pixel_rgn, dest_base, 0, i-row,
|
||||||
} else {
|
width, row);
|
||||||
/* Read an 8-bit Matte image */
|
gimp_progress_update ((double) i / (double) height);
|
||||||
guchar record[2];
|
|
||||||
gint readlen;
|
|
||||||
|
|
||||||
dest_base = dest = g_new (guchar, width * tile_height);
|
|
||||||
|
|
||||||
for (i = 0; i < height;) {
|
|
||||||
for ( dest = dest_base, row = 0;
|
|
||||||
row < tile_height && i < height;
|
|
||||||
i += 1, row += 1)
|
|
||||||
{
|
|
||||||
guchar count;
|
|
||||||
|
|
||||||
/* Read a row of the image */
|
|
||||||
j = 0;
|
|
||||||
while ( j < width ) {
|
|
||||||
readlen = fread( record, 1, 2, file );
|
|
||||||
if ( readlen < 2 ) break;
|
|
||||||
|
|
||||||
for ( count = 0; count < record[0]; ++count ) {
|
|
||||||
dest[j] = record[1];
|
|
||||||
j++;
|
|
||||||
if ( j >= width ) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dest += width;
|
|
||||||
}
|
|
||||||
gimp_pixel_rgn_set_rect (&pixel_rgn, dest_base, 0, i-row,
|
|
||||||
width, row);
|
|
||||||
gimp_progress_update ((double) i / (double) height);
|
|
||||||
}
|
|
||||||
free( dest_base );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_flush (drawable);
|
free( dest_base );
|
||||||
gimp_drawable_detach (drawable);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Read an 8-bit Matte image */
|
||||||
|
guchar record[2];
|
||||||
|
gint readlen;
|
||||||
|
|
||||||
fclose( file );
|
dest_base = dest = g_new (guchar, width * tile_height);
|
||||||
|
|
||||||
return image_ID;
|
for (i = 0; i < height;)
|
||||||
|
{
|
||||||
|
for ( dest = dest_base, row = 0;
|
||||||
|
row < tile_height && i < height;
|
||||||
|
i += 1, row += 1)
|
||||||
|
{
|
||||||
|
guchar count;
|
||||||
|
|
||||||
|
/* Read a row of the image */
|
||||||
|
j = 0;
|
||||||
|
while ( j < width )
|
||||||
|
{
|
||||||
|
readlen = fread( record, 1, 2, file );
|
||||||
|
if ( readlen < 2 ) break;
|
||||||
|
|
||||||
|
for ( count = 0; count < record[0]; ++count )
|
||||||
|
{
|
||||||
|
dest[j] = record[1];
|
||||||
|
j++;
|
||||||
|
if ( j >= width ) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dest += width;
|
||||||
|
}
|
||||||
|
gimp_pixel_rgn_set_rect (&pixel_rgn, dest_base, 0, i-row,
|
||||||
|
width, row);
|
||||||
|
gimp_progress_update ((double) i / (double) height);
|
||||||
|
}
|
||||||
|
free( dest_base );
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_drawable_flush (drawable);
|
||||||
|
gimp_drawable_detach (drawable);
|
||||||
|
|
||||||
|
fclose( file );
|
||||||
|
|
||||||
|
return image_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
static gint
|
||||||
|
save_image (char *filename,
|
||||||
|
gint32 image_ID,
|
||||||
|
gint32 drawable_ID )
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* save the given file out as an alias pix or matte file
|
* save the given file out as an alias pix or matte file
|
||||||
|
@ -428,159 +470,189 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
* drawable_ID - current drawable
|
* drawable_ID - current drawable
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
gint depth, i, j, row, tile_height, writelen, rectHeight;
|
gint depth, i, j, row, tile_height, writelen, rectHeight;
|
||||||
/* gboolean savingAlpha = FALSE; */
|
/* gboolean savingAlpha = FALSE; */
|
||||||
gboolean savingColor = TRUE;
|
gboolean savingColor = TRUE;
|
||||||
guchar * src;
|
guchar * src;
|
||||||
guchar * src_base;
|
guchar * src_base;
|
||||||
gchar * progMessage;
|
gchar * progMessage;
|
||||||
GDrawable * drawable;
|
GDrawable * drawable;
|
||||||
GPixelRgn pixel_rgn;
|
GPixelRgn pixel_rgn;
|
||||||
FILE * file;
|
FILE * file;
|
||||||
|
|
||||||
/* Get info about image */
|
/* Get info about image */
|
||||||
drawable = gimp_drawable_get(drawable_ID);
|
drawable = gimp_drawable_get(drawable_ID);
|
||||||
|
|
||||||
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
|
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
|
||||||
drawable->height, FALSE, FALSE);
|
drawable->height, FALSE, FALSE);
|
||||||
|
|
||||||
switch (gimp_drawable_type(drawable_ID))
|
switch (gimp_drawable_type(drawable_ID))
|
||||||
|
{
|
||||||
|
case GRAY_IMAGE:
|
||||||
|
savingColor = FALSE;
|
||||||
|
depth = 1;
|
||||||
|
break;
|
||||||
|
case GRAYA_IMAGE:
|
||||||
|
savingColor = FALSE;
|
||||||
|
depth = 2;
|
||||||
|
break;
|
||||||
|
case RGB_IMAGE:
|
||||||
|
savingColor = TRUE;
|
||||||
|
depth = 3;
|
||||||
|
break;
|
||||||
|
case RGBA_IMAGE:
|
||||||
|
savingColor = TRUE;
|
||||||
|
depth = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Open the output file. */
|
||||||
|
file = fopen (filename, "wb");
|
||||||
|
if ( !file )
|
||||||
|
{
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up progress display */
|
||||||
|
progMessage = malloc (strlen (filename) + 12);
|
||||||
|
if (!progMessage)
|
||||||
|
gimp_quit ();
|
||||||
|
sprintf (progMessage, "Saving %s:", filename);
|
||||||
|
gimp_progress_init (progMessage);
|
||||||
|
free (progMessage);
|
||||||
|
|
||||||
|
/* Write the image header */
|
||||||
|
PIX_DEBUG_PRINT( "Width %hu\n", drawable->width );
|
||||||
|
PIX_DEBUG_PRINT( "Height %hu\n", drawable->height );
|
||||||
|
put_short( drawable->width, file );
|
||||||
|
put_short( drawable->height, file );
|
||||||
|
put_short( 0, file );
|
||||||
|
put_short( 0, file );
|
||||||
|
if ( savingColor )
|
||||||
|
{
|
||||||
|
put_short( 24, file );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
put_short( 8, file );
|
||||||
|
}
|
||||||
|
|
||||||
|
tile_height = gimp_tile_height();
|
||||||
|
src_base = g_new( guchar, tile_height * drawable->width * depth );
|
||||||
|
|
||||||
|
if ( savingColor )
|
||||||
|
{
|
||||||
|
/* Writing a 24-bit Pix image */
|
||||||
|
guchar record[4];
|
||||||
|
|
||||||
|
for (i = 0; i < drawable->height;)
|
||||||
{
|
{
|
||||||
case GRAY_IMAGE:
|
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
||||||
savingColor = FALSE;
|
tile_height : ( drawable->height - i - 1 );
|
||||||
depth = 1;
|
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
||||||
break;
|
drawable->width, rectHeight);
|
||||||
case GRAYA_IMAGE:
|
|
||||||
savingColor = FALSE;
|
|
||||||
depth = 2;
|
|
||||||
break;
|
|
||||||
case RGB_IMAGE:
|
|
||||||
savingColor = TRUE;
|
|
||||||
depth = 3;
|
|
||||||
break;
|
|
||||||
case RGBA_IMAGE:
|
|
||||||
savingColor = TRUE;
|
|
||||||
depth = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
for ( src = src_base, row = 0;
|
||||||
|
row < tile_height && i < drawable->height;
|
||||||
|
i += 1, row += 1)
|
||||||
|
{
|
||||||
|
/* Write a row of the image */
|
||||||
|
record[0] = 1;
|
||||||
|
record[3] = src[0];
|
||||||
|
record[2] = src[1];
|
||||||
|
record[1] = src[2];
|
||||||
|
src += depth;
|
||||||
|
for ( j = 1; j < drawable->width; ++j )
|
||||||
|
{
|
||||||
|
if ( ( record[3] != src[0] ) ||
|
||||||
|
( record[2] != src[1] ) ||
|
||||||
|
( record[1] != src[2] ) ||
|
||||||
|
( record[0] == 255 ) )
|
||||||
|
{
|
||||||
|
/* Write current RLE record and start a new one */
|
||||||
|
|
||||||
/* Open the output file. */
|
writelen = fwrite( record, 1, 4, file );
|
||||||
file = fopen (filename, "wb");
|
record[0] = 1;
|
||||||
if ( !file ) {
|
record[3] = src[0];
|
||||||
return (FALSE);
|
record[2] = src[1];
|
||||||
}
|
record[1] = src[2];
|
||||||
|
}
|
||||||
/* Set up progress display */
|
else
|
||||||
progMessage = malloc (strlen (filename) + 12);
|
{
|
||||||
if (!progMessage) gimp_quit ();
|
/* increment run length in current record */
|
||||||
sprintf (progMessage, "Saving %s:", filename);
|
record[0] ++;
|
||||||
gimp_progress_init (progMessage);
|
}
|
||||||
free (progMessage);
|
src += depth;
|
||||||
|
|
||||||
/* Write the image header */
|
|
||||||
PIX_DEBUG_PRINT( "Width %hu\n", drawable->width );
|
|
||||||
PIX_DEBUG_PRINT( "Height %hu\n", drawable->height );
|
|
||||||
put_short( drawable->width, file );
|
|
||||||
put_short( drawable->height, file );
|
|
||||||
put_short( 0, file );
|
|
||||||
put_short( 0, file );
|
|
||||||
if ( savingColor ) {
|
|
||||||
put_short( 24, file );
|
|
||||||
} else {
|
|
||||||
put_short( 8, file );
|
|
||||||
}
|
|
||||||
|
|
||||||
tile_height = gimp_tile_height();
|
|
||||||
src_base = g_new( guchar, tile_height * drawable->width * depth );
|
|
||||||
|
|
||||||
if ( savingColor ) {
|
|
||||||
/* Writing a 24-bit Pix image */
|
|
||||||
guchar record[4];
|
|
||||||
|
|
||||||
for (i = 0; i < drawable->height;) {
|
|
||||||
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
|
||||||
tile_height : ( drawable->height - i - 1 );
|
|
||||||
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
|
||||||
drawable->width, rectHeight);
|
|
||||||
|
|
||||||
for ( src = src_base, row = 0;
|
|
||||||
row < tile_height && i < drawable->height;
|
|
||||||
i += 1, row += 1)
|
|
||||||
{
|
|
||||||
/* Write a row of the image */
|
|
||||||
record[0] = 1;
|
|
||||||
record[3] = src[0];
|
|
||||||
record[2] = src[1];
|
|
||||||
record[1] = src[2];
|
|
||||||
src += depth;
|
|
||||||
for ( j = 1; j < drawable->width; ++j ) {
|
|
||||||
if ( ( record[3] != src[0] ) ||
|
|
||||||
( record[2] != src[1] ) ||
|
|
||||||
( record[1] != src[2] ) ||
|
|
||||||
( record[0] == 255 ) )
|
|
||||||
{
|
|
||||||
/* Write current RLE record and start a new one */
|
|
||||||
|
|
||||||
writelen = fwrite( record, 1, 4, file );
|
|
||||||
record[0] = 1;
|
|
||||||
record[3] = src[0];
|
|
||||||
record[2] = src[1];
|
|
||||||
record[1] = src[2];
|
|
||||||
} else {
|
|
||||||
/* increment run length in current record */
|
|
||||||
record[0] ++;
|
|
||||||
}
|
|
||||||
src += depth;
|
|
||||||
}
|
|
||||||
/* Write last record in row */
|
|
||||||
writelen = fwrite( record, 1, 4, file );
|
|
||||||
}
|
|
||||||
gimp_progress_update ((double) i / (double) drawable->height);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Writing a 8-bit Matte (Mask) image */
|
|
||||||
guchar record[2];
|
|
||||||
|
|
||||||
for (i = 0; i < drawable->height;) {
|
|
||||||
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
|
||||||
tile_height : ( drawable->height - i - 1 );
|
|
||||||
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
|
||||||
drawable->width, rectHeight);
|
|
||||||
|
|
||||||
for ( src = src_base, row = 0;
|
|
||||||
row < tile_height && i < drawable->height;
|
|
||||||
i += 1, row += 1)
|
|
||||||
{
|
|
||||||
/* Write a row of the image */
|
|
||||||
record[0] = 1;
|
|
||||||
record[1] = src[0];
|
|
||||||
src += depth;
|
|
||||||
for ( j = 1; j < drawable->width; ++j ) {
|
|
||||||
if ( ( record[1] != src[0] ) ||
|
|
||||||
( record[0] == 255 ) )
|
|
||||||
{
|
|
||||||
/* Write current RLE record and start a new one */
|
|
||||||
writelen = fwrite( record, 1, 2, file );
|
|
||||||
record[0] = 1;
|
|
||||||
record[1] = src[0];
|
|
||||||
} else {
|
|
||||||
/* increment run length in current record */
|
|
||||||
record[0] ++;
|
|
||||||
}
|
|
||||||
src += depth;
|
|
||||||
}
|
|
||||||
/* Write last record in row */
|
/* Write last record in row */
|
||||||
writelen = fwrite( record, 1, 2, file );
|
writelen = fwrite( record, 1, 4, file );
|
||||||
}
|
}
|
||||||
gimp_progress_update ((double) i / (double) drawable->height);
|
gimp_progress_update ((double) i / (double) drawable->height);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Writing a 8-bit Matte (Mask) image */
|
||||||
|
guchar record[2];
|
||||||
|
|
||||||
free( src_base );
|
for (i = 0; i < drawable->height;)
|
||||||
|
{
|
||||||
|
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
||||||
|
tile_height : ( drawable->height - i - 1 );
|
||||||
|
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
||||||
|
drawable->width, rectHeight);
|
||||||
|
|
||||||
fclose( file );
|
for ( src = src_base, row = 0;
|
||||||
return (1);
|
row < tile_height && i < drawable->height;
|
||||||
|
i += 1, row += 1)
|
||||||
|
{
|
||||||
|
/* Write a row of the image */
|
||||||
|
record[0] = 1;
|
||||||
|
record[1] = src[0];
|
||||||
|
src += depth;
|
||||||
|
for ( j = 1; j < drawable->width; ++j )
|
||||||
|
{
|
||||||
|
if ( ( record[1] != src[0] ) || ( record[0] == 255 ) )
|
||||||
|
{
|
||||||
|
/* Write current RLE record and start a new one */
|
||||||
|
writelen = fwrite( record, 1, 2, file );
|
||||||
|
record[0] = 1;
|
||||||
|
record[1] = src[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* increment run length in current record */
|
||||||
|
record[0] ++;
|
||||||
|
}
|
||||||
|
src += depth;
|
||||||
|
}
|
||||||
|
/* Write last record in row */
|
||||||
|
writelen = fwrite( record, 1, 2, file );
|
||||||
|
}
|
||||||
|
gimp_progress_update ((double) i / (double) drawable->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free( src_base );
|
||||||
|
|
||||||
|
fclose( file );
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_gtk (void)
|
||||||
|
{
|
||||||
|
gchar **argv;
|
||||||
|
gint argc;
|
||||||
|
|
||||||
|
argc = 1;
|
||||||
|
argv = g_new (gchar *, 1);
|
||||||
|
argv[0] = g_strdup ("pix");
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
'papertile' => { libdep => 'gtk' },
|
'papertile' => { libdep => 'gtk' },
|
||||||
'pat' => { libdep => 'gtk', ui => 1 },
|
'pat' => { libdep => 'gtk', ui => 1 },
|
||||||
'pcx' => { libdep => 'gtk', ui => 1 },
|
'pcx' => { libdep => 'gtk', ui => 1 },
|
||||||
'pix' => { libdep => 'glib' },
|
'pix' => { libdep => 'gtk', ui => 1 },
|
||||||
'pixelize' => { libdep => 'gtk' },
|
'pixelize' => { libdep => 'gtk' },
|
||||||
'plasma' => { libdep => 'gtk' },
|
'plasma' => { libdep => 'gtk' },
|
||||||
'plugindetails' => { libdep => 'gtk' },
|
'plugindetails' => { libdep => 'gtk' },
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
'polar' => { libdep => 'gtk' },
|
'polar' => { libdep => 'gtk' },
|
||||||
'ps' => { libdep => 'gtk', ui => 1 },
|
'ps' => { libdep => 'gtk', ui => 1 },
|
||||||
'psd' => { libdep => 'glib' },
|
'psd' => { libdep => 'glib' },
|
||||||
'psp' => { libdep => 'gtk', optional => 1, libopt => 'z' },
|
'psp' => { libdep => 'gtk', ui => 1, optional => 1, libopt => 'z' },
|
||||||
'randomize' => { libdep => 'gtk', libsupp => 'gpc' },
|
'randomize' => { libdep => 'gtk', libsupp => 'gpc' },
|
||||||
'ripple' => { libdep => 'gtk' },
|
'ripple' => { libdep => 'gtk' },
|
||||||
'rotate' => { libdep => 'gtk' },
|
'rotate' => { libdep => 'gtk' },
|
||||||
|
|
|
@ -299,12 +299,12 @@ run (char *name, /* I - Name of filter program. */
|
||||||
else
|
else
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
|
||||||
if (export == EXPORT_EXPORT)
|
|
||||||
gimp_image_delete (image_ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
#include <libgimp/parasiteio.h>
|
#include <libgimp/parasiteio.h>
|
||||||
#include <libgimp/stdplugins-intl.h>
|
#include <libgimp/stdplugins-intl.h>
|
||||||
|
|
||||||
|
@ -431,6 +432,20 @@ save_ok_callback (GtkWidget *widget,
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_gtk ()
|
||||||
|
{
|
||||||
|
gchar **argv;
|
||||||
|
gint argc;
|
||||||
|
|
||||||
|
argc = 1;
|
||||||
|
argv = g_new (gchar *, 1);
|
||||||
|
argv[0] = g_strdup ("psp");
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
save_dialog ()
|
save_dialog ()
|
||||||
{
|
{
|
||||||
|
@ -440,19 +455,10 @@ save_dialog ()
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *toggle_vbox;
|
GtkWidget *toggle_vbox;
|
||||||
GSList *group;
|
GSList *group;
|
||||||
gchar **argv;
|
|
||||||
gint argc;
|
|
||||||
gint use_none = (psvals.compression == PSP_COMP_NONE);
|
gint use_none = (psvals.compression == PSP_COMP_NONE);
|
||||||
gint use_rle = (psvals.compression == PSP_COMP_RLE);
|
gint use_rle = (psvals.compression == PSP_COMP_RLE);
|
||||||
gint use_lz77 = (psvals.compression == PSP_COMP_LZ77);
|
gint use_lz77 = (psvals.compression == PSP_COMP_LZ77);
|
||||||
|
|
||||||
argc = 1;
|
|
||||||
argv = g_new (gchar *, 1);
|
|
||||||
argv[0] = g_strdup ("save");
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
|
||||||
|
|
||||||
dlg = gtk_dialog_new ();
|
dlg = gtk_dialog_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (dlg), "Save as PSP");
|
gtk_window_set_title (GTK_WINDOW (dlg), "Save as PSP");
|
||||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||||
|
@ -1749,7 +1755,9 @@ run (char *name,
|
||||||
static GParam values[2];
|
static GParam values[2];
|
||||||
GRunModeType run_mode;
|
GRunModeType run_mode;
|
||||||
GStatusType status = STATUS_SUCCESS;
|
GStatusType status = STATUS_SUCCESS;
|
||||||
|
GimpExportReturnType export = EXPORT_CANCEL;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
|
|
||||||
tile_height = gimp_tile_height ();
|
tile_height = gimp_tile_height ();
|
||||||
|
|
||||||
|
@ -1778,10 +1786,33 @@ run (char *name,
|
||||||
}
|
}
|
||||||
else if (strcmp (name, "file_psp_save") == 0)
|
else if (strcmp (name, "file_psp_save") == 0)
|
||||||
{
|
{
|
||||||
|
image_ID = orig_image_ID = param[1].data.d_int32;
|
||||||
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
|
/* eventually export the image */
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
INIT_I18N_UI();
|
case RUN_WITH_LAST_VALS:
|
||||||
|
INIT_I18N_UI();
|
||||||
|
init_gtk ();
|
||||||
|
export = gimp_export_image (&image_ID, &drawable_ID, "PSP",
|
||||||
|
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED | CAN_HANDLE_ALPHA | CAN_HANDLE_LAYERS));
|
||||||
|
if (export == EXPORT_CANCEL)
|
||||||
|
{
|
||||||
|
*nreturn_vals = 1;
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (run_mode)
|
||||||
|
{
|
||||||
|
case RUN_INTERACTIVE:
|
||||||
|
|
||||||
/* Possibly retrieve data */
|
/* Possibly retrieve data */
|
||||||
gimp_get_data ("file_pnm_save", &psvals);
|
gimp_get_data ("file_pnm_save", &psvals);
|
||||||
|
|
||||||
|
@ -1811,7 +1842,7 @@ run (char *name,
|
||||||
|
|
||||||
if (status == STATUS_SUCCESS)
|
if (status == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
if (save_image (param[3].data.d_string, param[1].data.d_int32, param[2].data.d_int32))
|
if (save_image (param[3].data.d_string, image_ID, drawable_ID))
|
||||||
{
|
{
|
||||||
gimp_set_data ("file_psp_save", &psvals, sizeof (PSPSaveVals));
|
gimp_set_data ("file_psp_save", &psvals, sizeof (PSPSaveVals));
|
||||||
|
|
||||||
|
@ -1822,5 +1853,8 @@ run (char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
|
|
||||||
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ INCLUDES = \
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ static char ident[] = "@(#) GIMP FITS file-plugin v1.05 20-Dec-97";
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
#include "libgimp/gimpui.h"
|
||||||
#include "fitsrw.h"
|
#include "fitsrw.h"
|
||||||
|
|
||||||
/* Load info */
|
/* Load info */
|
||||||
|
@ -108,6 +109,7 @@ typedef struct
|
||||||
int toggle_val[2*LOAD_FITS_TOGGLES];
|
int toggle_val[2*LOAD_FITS_TOGGLES];
|
||||||
} LoadDialogVals;
|
} LoadDialogVals;
|
||||||
|
|
||||||
|
static void init_gtk (void);
|
||||||
|
|
||||||
static gint load_dialog (void);
|
static gint load_dialog (void);
|
||||||
static void load_close_callback (GtkWidget *widget,
|
static void load_close_callback (GtkWidget *widget,
|
||||||
|
@ -150,13 +152,13 @@ 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", "The name of the file to load" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
||||||
};
|
};
|
||||||
static GParamDef load_return_vals[] =
|
static GParamDef load_return_vals[] =
|
||||||
{
|
{
|
||||||
{ PARAM_IMAGE, "image", "Output image" },
|
{ PARAM_IMAGE, "image", "Output image" },
|
||||||
};
|
};
|
||||||
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
|
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
|
||||||
static int nload_return_vals = sizeof (load_return_vals)
|
static int nload_return_vals = sizeof (load_return_vals)
|
||||||
|
@ -164,12 +166,11 @@ query (void)
|
||||||
|
|
||||||
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", "The name of the file to save the image in" },
|
||||||
{ PARAM_STRING, "raw_filename",
|
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" },
|
||||||
"The name of the file to save the image in" },
|
|
||||||
};
|
};
|
||||||
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||||
|
|
||||||
|
@ -194,7 +195,7 @@ those with alpha channels.",
|
||||||
"Peter Kirchgessner (pkirchg@aol.com)",
|
"Peter Kirchgessner (pkirchg@aol.com)",
|
||||||
"1997",
|
"1997",
|
||||||
"<Save>/FITS",
|
"<Save>/FITS",
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB, GRAY, INDEXED",
|
||||||
PROC_PLUG_IN,
|
PROC_PLUG_IN,
|
||||||
nsave_args, 0,
|
nsave_args, 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
@ -218,6 +219,8 @@ run (char *name,
|
||||||
GRunModeType run_mode;
|
GRunModeType run_mode;
|
||||||
GStatusType status = STATUS_SUCCESS;
|
GStatusType status = STATUS_SUCCESS;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
|
GimpExportReturnType export = EXPORT_CANCEL;
|
||||||
|
|
||||||
/* initialize */
|
/* initialize */
|
||||||
|
|
||||||
|
@ -236,6 +239,25 @@ run (char *name,
|
||||||
values[1].type = PARAM_IMAGE;
|
values[1].type = PARAM_IMAGE;
|
||||||
values[1].data.d_image = -1;
|
values[1].data.d_image = -1;
|
||||||
|
|
||||||
|
/* eventually export the image */
|
||||||
|
switch (run_mode)
|
||||||
|
{
|
||||||
|
case RUN_INTERACTIVE:
|
||||||
|
case RUN_WITH_LAST_VALS:
|
||||||
|
init_gtk ();
|
||||||
|
export = gimp_export_image (&image_ID, &drawable_ID, "FITS",
|
||||||
|
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
|
||||||
|
if (export == EXPORT_CANCEL)
|
||||||
|
{
|
||||||
|
*nreturn_vals = 1;
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
|
@ -279,6 +301,10 @@ run (char *name,
|
||||||
}
|
}
|
||||||
else if (strcmp (name, "file_fits_save") == 0)
|
else if (strcmp (name, "file_fits_save") == 0)
|
||||||
{
|
{
|
||||||
|
image_ID = param[1].data.d_int32;
|
||||||
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
*nreturn_vals = 1;
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
|
@ -297,12 +323,13 @@ run (char *name,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
if (save_image (param[3].data.d_string, image_ID, drawable_ID))
|
||||||
if (save_image (param[3].data.d_string, param[1].data.d_int32,
|
|
||||||
param[2].data.d_int32))
|
|
||||||
values[0].data.d_status = STATUS_SUCCESS;
|
values[0].data.d_status = STATUS_SUCCESS;
|
||||||
else
|
else
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
|
||||||
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,6 +968,21 @@ save_index (FITS_FILE *ofp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_gtk ()
|
||||||
|
{
|
||||||
|
gchar **argv;
|
||||||
|
gint argc;
|
||||||
|
|
||||||
|
argc = 1;
|
||||||
|
argv = g_new (gchar *, 1);
|
||||||
|
argv[0] = g_strdup ("fits");
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Load interface functions */
|
/* Load interface functions */
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
@ -953,8 +995,7 @@ load_dialog (void)
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *toggle_vbox;
|
GtkWidget *toggle_vbox;
|
||||||
GSList *group;
|
GSList *group;
|
||||||
gchar **argv;
|
gint k, j;
|
||||||
gint argc, k, j;
|
|
||||||
char **textptr;
|
char **textptr;
|
||||||
static char *toggle_text[] = {
|
static char *toggle_text[] = {
|
||||||
"BLANK/NaN pixel replacement", "Black", "White",
|
"BLANK/NaN pixel replacement", "Black", "White",
|
||||||
|
@ -962,13 +1003,8 @@ load_dialog (void)
|
||||||
"Image composing", "None", "NAXIS=3, NAXIS3=2,...,4"
|
"Image composing", "None", "NAXIS=3, NAXIS3=2,...,4"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
init_gtk ();
|
||||||
|
|
||||||
argc = 1;
|
|
||||||
argv = g_new (gchar *, 1);
|
|
||||||
argv[0] = g_strdup ("Load");
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
|
||||||
vals = g_malloc (sizeof (*vals));
|
vals = g_malloc (sizeof (*vals));
|
||||||
|
|
||||||
vals->toggle_val[0] = (plvals.replace == 0);
|
vals->toggle_val[0] = (plvals.replace == 0);
|
||||||
|
@ -1105,12 +1141,8 @@ static void show_fits_errors (void)
|
||||||
static void show_message (char *message)
|
static void show_message (char *message)
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef Simple_Message_Box_Available
|
|
||||||
/* If there would be a simple message box like the one */
|
|
||||||
/* used in ../app/interface.h, I would like to use it. */
|
|
||||||
if (l_run_mode == RUN_INTERACTIVE)
|
if (l_run_mode == RUN_INTERACTIVE)
|
||||||
gtk_message_box (message);
|
gimp_message (message);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fprintf (stderr, "Fits: %s\n", message);
|
fprintf (stderr, "Fits: %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ INCLUDES = \
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
* Revision History:
|
* Revision History:
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.13 1999/10/20 01:45:41 neo
|
||||||
|
* the rest of the save plug-ins !?
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* --Sven
|
||||||
|
*
|
||||||
* Revision 1.12 1999/04/23 06:32:41 asbjoer
|
* Revision 1.12 1999/04/23 06:32:41 asbjoer
|
||||||
* use MAIN macro
|
* use MAIN macro
|
||||||
*
|
*
|
||||||
|
@ -177,6 +183,7 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -190,14 +197,16 @@
|
||||||
* Local functions...
|
* Local functions...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void query(void);
|
static void query (void);
|
||||||
static void run(char *, int, GParam *, int *, GParam **);
|
static void run (char *, int, GParam *, int *, GParam **);
|
||||||
static gint32 load_image(char *);
|
static gint32 load_image (char *);
|
||||||
static gint save_image (char *, gint32, gint32);
|
static gint save_image (char *, gint32, gint32);
|
||||||
static gint save_dialog(void);
|
|
||||||
static void save_close_callback(GtkWidget *, gpointer);
|
static void init_gtk (void);
|
||||||
static void save_ok_callback(GtkWidget *, gpointer);
|
static gint save_dialog (void);
|
||||||
static void save_compression_callback(GtkWidget *, gpointer);
|
static void save_close_callback (GtkWidget *, gpointer);
|
||||||
|
static void save_ok_callback (GtkWidget *, gpointer);
|
||||||
|
static void save_compression_callback (GtkWidget *, gpointer);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -231,13 +240,13 @@ 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", "The name of the file to load" },
|
||||||
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
|
||||||
};
|
};
|
||||||
static GParamDef load_return_vals[] =
|
static GParamDef load_return_vals[] =
|
||||||
{
|
{
|
||||||
{ PARAM_IMAGE, "image", "Output image" },
|
{ PARAM_IMAGE, "image", "Output image" },
|
||||||
};
|
};
|
||||||
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
|
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
|
||||||
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]);
|
||||||
|
@ -280,14 +289,17 @@ query(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run(char *name, /* I - Name of filter program. */
|
run (char *name, /* I - Name of filter program. */
|
||||||
int nparams, /* I - Number of parameters passed in */
|
int nparams, /* I - Number of parameters passed in */
|
||||||
GParam *param, /* I - Parameter values */
|
GParam *param, /* I - Parameter values */
|
||||||
int *nreturn_vals, /* O - Number of return values */
|
int *nreturn_vals, /* O - Number of return values */
|
||||||
GParam **return_vals) /* O - Return values */
|
GParam **return_vals) /* O - Return values */
|
||||||
{
|
{
|
||||||
gint32 image_ID; /* ID of loaded image */
|
GParam *values; /* Return values */
|
||||||
GParam *values; /* Return values */
|
GRunModeType run_mode;
|
||||||
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
|
GimpExportReturnType export = EXPORT_CANCEL;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -322,8 +334,29 @@ run(char *name, /* I - Name of filter program. */
|
||||||
else if (strcmp (name, "file_sgi_save") == 0)
|
else if (strcmp (name, "file_sgi_save") == 0)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
|
run_mode = param[0].data.d_int32;
|
||||||
|
image_ID = param[1].data.d_int32;
|
||||||
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
switch (param[0].data.d_int32)
|
/* eventually export the image */
|
||||||
|
switch (run_mode)
|
||||||
|
{
|
||||||
|
case RUN_INTERACTIVE:
|
||||||
|
case RUN_WITH_LAST_VALS:
|
||||||
|
init_gtk ();
|
||||||
|
export = gimp_export_image (&image_ID, &drawable_ID, "SGI",
|
||||||
|
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_ALPHA));
|
||||||
|
if (export == EXPORT_CANCEL)
|
||||||
|
{
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case RUN_INTERACTIVE :
|
case RUN_INTERACTIVE :
|
||||||
/*
|
/*
|
||||||
|
@ -361,7 +394,7 @@ run(char *name, /* I - Name of filter program. */
|
||||||
* Possibly retrieve data...
|
* Possibly retrieve data...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gimp_get_data("file_sgi_save", &compression);
|
gimp_get_data ("file_sgi_save", &compression);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
@ -370,12 +403,14 @@ run(char *name, /* I - Name of filter program. */
|
||||||
|
|
||||||
if (values[0].data.d_status == STATUS_SUCCESS)
|
if (values[0].data.d_status == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
if (save_image(param[3].data.d_string, param[1].data.d_int32,
|
if (save_image(param[3].data.d_string, image_ID, drawable_ID))
|
||||||
param[2].data.d_int32))
|
|
||||||
gimp_set_data("file_sgi_save", &compression, sizeof(compression));
|
gimp_set_data("file_sgi_save", &compression, sizeof(compression));
|
||||||
else
|
else
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
@ -387,7 +422,7 @@ run(char *name, /* I - Name of filter program. */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gint32
|
static gint32
|
||||||
load_image(char *filename) /* I - File to load */
|
load_image (char *filename) /* I - File to load */
|
||||||
{
|
{
|
||||||
int i, /* Looping var */
|
int i, /* Looping var */
|
||||||
x, /* Current X coordinate */
|
x, /* Current X coordinate */
|
||||||
|
@ -573,26 +608,26 @@ load_image(char *filename) /* I - File to load */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
save_image(char *filename, /* I - File to save to */
|
save_image (char *filename, /* I - File to save to */
|
||||||
gint32 image_ID, /* I - Image to save */
|
gint32 image_ID, /* I - Image to save */
|
||||||
gint32 drawable_ID) /* I - Current drawable */
|
gint32 drawable_ID) /* I - Current drawable */
|
||||||
{
|
{
|
||||||
int i, j, /* Looping var */
|
int i, j, /* Looping var */
|
||||||
x, /* Current X coordinate */
|
x, /* Current X coordinate */
|
||||||
y, /* Current Y coordinate */
|
y, /* Current Y coordinate */
|
||||||
image_type, /* Type of image */
|
image_type, /* Type of image */
|
||||||
layer_type, /* Type of drawable/layer */
|
layer_type, /* Type of drawable/layer */
|
||||||
tile_height, /* Height of tile in GIMP */
|
tile_height, /* Height of tile in GIMP */
|
||||||
count, /* Count of rows to put in image */
|
count, /* Count of rows to put in image */
|
||||||
zsize; /* Number of channels in file */
|
zsize; /* Number of channels in file */
|
||||||
sgi_t *sgip; /* File pointer */
|
sgi_t *sgip; /* File pointer */
|
||||||
GDrawable *drawable; /* Drawable for layer */
|
GDrawable *drawable; /* Drawable for layer */
|
||||||
GPixelRgn pixel_rgn; /* Pixel region for layer */
|
GPixelRgn pixel_rgn; /* Pixel region for layer */
|
||||||
guchar **pixels, /* Pixel rows */
|
guchar **pixels, /* Pixel rows */
|
||||||
*pixel, /* Pixel data */
|
*pixel, /* Pixel data */
|
||||||
*pptr; /* Current pixel */
|
*pptr; /* Current pixel */
|
||||||
unsigned short **rows; /* SGI image data */
|
unsigned short **rows; /* SGI image data */
|
||||||
char progress[255]; /* Title for progress display... */
|
char progress[255]; /* Title for progress display... */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -711,8 +746,8 @@ save_image(char *filename, /* I - File to save to */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_close_callback(GtkWidget *w, /* I - Close button */
|
save_close_callback (GtkWidget *w, /* I - Close button */
|
||||||
gpointer data) /* I - Callback data */
|
gpointer data) /* I - Callback data */
|
||||||
{
|
{
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
@ -723,8 +758,8 @@ save_close_callback(GtkWidget *w, /* I - Close button */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_ok_callback(GtkWidget *w, /* I - OK button */
|
save_ok_callback (GtkWidget *w, /* I - OK button */
|
||||||
gpointer data) /* I - Callback data */
|
gpointer data) /* I - Callback data */
|
||||||
{
|
{
|
||||||
runme = TRUE;
|
runme = TRUE;
|
||||||
|
|
||||||
|
@ -737,14 +772,28 @@ save_ok_callback(GtkWidget *w, /* I - OK button */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_compression_callback(GtkWidget *w, /* I - Compression button */
|
save_compression_callback (GtkWidget *w, /* I - Compression button */
|
||||||
gpointer data) /* I - Callback data */
|
gpointer data) /* I - Callback data */
|
||||||
{
|
{
|
||||||
if (GTK_TOGGLE_BUTTON(w)->active)
|
if (GTK_TOGGLE_BUTTON(w)->active)
|
||||||
compression = (long)data;
|
compression = (long)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_gtk ()
|
||||||
|
{
|
||||||
|
gchar **argv;
|
||||||
|
gint argc;
|
||||||
|
|
||||||
|
argc = 1;
|
||||||
|
argv = g_new (gchar *, 1);
|
||||||
|
argv[0] = g_strdup ("sgi");
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 'save_dialog()' - Pop up the save dialog.
|
* 'save_dialog()' - Pop up the save dialog.
|
||||||
*/
|
*/
|
||||||
|
@ -758,8 +807,6 @@ save_dialog(void)
|
||||||
*frame, /* Frame for dialog */
|
*frame, /* Frame for dialog */
|
||||||
*vbox; /* Box for compression types */
|
*vbox; /* Box for compression types */
|
||||||
GSList *group; /* Button grouping for compression */
|
GSList *group; /* Button grouping for compression */
|
||||||
gchar **argv; /* Fake command-line args */
|
|
||||||
gint argc; /* Number of fake command-line args */
|
|
||||||
static char *types[] = /* Compression types... */
|
static char *types[] = /* Compression types... */
|
||||||
{
|
{
|
||||||
"No Compression",
|
"No Compression",
|
||||||
|
@ -768,17 +815,6 @@ save_dialog(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fake the command-line args and open a window...
|
|
||||||
*/
|
|
||||||
|
|
||||||
argc = 1;
|
|
||||||
argv = g_new (gchar *, 1);
|
|
||||||
argv[0] = g_strdup("sgi");
|
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
|
||||||
gtk_rc_parse(gimp_gtkrc());
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a dialog window...
|
* Open a dialog window...
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue