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,7 +65,7 @@ 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 );
|
||||||
|
|
||||||
|
@ -74,8 +76,8 @@ 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,25 +99,29 @@ 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_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 entered" },
|
{ PARAM_STRING, "raw_filename", "The name entered" },
|
||||||
};
|
};
|
||||||
static GParamDef load_return_vals[] = {
|
static int nload_args =
|
||||||
|
sizeof (load_args) / sizeof (load_args[0]);
|
||||||
|
|
||||||
|
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_return_vals =
|
||||||
static int nload_return_vals = sizeof (load_return_vals) /
|
sizeof (load_return_vals) / sizeof (load_return_vals[0]);
|
||||||
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", "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]);
|
||||||
|
|
||||||
|
@ -147,7 +153,11 @@ static void query ()
|
||||||
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
|
||||||
|
run (char *name,
|
||||||
|
int nparams,
|
||||||
|
GParam *param,
|
||||||
|
int *nreturn_vals,
|
||||||
GParam **return_vals )
|
GParam **return_vals )
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
|
@ -165,7 +175,8 @@ static void run ( char *name, int nparams, GParam *param, int *nreturn_vals,
|
||||||
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;
|
||||||
|
|
||||||
|
@ -175,36 +186,68 @@ static void run ( char *name, int nparams, GParam *param, int *nreturn_vals,
|
||||||
values[0].type = PARAM_STATUS;
|
values[0].type = PARAM_STATUS;
|
||||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||||
|
|
||||||
if (strcmp (name, "file_pix_load") == 0) {
|
if (strcmp (name, "file_pix_load") == 0)
|
||||||
|
{
|
||||||
/* Perform the image load */
|
/* Perform the image load */
|
||||||
image_ID = load_image (param[1].data.d_string);
|
image_ID = load_image (param[1].data.d_string);
|
||||||
if (image_ID != -1) {
|
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 {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* The image load falied */
|
/* The image load falied */
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
} else if (strcmp (name, "file_pix_save") == 0) {
|
}
|
||||||
if (status == STATUS_SUCCESS) {
|
else if (strcmp (name, "file_pix_save") == 0)
|
||||||
if ( !save_image ( param[3].data.d_string, param[1].data.d_int32,
|
{
|
||||||
param[2].data.d_int32))
|
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;
|
status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
|
|
||||||
} else {
|
if (export == EXPORT_EXPORT)
|
||||||
|
gimp_image_delete (image_ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g_assert (FALSE);
|
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
|
||||||
|
@ -217,7 +260,9 @@ static guint16 get_short( FILE * 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
|
||||||
|
@ -231,33 +276,9 @@ static void put_short( guint16 value, FILE * file )
|
||||||
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
|
||||||
|
@ -286,7 +307,8 @@ static gint32 load_image (char *filename)
|
||||||
|
|
||||||
/* Set up progress display */
|
/* Set up progress display */
|
||||||
progMessage = malloc (strlen (filename) + 12);
|
progMessage = malloc (strlen (filename) + 12);
|
||||||
if (!progMessage) gimp_quit ();
|
if (!progMessage)
|
||||||
|
gimp_quit ();
|
||||||
sprintf (progMessage, "Loading %s:", filename);
|
sprintf (progMessage, "Loading %s:", filename);
|
||||||
gimp_progress_init (progMessage);
|
gimp_progress_init (progMessage);
|
||||||
free (progMessage);
|
free (progMessage);
|
||||||
|
@ -295,7 +317,8 @@ static gint32 load_image (char *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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,15 +332,20 @@ static gint32 load_image (char *filename)
|
||||||
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 */
|
/* Loading a matte file */
|
||||||
imgtype = GRAY;
|
imgtype = GRAY;
|
||||||
gdtype = GRAY_IMAGE;
|
gdtype = GRAY_IMAGE;
|
||||||
} else if ( depth == 24 ) {
|
}
|
||||||
|
else if ( depth == 24 )
|
||||||
|
{
|
||||||
/* Loading an RGB file */
|
/* Loading an RGB file */
|
||||||
imgtype = RGB;
|
imgtype = RGB;
|
||||||
gdtype = RGB_IMAGE;
|
gdtype = RGB_IMAGE;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Header is invalid */
|
/* Header is invalid */
|
||||||
fclose( file );
|
fclose( file );
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -336,7 +364,8 @@ static gint32 load_image (char *filename)
|
||||||
|
|
||||||
tile_height = gimp_tile_height();
|
tile_height = gimp_tile_height();
|
||||||
|
|
||||||
if ( depth == 24 ) {
|
if ( depth == 24 )
|
||||||
|
{
|
||||||
/* Read a 24-bit Pix image */
|
/* Read a 24-bit Pix image */
|
||||||
guchar record[4];
|
guchar record[4];
|
||||||
gint readlen;
|
gint readlen;
|
||||||
|
@ -344,7 +373,8 @@ static gint32 load_image (char *filename)
|
||||||
|
|
||||||
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;
|
for ( dest = dest_base, row = 0;
|
||||||
row < tile_height && i < height;
|
row < tile_height && i < height;
|
||||||
i += 1, row += 1)
|
i += 1, row += 1)
|
||||||
|
@ -353,17 +383,21 @@ static gint32 load_image (char *filename)
|
||||||
|
|
||||||
/* 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 );
|
readlen = fread( record, 1, 4, file );
|
||||||
if ( readlen < 4 ) break;
|
if ( readlen < 4 )
|
||||||
|
break;
|
||||||
|
|
||||||
for ( count = 0; count < record[0]; ++count ) {
|
for ( count = 0; count < record[0]; ++count )
|
||||||
|
{
|
||||||
dest[0] = record[3];
|
dest[0] = record[3];
|
||||||
dest[1] = record[2];
|
dest[1] = record[2];
|
||||||
dest[2] = record[1];
|
dest[2] = record[1];
|
||||||
dest += 3;
|
dest += 3;
|
||||||
j++;
|
j++;
|
||||||
if ( j >= width ) break;
|
if ( j >= width )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,14 +407,17 @@ static gint32 load_image (char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
free( dest_base );
|
free( dest_base );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Read an 8-bit Matte image */
|
/* Read an 8-bit Matte image */
|
||||||
guchar record[2];
|
guchar record[2];
|
||||||
gint readlen;
|
gint readlen;
|
||||||
|
|
||||||
dest_base = dest = g_new (guchar, width * tile_height);
|
dest_base = dest = g_new (guchar, width * tile_height);
|
||||||
|
|
||||||
for (i = 0; i < height;) {
|
for (i = 0; i < height;)
|
||||||
|
{
|
||||||
for ( dest = dest_base, row = 0;
|
for ( dest = dest_base, row = 0;
|
||||||
row < tile_height && i < height;
|
row < tile_height && i < height;
|
||||||
i += 1, row += 1)
|
i += 1, row += 1)
|
||||||
|
@ -389,11 +426,13 @@ static gint32 load_image (char *filename)
|
||||||
|
|
||||||
/* 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, 2, file );
|
readlen = fread( record, 1, 2, file );
|
||||||
if ( readlen < 2 ) break;
|
if ( readlen < 2 ) break;
|
||||||
|
|
||||||
for ( count = 0; count < record[0]; ++count ) {
|
for ( count = 0; count < record[0]; ++count )
|
||||||
|
{
|
||||||
dest[j] = record[1];
|
dest[j] = record[1];
|
||||||
j++;
|
j++;
|
||||||
if ( j >= width ) break;
|
if ( j >= width ) break;
|
||||||
|
@ -417,7 +456,10 @@ 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 )
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
@ -469,13 +511,15 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
|
|
||||||
/* Open the output file. */
|
/* Open the output file. */
|
||||||
file = fopen (filename, "wb");
|
file = fopen (filename, "wb");
|
||||||
if ( !file ) {
|
if ( !file )
|
||||||
|
{
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up progress display */
|
/* Set up progress display */
|
||||||
progMessage = malloc (strlen (filename) + 12);
|
progMessage = malloc (strlen (filename) + 12);
|
||||||
if (!progMessage) gimp_quit ();
|
if (!progMessage)
|
||||||
|
gimp_quit ();
|
||||||
sprintf (progMessage, "Saving %s:", filename);
|
sprintf (progMessage, "Saving %s:", filename);
|
||||||
gimp_progress_init (progMessage);
|
gimp_progress_init (progMessage);
|
||||||
free (progMessage);
|
free (progMessage);
|
||||||
|
@ -487,20 +531,25 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
put_short( drawable->height, file );
|
put_short( drawable->height, file );
|
||||||
put_short( 0, file );
|
put_short( 0, file );
|
||||||
put_short( 0, file );
|
put_short( 0, file );
|
||||||
if ( savingColor ) {
|
if ( savingColor )
|
||||||
|
{
|
||||||
put_short( 24, file );
|
put_short( 24, file );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
put_short( 8, file );
|
put_short( 8, file );
|
||||||
}
|
}
|
||||||
|
|
||||||
tile_height = gimp_tile_height();
|
tile_height = gimp_tile_height();
|
||||||
src_base = g_new( guchar, tile_height * drawable->width * depth );
|
src_base = g_new( guchar, tile_height * drawable->width * depth );
|
||||||
|
|
||||||
if ( savingColor ) {
|
if ( savingColor )
|
||||||
|
{
|
||||||
/* Writing a 24-bit Pix image */
|
/* Writing a 24-bit Pix image */
|
||||||
guchar record[4];
|
guchar record[4];
|
||||||
|
|
||||||
for (i = 0; i < drawable->height;) {
|
for (i = 0; i < drawable->height;)
|
||||||
|
{
|
||||||
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
||||||
tile_height : ( drawable->height - i - 1 );
|
tile_height : ( drawable->height - i - 1 );
|
||||||
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
||||||
|
@ -516,7 +565,8 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
record[2] = src[1];
|
record[2] = src[1];
|
||||||
record[1] = src[2];
|
record[1] = src[2];
|
||||||
src += depth;
|
src += depth;
|
||||||
for ( j = 1; j < drawable->width; ++j ) {
|
for ( j = 1; j < drawable->width; ++j )
|
||||||
|
{
|
||||||
if ( ( record[3] != src[0] ) ||
|
if ( ( record[3] != src[0] ) ||
|
||||||
( record[2] != src[1] ) ||
|
( record[2] != src[1] ) ||
|
||||||
( record[1] != src[2] ) ||
|
( record[1] != src[2] ) ||
|
||||||
|
@ -529,7 +579,9 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
record[3] = src[0];
|
record[3] = src[0];
|
||||||
record[2] = src[1];
|
record[2] = src[1];
|
||||||
record[1] = src[2];
|
record[1] = src[2];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* increment run length in current record */
|
/* increment run length in current record */
|
||||||
record[0] ++;
|
record[0] ++;
|
||||||
}
|
}
|
||||||
|
@ -540,11 +592,14 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
}
|
}
|
||||||
gimp_progress_update ((double) i / (double) drawable->height);
|
gimp_progress_update ((double) i / (double) drawable->height);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Writing a 8-bit Matte (Mask) image */
|
/* Writing a 8-bit Matte (Mask) image */
|
||||||
guchar record[2];
|
guchar record[2];
|
||||||
|
|
||||||
for (i = 0; i < drawable->height;) {
|
for (i = 0; i < drawable->height;)
|
||||||
|
{
|
||||||
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
rectHeight = ( tile_height < ( drawable->height - i - 1 ) ) ?
|
||||||
tile_height : ( drawable->height - i - 1 );
|
tile_height : ( drawable->height - i - 1 );
|
||||||
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
gimp_pixel_rgn_get_rect (&pixel_rgn, src_base, 0, i,
|
||||||
|
@ -558,15 +613,17 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
record[0] = 1;
|
record[0] = 1;
|
||||||
record[1] = src[0];
|
record[1] = src[0];
|
||||||
src += depth;
|
src += depth;
|
||||||
for ( j = 1; j < drawable->width; ++j ) {
|
for ( j = 1; j < drawable->width; ++j )
|
||||||
if ( ( record[1] != src[0] ) ||
|
{
|
||||||
( record[0] == 255 ) )
|
if ( ( record[1] != src[0] ) || ( record[0] == 255 ) )
|
||||||
{
|
{
|
||||||
/* Write current RLE record and start a new one */
|
/* Write current RLE record and start a new one */
|
||||||
writelen = fwrite( record, 1, 2, file );
|
writelen = fwrite( record, 1, 2, file );
|
||||||
record[0] = 1;
|
record[0] = 1;
|
||||||
record[1] = src[0];
|
record[1] = src[0];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* increment run length in current record */
|
/* increment run length in current record */
|
||||||
record[0] ++;
|
record[0] ++;
|
||||||
}
|
}
|
||||||
|
@ -584,3 +641,18 @@ static gint save_image( char *filename, gint32 image_ID, gint32 drawable_ID )
|
||||||
fclose( file );
|
fclose( file );
|
||||||
return (1);
|
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,13 +299,13 @@ 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;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
else
|
|
||||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
|
||||||
|
|
||||||
if (export == EXPORT_EXPORT)
|
if (export == EXPORT_EXPORT)
|
||||||
gimp_image_delete (image_ID);
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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:
|
||||||
|
case RUN_WITH_LAST_VALS:
|
||||||
INIT_I18N_UI();
|
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,
|
||||||
|
@ -168,8 +170,7 @@ query (void)
|
||||||
{ 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>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -194,6 +201,8 @@ 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 void init_gtk (void);
|
||||||
static gint save_dialog (void);
|
static gint save_dialog (void);
|
||||||
static void save_close_callback (GtkWidget *, gpointer);
|
static void save_close_callback (GtkWidget *, gpointer);
|
||||||
static void save_ok_callback (GtkWidget *, gpointer);
|
static void save_ok_callback (GtkWidget *, gpointer);
|
||||||
|
@ -286,8 +295,11 @@ run(char *name, /* I - Name of filter program. */
|
||||||
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 :
|
||||||
/*
|
/*
|
||||||
|
@ -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;
|
||||||
|
@ -745,6 +780,20 @@ save_compression_callback(GtkWidget *w, /* I - Compression button */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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