mirror of https://github.com/GNOME/gimp.git
plug-ins/FractalExplorer plug-ins/Lighting plug-ins/bmp plug-ins/dbbrowser
2005-03-04 Sven Neumann <sven@gimp.org> * plug-ins/FractalExplorer * plug-ins/Lighting * plug-ins/bmp * plug-ins/dbbrowser * plug-ins/faxg3 * plug-ins/fits * plug-ins/flame * plug-ins/gfig * plug-ins/gflare * plug-ins/gfli * plug-ins/gimpressionist * plug-ins/ifscompose * plug-ins/jpeg * plug-ins/maze * plug-ins/pagecurl * plug-ins/print * plug-ins/rcm * plug-ins/script-fu * plug-ins/sel2path * plug-ins/sgi * plug-ins/twain * plug-ins/winicon * plug-ins/xjt: ported to gstdio, removed unnecessary includes, minor fixes to filename handling here and there.
This commit is contained in:
parent
a303b44c62
commit
f48efa965c
|
@ -1,10 +1,30 @@
|
||||||
|
/**********************************************************************
|
||||||
|
The GIMP -- an image manipulation program
|
||||||
|
Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -1790,12 +1810,10 @@ save_options (FILE * fp)
|
||||||
static void
|
static void
|
||||||
save_callback (void)
|
save_callback (void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gchar *savename;
|
const gchar *savename = filename;
|
||||||
|
|
||||||
savename = filename;
|
fp = g_fopen (savename, "wt+");
|
||||||
|
|
||||||
fp = fopen (savename, "wt+");
|
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
@ -2093,7 +2111,8 @@ explorer_load (void)
|
||||||
gchar load_buf[MAX_LOAD_LINE];
|
gchar load_buf[MAX_LOAD_LINE];
|
||||||
|
|
||||||
g_assert (filename != NULL);
|
g_assert (filename != NULL);
|
||||||
fp = fopen (filename, "rt");
|
|
||||||
|
fp = g_fopen (filename, "rt");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,13 +51,16 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#warning GTK_DISABLE_DEPRECATED
|
#warning GTK_DISABLE_DEPRECATED
|
||||||
#endif
|
#endif
|
||||||
|
@ -1132,9 +1135,8 @@ fractalexplorer_free_everything (fractalexplorerOBJ *fractalexplorer)
|
||||||
g_assert (fractalexplorer != NULL);
|
g_assert (fractalexplorer != NULL);
|
||||||
|
|
||||||
if (fractalexplorer->filename)
|
if (fractalexplorer->filename)
|
||||||
{
|
g_remove (fractalexplorer->filename);
|
||||||
remove (fractalexplorer->filename);
|
|
||||||
}
|
|
||||||
fractalexplorer_free (fractalexplorer);
|
fractalexplorer_free (fractalexplorer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,10 +1157,12 @@ fractalexplorer_load (const gchar *filename,
|
||||||
gchar load_buf[MAX_LOAD_LINE];
|
gchar load_buf[MAX_LOAD_LINE];
|
||||||
|
|
||||||
g_assert (filename != NULL);
|
g_assert (filename != NULL);
|
||||||
fp = fopen (filename, "rt");
|
|
||||||
|
fp = g_fopen (filename, "rt");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_warning ("Error opening: %s", filename);
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,7 +1216,7 @@ fractalexplorer_list_load_one (const GimpDatafileData *file_data,
|
||||||
|
|
||||||
if (fractalexplorer)
|
if (fractalexplorer)
|
||||||
{
|
{
|
||||||
/* Read only ?*/
|
/* Read only ?*/ /* FIXME: filename handling for Win32 */
|
||||||
if (access (filename, W_OK))
|
if (access (filename, W_OK))
|
||||||
fractalexplorer->obj_status |= fractalexplorer_READONLY;
|
fractalexplorer->obj_status |= fractalexplorer_READONLY;
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -72,14 +73,14 @@ static void envmap_combo_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void save_lighting_preset (GtkWidget *widget,
|
static void save_lighting_preset (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void file_chooser_response (GtkFileChooser *chooser,
|
static void save_preset_response (GtkFileChooser *chooser,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void load_lighting_preset (GtkWidget *widget,
|
static void load_lighting_preset (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void load_file_chooser_response (GtkFileChooser *chooser,
|
static void load_preset_response (GtkFileChooser *chooser,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void lightselect_callback (GimpIntComboBox *combo,
|
static void lightselect_callback (GimpIntComboBox *combo,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void apply_settings (GtkWidget *widget,
|
static void apply_settings (GtkWidget *widget,
|
||||||
|
@ -1088,7 +1089,7 @@ save_lighting_preset (GtkWidget *widget,
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&window);
|
&window);
|
||||||
g_signal_connect (window, "response",
|
g_signal_connect (window, "response",
|
||||||
G_CALLBACK (file_chooser_response),
|
G_CALLBACK (save_preset_response),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,9 +1120,9 @@ save_lighting_preset (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_chooser_response (GtkFileChooser *chooser,
|
save_preset_response (GtkFileChooser *chooser,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gint num_lights = 0;
|
gint num_lights = 0;
|
||||||
|
@ -1136,7 +1137,7 @@ file_chooser_response (GtkFileChooser *chooser,
|
||||||
{
|
{
|
||||||
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
fp = g_fopen (filename, "w");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
@ -1194,6 +1195,8 @@ file_chooser_response (GtkFileChooser *chooser,
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (chooser));
|
gtk_widget_destroy (GTK_WIDGET (chooser));
|
||||||
|
@ -1223,7 +1226,7 @@ load_lighting_preset (GtkWidget *widget,
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&window);
|
&window);
|
||||||
g_signal_connect (window, "response",
|
g_signal_connect (window, "response",
|
||||||
G_CALLBACK (load_file_chooser_response),
|
G_CALLBACK (load_preset_response),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,9 +1258,9 @@ load_lighting_preset (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_file_chooser_response (GtkFileChooser *chooser,
|
load_preset_response (GtkFileChooser *chooser,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gint num_lights;
|
gint num_lights;
|
||||||
|
@ -1269,12 +1272,11 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
||||||
gchar type_label[20];
|
gchar type_label[20];
|
||||||
gchar *endptr;
|
gchar *endptr;
|
||||||
|
|
||||||
|
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||||
|
|
||||||
fp = fopen (filename, "r");
|
fp = g_fopen (filename, "r");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
@ -1332,6 +1334,8 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
|
||||||
lightselect_callback (GIMP_INT_COMBO_BOX (lightselect_combo), NULL);
|
lightselect_callback (GIMP_INT_COMBO_BOX (lightselect_combo), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -63,6 +62,7 @@
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
const gchar *filename = NULL;
|
const gchar *filename = NULL;
|
||||||
gboolean interactive_bmp;
|
gboolean interactive_bmp;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
@ -126,7 +126,8 @@ ReadChannelMasks (FILE *fd, Bitmap_Channel *masks, guint channels)
|
||||||
masks[i].shiftin = offset;
|
masks[i].shiftin = offset;
|
||||||
masks[i].shiftout = 8 - nbits;
|
masks[i].shiftout = 8 - nbits;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
g_print ("Channel %d mask %08x in %d out %d\n", i, masks[i].mask, masks[i].shiftin, masks[i].shiftout);
|
g_print ("Channel %d mask %08x in %d out %d\n",
|
||||||
|
i, masks[i].mask, masks[i].shiftin, masks[i].shiftout);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -145,7 +146,7 @@ ReadBMP (const gchar *name)
|
||||||
Bitmap_Channel *masks;
|
Bitmap_Channel *masks;
|
||||||
|
|
||||||
filename = name;
|
filename = name;
|
||||||
fd = fopen (filename, "rb");
|
fd = g_fopen (filename, "rb");
|
||||||
|
|
||||||
if (!fd)
|
if (!fd)
|
||||||
{
|
{
|
||||||
|
@ -160,17 +161,17 @@ ReadBMP (const gchar *name)
|
||||||
|
|
||||||
/* It is a File. Now is it a Bitmap? Read the shortest possible header */
|
/* It is a File. Now is it a Bitmap? Read the shortest possible header */
|
||||||
|
|
||||||
if (!ReadOK (fd, magick, 2) || !(!strncmp (magick,"BA",2) ||
|
if (!ReadOK (fd, magick, 2) || !(!strncmp (magick, "BA", 2) ||
|
||||||
!strncmp (magick,"BM",2) || !strncmp (magick,"IC",2) ||
|
!strncmp (magick, "BM", 2) || !strncmp (magick, "IC", 2) ||
|
||||||
!strncmp (magick,"PI",2) || !strncmp (magick,"CI",2) ||
|
!strncmp (magick, "PI", 2) || !strncmp (magick, "CI", 2) ||
|
||||||
!strncmp (magick,"CP",2)))
|
!strncmp (magick, "CP", 2)))
|
||||||
{
|
{
|
||||||
g_message (_("'%s' is not a valid BMP file"),
|
g_message (_("'%s' is not a valid BMP file"),
|
||||||
gimp_filename_to_utf8 (filename));
|
gimp_filename_to_utf8 (filename));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!strncmp(magick,"BA",2))
|
while (!strncmp (magick, "BA", 2))
|
||||||
{
|
{
|
||||||
if (!ReadOK (fd, buffer, 12))
|
if (!ReadOK (fd, buffer, 12))
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,12 +30,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <glib/gstdio.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -192,7 +189,7 @@ WriteBMP (const gchar *filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let's take some file */
|
/* Let's take some file */
|
||||||
outfile = fopen (filename, "wb");
|
outfile = g_fopen (filename, "wb");
|
||||||
if (!outfile)
|
if (!outfile)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for writing: %s"),
|
g_message (_("Could not open '%s' for writing: %s"),
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
|
@ -20,18 +20,19 @@
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib.h> /* For G_OS_WIN32 */
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <glib.h> /* For G_OS_WIN32 */
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -211,7 +212,7 @@ load_image (const gchar *filename)
|
||||||
|
|
||||||
init_byte_tab( 0, byte_tab );
|
init_byte_tab( 0, byte_tab );
|
||||||
|
|
||||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
fd = g_open (filename, O_RDONLY | _O_BINARY);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +233,7 @@ load_image (const gchar *filename)
|
||||||
lseek(fd, 0L, 0);
|
lseek(fd, 0L, 0);
|
||||||
|
|
||||||
rs = read( fd, rbuf, sizeof(rbuf) );
|
rs = read( fd, rbuf, sizeof(rbuf) );
|
||||||
if ( rs < 0 ) { perror( "read" ); close( rs ); exit(8); }
|
if ( rs < 0 ) { perror( "read" ); close( rs ); gimp_quit (); }
|
||||||
rr += rs;
|
rr += rs;
|
||||||
gimp_progress_update ((float)rr/rsize/2.0);
|
gimp_progress_update ((float)rr/rsize/2.0);
|
||||||
|
|
||||||
|
@ -250,7 +251,7 @@ load_image (const gchar *filename)
|
||||||
while ( rs > 0 && cons_eol < 4 ) /* i.e., while (!EOF) */
|
while ( rs > 0 && cons_eol < 4 ) /* i.e., while (!EOF) */
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "hibit=%2d, data=", hibit );
|
g_printerr ("hibit=%2d, data=", hibit );
|
||||||
putbin( data );
|
putbin( data );
|
||||||
#endif
|
#endif
|
||||||
while ( hibit < 20 )
|
while ( hibit < 20 )
|
||||||
|
@ -268,7 +269,7 @@ load_image (const gchar *filename)
|
||||||
if ( rs == 0 ) { goto do_write; }
|
if ( rs == 0 ) { goto do_write; }
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "hibit=%2d, data=", hibit );
|
g_printerr ("hibit=%2d, data=", hibit );
|
||||||
putbin( data );
|
putbin( data );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -287,7 +288,7 @@ load_image (const gchar *filename)
|
||||||
|
|
||||||
if ( p == NULL ) /* invalid code */
|
if ( p == NULL ) /* invalid code */
|
||||||
{
|
{
|
||||||
fprintf( stderr, "invalid code, row=%d, col=%d, file offset=%lx, skip to eol\n",
|
g_printerr ("invalid code, row=%d, col=%d, file offset=%lx, skip to eol\n",
|
||||||
row, col, (unsigned long) lseek( fd, 0, 1 ) - rs + rp );
|
row, col, (unsigned long) lseek( fd, 0, 1 ) - rs + rp );
|
||||||
while ( ( data & 0x03f ) != 0 )
|
while ( ( data & 0x03f ) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -316,7 +317,7 @@ load_image (const gchar *filename)
|
||||||
|
|
||||||
nr_pels = ( (struct g3_leaf *) p ) ->nr_pels;
|
nr_pels = ( (struct g3_leaf *) p ) ->nr_pels;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "PELs: %d (%c)\n", nr_pels, '0'+color );
|
g_printerr ("PELs: %d (%c)\n", nr_pels, '0'+color );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +325,7 @@ load_image (const gchar *filename)
|
||||||
if ( nr_pels == -1 )
|
if ( nr_pels == -1 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "hibit=%2d, data=", hibit );
|
g_printerr ("hibit=%2d, data=", hibit );
|
||||||
putbin( data );
|
putbin( data );
|
||||||
#endif
|
#endif
|
||||||
/* skip filler 0bits -> seek for "1"-bit */
|
/* skip filler 0bits -> seek for "1"-bit */
|
||||||
|
@ -354,7 +355,7 @@ load_image (const gchar *filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "hibit=%2d, data=", hibit );
|
g_printerr ("hibit=%2d, data=", hibit );
|
||||||
putbin( data );
|
putbin( data );
|
||||||
#endif
|
#endif
|
||||||
} /* end skip 0bits */
|
} /* end skip 0bits */
|
||||||
|
@ -371,21 +372,21 @@ load_image (const gchar *filename)
|
||||||
|
|
||||||
/* bitmap memory full? make it larger! */
|
/* bitmap memory full? make it larger! */
|
||||||
if ( row >= max_rows )
|
if ( row >= max_rows )
|
||||||
{
|
{
|
||||||
char * p = (char *) realloc( bitmap,
|
gchar *p = g_try_realloc( bitmap,
|
||||||
( max_rows += 500 ) * MAX_COLS/8 );
|
( max_rows += 500 ) * MAX_COLS/8 );
|
||||||
if ( p == NULL )
|
if ( p == NULL )
|
||||||
{
|
{
|
||||||
perror( "realloc() failed, page truncated" );
|
perror( "realloc() failed, page truncated" );
|
||||||
rs = 0;
|
rs = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bitmap = p;
|
bitmap = p;
|
||||||
memset( &bitmap[ row * MAX_COLS/8 ], 0,
|
memset( &bitmap[ row * MAX_COLS/8 ], 0,
|
||||||
( max_rows - row ) * MAX_COLS/8 );
|
( max_rows - row ) * MAX_COLS/8 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
col=0; bp = &bitmap[ row * MAX_COLS/8 ];
|
col=0; bp = &bitmap[ row * MAX_COLS/8 ];
|
||||||
cons_eol = 0;
|
cons_eol = 0;
|
||||||
|
@ -418,7 +419,7 @@ do_write: /* write pbm (or whatever) file */
|
||||||
if( fd != 0 ) close(fd); /* close input file */
|
if( fd != 0 ) close(fd); /* close input file */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "consecutive EOLs: %d, max columns: %d\n", cons_eol, hcol );
|
g_printerr ("consecutive EOLs: %d, max columns: %d\n", cons_eol, hcol );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
image_id = emitgimp (hcol, row, bitmap, bperrow, filename);
|
image_id = emitgimp (hcol, row, bitmap, bperrow, filename);
|
||||||
|
@ -454,7 +455,7 @@ emitgimp (gint hcol,
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "emit gimp: %d x %d\n", hcol, row);
|
g_printerr ("emit gimp: %d x %d\n", hcol, row);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
image_ID = gimp_image_new (hcol, row, GIMP_GRAY);
|
image_ID = gimp_image_new (hcol, row, GIMP_GRAY);
|
||||||
|
@ -471,7 +472,7 @@ emitgimp (gint hcol,
|
||||||
0, 0, drawable->width, drawable->height, TRUE, FALSE);
|
0, 0, drawable->width, drawable->height, TRUE, FALSE);
|
||||||
tile_height = gimp_tile_height ();
|
tile_height = gimp_tile_height ();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "tile height: %d\n", tile_height);
|
g_printerr ("tile height: %d\n", tile_height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf = g_new (guchar, hcol*tile_height);
|
buf = g_new (guchar, hcol*tile_height);
|
||||||
|
@ -484,7 +485,7 @@ emitgimp (gint hcol,
|
||||||
}
|
}
|
||||||
if ((y-yy) == tile_height-1) {
|
if ((y-yy) == tile_height-1) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "update tile height: %d\n", tile_height);
|
g_printerr ("update tile height: %d\n", tile_height);
|
||||||
#endif
|
#endif
|
||||||
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, tile_height);
|
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, tile_height);
|
||||||
gimp_progress_update (0.5+(float)y/row/2.0);
|
gimp_progress_update (0.5+(float)y/row/2.0);
|
||||||
|
@ -494,7 +495,7 @@ emitgimp (gint hcol,
|
||||||
}
|
}
|
||||||
if (row-yy) {
|
if (row-yy) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf( stderr, "update rest: %d\n", row-yy);
|
g_printerr ("update rest: %d\n", row-yy);
|
||||||
#endif
|
#endif
|
||||||
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, row-yy);
|
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, row-yy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
#include <glib.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "g3.h"
|
#include "g3.h"
|
||||||
|
|
||||||
|
@ -244,7 +241,7 @@ int i;
|
||||||
}
|
}
|
||||||
if ( p2->nr_bits != 0 )
|
if ( p2->nr_bits != 0 )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "internal table setup error\n" ); exit(6);
|
g_printerr ("internal table setup error\n" ); exit(6);
|
||||||
}
|
}
|
||||||
tree_add_node( p2, g3c, bit_code >> FBITS, bit_length - FBITS );
|
tree_add_node( p2, g3c, bit_code >> FBITS, bit_length - FBITS );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,16 +32,12 @@
|
||||||
* (moved it from load to save)
|
* (moved it from load to save)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char ident[] = "@(#) GIMP FITS file-plugin v1.06 21-Nov-99";
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
@ -331,7 +327,7 @@ load_image (const gchar *filename)
|
||||||
FITS_FILE *ifp;
|
FITS_FILE *ifp;
|
||||||
FITS_HDU_LIST *hdu;
|
FITS_HDU_LIST *hdu;
|
||||||
|
|
||||||
fp = fopen (filename, "rb");
|
fp = g_fopen (filename, "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
|
@ -420,7 +416,6 @@ save_image (const gchar *filename,
|
||||||
FITS_FILE* ofp;
|
FITS_FILE* ofp;
|
||||||
GimpImageType drawable_type;
|
GimpImageType drawable_type;
|
||||||
gint retval;
|
gint retval;
|
||||||
char *temp = ident; /* Just to satisfy lint/gcc */
|
|
||||||
|
|
||||||
drawable_type = gimp_drawable_type (drawable_ID);
|
drawable_type = gimp_drawable_type (drawable_ID);
|
||||||
|
|
||||||
|
@ -452,10 +447,9 @@ save_image (const gchar *filename,
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = g_strdup_printf (_("Saving '%s'..."),
|
gimp_progress_init (NULL);
|
||||||
|
gimp_progress_set_text (_("Saving '%s'..."),
|
||||||
gimp_filename_to_utf8 (filename));
|
gimp_filename_to_utf8 (filename));
|
||||||
gimp_progress_init (temp);
|
|
||||||
g_free (temp);
|
|
||||||
|
|
||||||
if ((drawable_type == GIMP_INDEXED_IMAGE) ||
|
if ((drawable_type == GIMP_INDEXED_IMAGE) ||
|
||||||
(drawable_type == GIMP_INDEXEDA_IMAGE))
|
(drawable_type == GIMP_INDEXEDA_IMAGE))
|
||||||
|
@ -986,7 +980,7 @@ load_dialog (void)
|
||||||
TRUE, TRUE, 0);
|
TRUE, TRUE, 0);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
frame = gimp_int_radio_group_new (TRUE, _("BLANK/NaN Pixel Replacement"),
|
frame = gimp_int_radio_group_new (TRUE, _("Replacement for undefined pixels"),
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
G_CALLBACK (gimp_radio_button_update),
|
||||||
&plvals.replace, plvals.replace,
|
&plvals.replace, plvals.replace,
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#define VERSIO 0.11
|
#define VERSIO 0.11
|
||||||
/* Identifikation: "@(#) <product> <ver> <dd-mmm-yy>" */
|
|
||||||
static char ident[] = "@(#) libfits.c 0.11 20-Dec-97 (%I%)";
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* FITS reading/writing library */
|
/* FITS reading/writing library */
|
||||||
|
@ -86,12 +84,10 @@ static char ident[] = "@(#) libfits.c 0.11 20-Dec-97 (%I%)";
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <glib/gstdio.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "fitsrw.h"
|
#include "fitsrw.h"
|
||||||
|
|
||||||
|
@ -350,7 +346,7 @@ static int fits_nan_32 (unsigned char *v)
|
||||||
return ( ((k >= 0x7f7fffff) && (k <= 0x7fffffff))
|
return ( ((k >= 0x7f7fffff) && (k <= 0x7fffffff))
|
||||||
|| ((k >= 0x00000001) && (k <= 0x00800000)));
|
|| ((k >= 0x00000001) && (k <= 0x00800000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* #BEG-PAR */
|
/* #BEG-PAR */
|
||||||
|
@ -519,7 +515,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
|
||||||
if ((!reading) && (!writing))
|
if ((!reading) && (!writing))
|
||||||
FITS_RETURN ("fits_open: Invalid openmode", NULL);
|
FITS_RETURN ("fits_open: Invalid openmode", NULL);
|
||||||
|
|
||||||
fp = fopen (filename, reading ? "rb" : "wb");
|
fp = g_fopen (filename, reading ? "rb" : "wb");
|
||||||
if (fp == NULL) FITS_RETURN ("fits_open: fopen() failed", NULL);
|
if (fp == NULL) FITS_RETURN ("fits_open: fopen() failed", NULL);
|
||||||
|
|
||||||
ff = fits_new_filestruct ();
|
ff = fits_new_filestruct ();
|
||||||
|
@ -560,7 +556,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
|
||||||
if (hdulist->used.blank_value) ff->blank_used = 1;
|
if (hdulist->used.blank_value) ff->blank_used = 1;
|
||||||
if (hdulist->used.nan_value) ff->nan_used = 1;
|
if (hdulist->used.nan_value) ff->nan_used = 1;
|
||||||
|
|
||||||
if (n_hdr == 0)
|
if (n_hdr == 0)
|
||||||
ff->hdu_list = hdulist;
|
ff->hdu_list = hdulist;
|
||||||
else
|
else
|
||||||
last_hdulist->next_hdu = hdulist;
|
last_hdulist->next_hdu = hdulist;
|
||||||
|
@ -572,7 +568,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
|
||||||
if (fseek (fp, hdulist->data_offset+hdulist->data_size, SEEK_SET) < 0)
|
if (fseek (fp, hdulist->data_offset+hdulist->data_size, SEEK_SET) < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ff);
|
return (ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,7 +952,7 @@ int fits_write_header (FITS_FILE *ff, FITS_HDU_LIST *hdulist)
|
||||||
/* */
|
/* */
|
||||||
/* #END-PAR */
|
/* #END-PAR */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static FITS_HDU_LIST *fits_decode_header (FITS_RECORD_LIST *hdr,
|
static FITS_HDU_LIST *fits_decode_header (FITS_RECORD_LIST *hdr,
|
||||||
long hdr_offset, long dat_offset)
|
long hdr_offset, long dat_offset)
|
||||||
|
|
||||||
|
@ -1101,7 +1097,7 @@ static FITS_HDU_LIST *fits_decode_header (FITS_RECORD_LIST *hdr,
|
||||||
|| ( (hdulist->bitpix == -32)
|
|| ( (hdulist->bitpix == -32)
|
||||||
&& ( fits_ieee32_intel || fits_ieee32_motorola
|
&& ( fits_ieee32_intel || fits_ieee32_motorola
|
||||||
|| fits_ieee64_intel || fits_ieee64_motorola));
|
|| fits_ieee64_intel || fits_ieee64_motorola));
|
||||||
|
|
||||||
if (bitpix_supported)
|
if (bitpix_supported)
|
||||||
{
|
{
|
||||||
if (hdulist->used.simple)
|
if (hdulist->used.simple)
|
||||||
|
@ -1165,11 +1161,11 @@ err_return:
|
||||||
static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
|
|
||||||
{register int maxelem;
|
{register int maxelem;
|
||||||
#define FITSNPIX 4096
|
#define FITSNPIX 4096
|
||||||
unsigned char pixdat[FITSNPIX];
|
unsigned char pixdat[FITSNPIX];
|
||||||
int nelem, bpp;
|
int nelem, bpp;
|
||||||
int blank_found = 0, nan_found = 0;
|
int blank_found = 0, nan_found = 0;
|
||||||
|
|
||||||
if (fseek (fp, hdu->data_offset, SEEK_SET) < 0)
|
if (fseek (fp, hdu->data_offset, SEEK_SET) < 0)
|
||||||
FITS_RETURN ("fits_eval_pixrange: cant position file", -1);
|
FITS_RETURN ("fits_eval_pixrange: cant position file", -1);
|
||||||
|
|
||||||
|
@ -1191,7 +1187,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
nelem -= maxelem;
|
nelem -= maxelem;
|
||||||
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
||||||
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 8 data", -1);
|
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 8 data", -1);
|
||||||
|
|
||||||
ptr = pixdat;
|
ptr = pixdat;
|
||||||
if (hdu->used.blank)
|
if (hdu->used.blank)
|
||||||
{
|
{
|
||||||
|
@ -1233,7 +1229,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
nelem -= maxelem;
|
nelem -= maxelem;
|
||||||
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
||||||
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 16 data", -1);
|
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 16 data", -1);
|
||||||
|
|
||||||
ptr = pixdat;
|
ptr = pixdat;
|
||||||
if (hdu->used.blank)
|
if (hdu->used.blank)
|
||||||
{FITS_BITPIX16 blankval = (FITS_BITPIX16)hdu->blank;
|
{FITS_BITPIX16 blankval = (FITS_BITPIX16)hdu->blank;
|
||||||
|
@ -1278,7 +1274,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
nelem -= maxelem;
|
nelem -= maxelem;
|
||||||
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
||||||
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 32 data", -1);
|
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 32 data", -1);
|
||||||
|
|
||||||
ptr = pixdat;
|
ptr = pixdat;
|
||||||
if (hdu->used.blank)
|
if (hdu->used.blank)
|
||||||
{FITS_BITPIX32 blankval = (FITS_BITPIX32)hdu->blank;
|
{FITS_BITPIX32 blankval = (FITS_BITPIX32)hdu->blank;
|
||||||
|
@ -1329,7 +1325,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
nelem -= maxelem;
|
nelem -= maxelem;
|
||||||
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
||||||
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -32 data", -1);
|
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -32 data", -1);
|
||||||
|
|
||||||
ptr = pixdat;
|
ptr = pixdat;
|
||||||
while (maxelem-- > 0)
|
while (maxelem-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -1370,7 +1366,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
|
||||||
nelem -= maxelem;
|
nelem -= maxelem;
|
||||||
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
|
||||||
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -64 data", -1);
|
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -64 data", -1);
|
||||||
|
|
||||||
ptr = pixdat;
|
ptr = pixdat;
|
||||||
while (maxelem-- > 0)
|
while (maxelem-- > 0)
|
||||||
{
|
{
|
||||||
|
@ -1425,7 +1421,7 @@ FITS_DATA *fits_decode_card (const char *card, FITS_DATA_TYPES data_type)
|
||||||
long l_long;
|
long l_long;
|
||||||
double l_double;
|
double l_double;
|
||||||
char l_card[FITS_CARD_SIZE+1], msg[256];
|
char l_card[FITS_CARD_SIZE+1], msg[256];
|
||||||
char *cp = ident, *dst, *end;
|
char *cp, *dst, *end;
|
||||||
|
|
||||||
if (card == NULL) return (NULL);
|
if (card == NULL) return (NULL);
|
||||||
|
|
||||||
|
@ -1468,7 +1464,7 @@ FITS_DATA *fits_decode_card (const char *card, FITS_DATA_TYPES data_type)
|
||||||
FITS_RETURN ("fits_decode_card: error decoding typ_bitpixm64", NULL);
|
FITS_RETURN ("fits_decode_card: error decoding typ_bitpixm64", NULL);
|
||||||
data.bitpixm64 = (FITS_BITPIXM64)l_double;
|
data.bitpixm64 = (FITS_BITPIXM64)l_double;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case typ_fbool:
|
case typ_fbool:
|
||||||
cp = l_card+10;
|
cp = l_card+10;
|
||||||
while (*cp == ' ') cp++;
|
while (*cp == ' ') cp++;
|
||||||
|
@ -1596,7 +1592,7 @@ FITS_HDU_LIST *fits_image_info (FITS_FILE *ff, int picind, int *hdupicind)
|
||||||
|
|
||||||
if (ff->openmode != 'r')
|
if (ff->openmode != 'r')
|
||||||
FITS_RETURN ("fits_image_info: file not open for reading", NULL);
|
FITS_RETURN ("fits_image_info: file not open for reading", NULL);
|
||||||
|
|
||||||
if ((picind < 1) || (picind > ff->n_pic))
|
if ((picind < 1) || (picind > ff->n_pic))
|
||||||
FITS_RETURN ("fits_image_info: picind out of range", NULL);
|
FITS_RETURN ("fits_image_info: picind out of range", NULL);
|
||||||
|
|
||||||
|
@ -1692,7 +1688,7 @@ int fits_read_pixel (FITS_FILE *ff, FITS_HDU_LIST *hdulist, int npix,
|
||||||
FITS_BITPIXM64 bpm64;
|
FITS_BITPIXM64 bpm64;
|
||||||
|
|
||||||
/* initialize */
|
/* initialize */
|
||||||
|
|
||||||
bpm32 = 0;
|
bpm32 = 0;
|
||||||
|
|
||||||
if (ff->openmode != 'r') return (-1); /* Not open for reading */
|
if (ff->openmode != 'r') return (-1); /* Not open for reading */
|
||||||
|
@ -1944,7 +1940,7 @@ int fits_to_pgmraw (char *fitsfile, char *pgmfile)
|
||||||
if (hdu == NULL) goto err_return;
|
if (hdu == NULL) goto err_return;
|
||||||
if (hdu->naxis < 2) goto err_return; /* Enough dimensions ? */
|
if (hdu->naxis < 2) goto err_return; /* Enough dimensions ? */
|
||||||
|
|
||||||
pgmout = fopen (pgmfile, "wb");
|
pgmout = g_fopen (pgmfile, "wb");
|
||||||
if (pgmout == NULL) goto err_return;
|
if (pgmout == NULL) goto err_return;
|
||||||
|
|
||||||
/* Write PGM header with width/height */
|
/* Write PGM header with width/height */
|
||||||
|
@ -1978,7 +1974,7 @@ int fits_to_pgmraw (char *fitsfile, char *pgmfile)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
err_return:
|
err_return:
|
||||||
|
|
||||||
if (fitsin) fits_close (fitsin);
|
if (fitsin) fits_close (fitsin);
|
||||||
if (pgmout) fclose (pgmout);
|
if (pgmout) fclose (pgmout);
|
||||||
|
|
||||||
|
@ -2015,7 +2011,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
|
||||||
fitsout = fits_open (fitsfile, "w");
|
fitsout = fits_open (fitsfile, "w");
|
||||||
if (fitsout == NULL) goto err_return;
|
if (fitsout == NULL) goto err_return;
|
||||||
|
|
||||||
pgmin = fopen (pgmfile, "r");
|
pgmin = g_fopen (pgmfile, "r");
|
||||||
if (pgmin == NULL) goto err_return;
|
if (pgmin == NULL) goto err_return;
|
||||||
|
|
||||||
/* Read signature of PGM file */
|
/* Read signature of PGM file */
|
||||||
|
@ -2037,7 +2033,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
|
||||||
if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return;
|
if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return;
|
||||||
} while (buffer[0] == '#');
|
} while (buffer[0] == '#');
|
||||||
/* Ignore maxval */
|
/* Ignore maxval */
|
||||||
|
|
||||||
hdu = fits_add_hdu (fitsout); /* Create a HDU for the FITS file */
|
hdu = fits_add_hdu (fitsout); /* Create a HDU for the FITS file */
|
||||||
if (hdu == NULL) goto err_return;
|
if (hdu == NULL) goto err_return;
|
||||||
|
|
||||||
|
@ -2057,7 +2053,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
|
||||||
|
|
||||||
fits_add_card (hdu, "");
|
fits_add_card (hdu, "");
|
||||||
fits_add_card (hdu, "HISTORY THIS FITS FILE WAS GENERATED BY FITSRW\
|
fits_add_card (hdu, "HISTORY THIS FITS FILE WAS GENERATED BY FITSRW\
|
||||||
USING PGMRAW_TO_FITS");
|
USING PGMRAW_TO_FITS");
|
||||||
|
|
||||||
/* Write the header. Blocking is done automatically */
|
/* Write the header. Blocking is done automatically */
|
||||||
if (fits_write_header (fitsout, hdu) < 0) goto err_return;
|
if (fits_write_header (fitsout, hdu) < 0) goto err_return;
|
||||||
|
@ -2086,7 +2082,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
err_return:
|
err_return:
|
||||||
|
|
||||||
if (fitsout) fits_close (fitsout);
|
if (fitsout) fits_close (fitsout);
|
||||||
if (pgmin) fclose (pgmin);
|
if (pgmin) fclose (pgmin);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,11 +22,11 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ file_response_callback (GtkFileChooser *chooser,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen (filename, "r");
|
f = g_fopen (filename, "r");
|
||||||
|
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
{
|
{
|
||||||
|
@ -436,7 +436,7 @@ file_response_callback (GtkFileChooser *chooser,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FILE *f = fopen (filename, "w");
|
FILE *f = g_fopen (filename, "w");
|
||||||
|
|
||||||
if (NULL == f)
|
if (NULL == f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,15 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <libgimpbase/gimpwin32-io.h>
|
#include <libgimpbase/gimpwin32-io.h>
|
||||||
|
|
|
@ -24,15 +24,9 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
@ -40,6 +35,7 @@
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
static void d_draw_ellipse (GfigObject *obj);
|
static void d_draw_ellipse (GfigObject *obj);
|
||||||
static void d_paint_ellipse (GfigObject *obj);
|
static void d_paint_ellipse (GfigObject *obj);
|
||||||
static GfigObject *d_copy_ellipse (GfigObject *obj);
|
static GfigObject *d_copy_ellipse (GfigObject *obj);
|
||||||
|
|
|
@ -24,12 +24,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
||||||
#include "gfig.h"
|
#include "gfig.h"
|
||||||
|
@ -37,6 +33,7 @@
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
/* For the isometric grid */
|
/* For the isometric grid */
|
||||||
#define SQRT3 1.73205080756887729353 /* Square root of 3 */
|
#define SQRT3 1.73205080756887729353 /* Square root of 3 */
|
||||||
#define SIN_1o6PI_RAD 0.5 /* Sine 1/6 Pi Radians */
|
#define SIN_1o6PI_RAD 0.5 /* Sine 1/6 Pi Radians */
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* This is a plug-in for the GIMP.
|
||||||
|
*
|
||||||
|
* Generates images containing vector type drawings.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,19 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
|
||||||
|
|
||||||
#include "gfig.h"
|
#include "gfig.h"
|
||||||
#include "gfig-style.h"
|
#include "gfig-style.h"
|
||||||
#include "gfig-dialog.h"
|
#include "gfig-dialog.h"
|
||||||
|
@ -56,6 +53,9 @@
|
||||||
#include "gfig-star.h"
|
#include "gfig-star.h"
|
||||||
#include "gfig-stock.h"
|
#include "gfig-stock.h"
|
||||||
|
|
||||||
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
/***** Magic numbers *****/
|
/***** Magic numbers *****/
|
||||||
|
|
||||||
#define GFIG_HEADER "GFIG Version 0.2\n"
|
#define GFIG_HEADER "GFIG Version 0.2\n"
|
||||||
|
@ -423,7 +423,7 @@ gfig_load (const gchar *filename,
|
||||||
printf ("Loading %s (%s)\n", filename, name);
|
printf ("Loading %s (%s)\n", filename, name);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
fp = fopen (filename, "r");
|
fp = g_fopen (filename, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
|
@ -714,14 +714,17 @@ gfig_save_as_parasite (void)
|
||||||
|
|
||||||
string = gfig_save_as_string ();
|
string = gfig_save_as_string ();
|
||||||
|
|
||||||
parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE,
|
parasite = gimp_parasite_new ("gfig",
|
||||||
|
GIMP_PARASITE_PERSISTENT |
|
||||||
|
GIMP_PARASITE_UNDOABLE,
|
||||||
string->len, string->str);
|
string->len, string->str);
|
||||||
|
|
||||||
g_string_free (string, TRUE);
|
g_string_free (string, TRUE);
|
||||||
|
|
||||||
if (!gimp_drawable_parasite_attach (gfig_context->drawable_id, parasite))
|
if (!gimp_drawable_parasite_attach (gfig_context->drawable_id, parasite))
|
||||||
{
|
{
|
||||||
g_message (_("Error trying to save figure as a parasite: can't attach parasite to drawable.\n"));
|
g_message (_("Error trying to save figure as a parasite: "
|
||||||
|
"can't attach parasite to drawable."));
|
||||||
gimp_parasite_free (parasite);
|
gimp_parasite_free (parasite);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -739,10 +742,12 @@ gfig_load_from_parasite (void)
|
||||||
GFigObj *gfig;
|
GFigObj *gfig;
|
||||||
|
|
||||||
fname = gimp_temp_name ("gfigtmp");
|
fname = gimp_temp_name ("gfigtmp");
|
||||||
fp = fopen (fname, "w");
|
fp = g_fopen (fname, "w");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Error trying to open temp file '%s'for parasite loading.\n"), fname);
|
g_message (_("Error trying to open temporary file '%s' "
|
||||||
|
"for parasite loading: %s"),
|
||||||
|
gimp_filename_to_utf8 (fname), g_strerror (errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +765,7 @@ gfig_load_from_parasite (void)
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
gfig = gfig_load (fname, "(none)");
|
gfig = gfig_load (fname, "(none)");
|
||||||
unlink (fname);
|
g_unlink (fname);
|
||||||
|
|
||||||
return (gfig);
|
return (gfig);
|
||||||
}
|
}
|
||||||
|
@ -774,7 +779,7 @@ gfig_save_callbk (void)
|
||||||
|
|
||||||
savename = gfig_context->current_obj->filename;
|
savename = gfig_context->current_obj->filename;
|
||||||
|
|
||||||
fp = fopen (savename, "w+");
|
fp = g_fopen (savename, "w+");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
@ -788,12 +793,9 @@ gfig_save_callbk (void)
|
||||||
fwrite (string->str, string->len, 1, fp);
|
fwrite (string->str, string->len, 1, fp);
|
||||||
|
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
g_message ("Failed to write file\n");
|
g_message ("Failed to write file.");
|
||||||
else
|
else
|
||||||
{
|
gfig_context->current_obj->obj_status &= ~(GFIG_MODIFIED | GFIG_READONLY);
|
||||||
gfig_context->current_obj->obj_status &= ~(GFIG_MODIFIED | GFIG_READONLY);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,19 +33,16 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include <libgimpcolor/gimpcolor.h>
|
#include <libgimpcolor/gimpcolor.h>
|
||||||
|
|
||||||
|
@ -1256,7 +1253,7 @@ gflare_load (const gchar *filename,
|
||||||
|
|
||||||
g_return_val_if_fail (filename != NULL, NULL);
|
g_return_val_if_fail (filename != NULL, NULL);
|
||||||
|
|
||||||
fp = fopen (filename, "r");
|
fp = g_fopen (filename, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Failed to open GFlare file '%s': %s"),
|
g_message (_("Failed to open GFlare file '%s': %s"),
|
||||||
|
@ -1476,7 +1473,7 @@ gflare_save (GFlare *gflare)
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
fp = fopen (gflare->filename, "w");
|
fp = g_fopen (gflare->filename, "w");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Failed to write GFlare file '%s': %s"),
|
g_message (_("Failed to write GFlare file '%s': %s"),
|
||||||
|
@ -3197,7 +3194,8 @@ dlg_selector_do_delete_callback (GtkWidget *widget,
|
||||||
|
|
||||||
/* Delete old one from disk and memory */
|
/* Delete old one from disk and memory */
|
||||||
if (old_gflare->filename)
|
if (old_gflare->filename)
|
||||||
unlink (old_gflare->filename);
|
g_unlink (old_gflare->filename);
|
||||||
|
|
||||||
gflare_free (old_gflare);
|
gflare_free (old_gflare);
|
||||||
|
|
||||||
/* Update */
|
/* Update */
|
||||||
|
@ -4190,7 +4188,9 @@ preview_render_start (Preview *preview)
|
||||||
preview->init_done = FALSE;
|
preview->init_done = FALSE;
|
||||||
preview->current_y = 0;
|
preview->current_y = 0;
|
||||||
preview->drawn_y = 0;
|
preview->drawn_y = 0;
|
||||||
preview->timeout_tag = g_timeout_add (100, (GSourceFunc) preview_render_start_2, preview);
|
preview->timeout_tag = g_timeout_add (100,
|
||||||
|
(GSourceFunc) preview_render_start_2,
|
||||||
|
preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
|
|
@ -17,16 +17,17 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code can be used to read and write FLI movies. It is currently
|
* This code can be used to read and write FLI movies. It is currently
|
||||||
* only used for the GIMP fli plug-in, but it can be used for other
|
* only used for the GIMP fli plug-in, but it can be used for other
|
||||||
* programs, too.
|
* programs, too.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "config.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "fli.h"
|
#include "fli.h"
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frameb
|
||||||
if (chunk.size & 1) chunk.size++;
|
if (chunk.size & 1) chunk.size++;
|
||||||
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
||||||
}
|
}
|
||||||
} /* else: unknown, skip */
|
} /* else: unknown, skip */
|
||||||
fseek(f, framepos+fli_frame.size, SEEK_SET);
|
fseek(f, framepos+fli_frame.size, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,8 +181,8 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
|
||||||
fli_frame.magic=FRAME;
|
fli_frame.magic=FRAME;
|
||||||
fli_frame.chunks=0;
|
fli_frame.chunks=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create color chunk
|
* create color chunk
|
||||||
*/
|
*/
|
||||||
if (fli_header->magic == HEADER_FLI) {
|
if (fli_header->magic == HEADER_FLI) {
|
||||||
if (fli_write_color(f, fli_header, old_cmap, cmap)) fli_frame.chunks++;
|
if (fli_write_color(f, fli_header, old_cmap, cmap)) fli_frame.chunks++;
|
||||||
|
@ -208,7 +209,7 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
|
||||||
fli_write_lc(f, fli_header, old_framebuf, framebuf);
|
fli_write_lc(f, fli_header, old_framebuf, framebuf);
|
||||||
}
|
}
|
||||||
fli_frame.chunks++;
|
fli_frame.chunks++;
|
||||||
|
|
||||||
frameend=ftell(f);
|
frameend=ftell(f);
|
||||||
fli_frame.size=frameend-framepos;
|
fli_frame.size=frameend-framepos;
|
||||||
fseek(f, framepos, SEEK_SET);
|
fseek(f, framepos, SEEK_SET);
|
||||||
|
@ -254,7 +255,7 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap,
|
||||||
{
|
{
|
||||||
unsigned long chunkpos;
|
unsigned long chunkpos;
|
||||||
unsigned short num_packets;
|
unsigned short num_packets;
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
chunkpos=ftell(f);
|
chunkpos=ftell(f);
|
||||||
fseek(f, chunkpos+8, SEEK_SET);
|
fseek(f, chunkpos+8, SEEK_SET);
|
||||||
num_packets=0;
|
num_packets=0;
|
||||||
|
@ -270,12 +271,12 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap,
|
||||||
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
|
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
|
||||||
num_packets=0; col_pos=0;
|
num_packets=0; col_pos=0;
|
||||||
do {
|
do {
|
||||||
cnt_skip=0;
|
cnt_skip=0;
|
||||||
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
|
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
|
||||||
cnt_skip++; col_pos++;
|
cnt_skip++; col_pos++;
|
||||||
}
|
}
|
||||||
col_start=col_pos;
|
col_start=col_pos;
|
||||||
cnt_col=0;
|
cnt_col=0;
|
||||||
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
|
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
|
||||||
cnt_col++; col_pos++;
|
cnt_col++; col_pos++;
|
||||||
}
|
}
|
||||||
|
@ -327,14 +328,14 @@ void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
|
||||||
cmap[col_pos]=fli_read_char(f);
|
cmap[col_pos]=fli_read_char(f);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||||
}
|
}
|
||||||
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||||
cmap[col_pos++]=fli_read_char(f);
|
cmap[col_pos++]=fli_read_char(f);
|
||||||
cmap[col_pos++]=fli_read_char(f);
|
cmap[col_pos++]=fli_read_char(f);
|
||||||
cmap[col_pos++]=fli_read_char(f);
|
cmap[col_pos++]=fli_read_char(f);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +346,7 @@ int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
|
||||||
{
|
{
|
||||||
unsigned long chunkpos;
|
unsigned long chunkpos;
|
||||||
unsigned short num_packets;
|
unsigned short num_packets;
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
chunkpos=ftell(f);
|
chunkpos=ftell(f);
|
||||||
fseek(f, chunkpos+8, SEEK_SET);
|
fseek(f, chunkpos+8, SEEK_SET);
|
||||||
num_packets=0;
|
num_packets=0;
|
||||||
|
@ -361,12 +362,12 @@ int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
|
||||||
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
|
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
|
||||||
num_packets=0; col_pos=0;
|
num_packets=0; col_pos=0;
|
||||||
do {
|
do {
|
||||||
cnt_skip=0;
|
cnt_skip=0;
|
||||||
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
|
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
|
||||||
cnt_skip++; col_pos++;
|
cnt_skip++; col_pos++;
|
||||||
}
|
}
|
||||||
col_start=col_pos;
|
col_start=col_pos;
|
||||||
cnt_col=0;
|
cnt_col=0;
|
||||||
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
|
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
|
||||||
cnt_col++; col_pos++;
|
cnt_col++; col_pos++;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +411,7 @@ void fli_read_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
|
|
||||||
void fli_write_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
void fli_write_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
{
|
{
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
|
|
||||||
chunk.size=6;
|
chunk.size=6;
|
||||||
chunk.magic=FLI_BLACK;
|
chunk.magic=FLI_BLACK;
|
||||||
|
@ -429,9 +430,9 @@ void fli_read_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
|
|
||||||
void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned long chunkpos;
|
unsigned long chunkpos;
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
chunkpos=ftell(f);
|
chunkpos=ftell(f);
|
||||||
fseek(f, chunkpos+6, SEEK_SET);
|
fseek(f, chunkpos+6, SEEK_SET);
|
||||||
fwrite(framebuf, fli_header->width, fli_header->height, f);
|
fwrite(framebuf, fli_header->width, fli_header->height, f);
|
||||||
|
@ -441,7 +442,7 @@ void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
fseek(f, chunkpos, SEEK_SET);
|
fseek(f, chunkpos, SEEK_SET);
|
||||||
fli_write_long(f, chunk.size);
|
fli_write_long(f, chunk.size);
|
||||||
fli_write_short(f, chunk.magic);
|
fli_write_short(f, chunk.magic);
|
||||||
|
|
||||||
if (chunk.size & 1) chunk.size++;
|
if (chunk.size & 1) chunk.size++;
|
||||||
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
||||||
}
|
}
|
||||||
|
@ -462,10 +463,10 @@ void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
unsigned short ps;
|
unsigned short ps;
|
||||||
ps=fli_read_char(f);
|
ps=fli_read_char(f);
|
||||||
if (ps & 0x80) {
|
if (ps & 0x80) {
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
for (len=-(signed char)ps; len>0; len--) {
|
for (len=-(signed char)ps; len>0; len--) {
|
||||||
pos[xc++]=fli_read_char(f);
|
pos[xc++]=fli_read_char(f);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
val=fli_read_char(f);
|
val=fli_read_char(f);
|
||||||
|
@ -473,16 +474,16 @@ void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
xc+=ps;
|
xc+=ps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
{
|
{
|
||||||
unsigned long chunkpos;
|
unsigned long chunkpos;
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
unsigned short yc;
|
unsigned short yc;
|
||||||
unsigned char *linebuf;
|
unsigned char *linebuf;
|
||||||
|
|
||||||
chunkpos=ftell(f);
|
chunkpos=ftell(f);
|
||||||
fseek(f, chunkpos+6, SEEK_SET);
|
fseek(f, chunkpos+6, SEEK_SET);
|
||||||
|
|
||||||
|
@ -496,7 +497,7 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
while (xc < fli_header->width) {
|
while (xc < fli_header->width) {
|
||||||
pc=1;
|
pc=1;
|
||||||
while ((pc<120) && ((xc+pc)<fli_header->width) && (linebuf[xc+pc] == linebuf[xc])) {
|
while ((pc<120) && ((xc+pc)<fli_header->width) && (linebuf[xc+pc] == linebuf[xc])) {
|
||||||
pc++;
|
pc++;
|
||||||
}
|
}
|
||||||
if (pc>2) {
|
if (pc>2) {
|
||||||
if (tc>0) {
|
if (tc>0) {
|
||||||
|
@ -527,7 +528,7 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
fwrite(linebuf+t1, 1, tc, f);
|
fwrite(linebuf+t1, 1, tc, f);
|
||||||
tc=0;
|
tc=0;
|
||||||
}
|
}
|
||||||
lineend=ftell(f);
|
lineend=ftell(f);
|
||||||
fseek(f, linepos, SEEK_SET);
|
fseek(f, linepos, SEEK_SET);
|
||||||
fli_write_char(f, bc);
|
fli_write_char(f, bc);
|
||||||
fseek(f, lineend, SEEK_SET);
|
fseek(f, lineend, SEEK_SET);
|
||||||
|
@ -539,13 +540,13 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||||
fseek(f, chunkpos, SEEK_SET);
|
fseek(f, chunkpos, SEEK_SET);
|
||||||
fli_write_long(f, chunk.size);
|
fli_write_long(f, chunk.size);
|
||||||
fli_write_short(f, chunk.magic);
|
fli_write_short(f, chunk.magic);
|
||||||
|
|
||||||
if (chunk.size & 1) chunk.size++;
|
if (chunk.size & 1) chunk.size++;
|
||||||
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the delta-compression method from the classic Autodesk Animator.
|
* This is the delta-compression method from the classic Autodesk Animator.
|
||||||
* It's basically the RLE method from above, but it allows to skip unchanged
|
* It's basically the RLE method from above, but it allows to skip unchanged
|
||||||
* lines at the beginning and end of an image, and unchanged pixels in a line
|
* lines at the beginning and end of an image, and unchanged pixels in a line
|
||||||
* This chunk is used in FLI files.
|
* This chunk is used in FLI files.
|
||||||
|
@ -578,30 +579,30 @@ void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf,
|
||||||
xc+=ps;
|
xc+=ps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf)
|
void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf)
|
||||||
{
|
{
|
||||||
unsigned long chunkpos;
|
unsigned long chunkpos;
|
||||||
s_fli_chunk chunk;
|
s_fli_chunk chunk;
|
||||||
unsigned short yc, firstline, numline, lastline;
|
unsigned short yc, firstline, numline, lastline;
|
||||||
unsigned char *linebuf, *old_linebuf;
|
unsigned char *linebuf, *old_linebuf;
|
||||||
|
|
||||||
chunkpos=ftell(f);
|
chunkpos=ftell(f);
|
||||||
fseek(f, chunkpos+6, SEEK_SET);
|
fseek(f, chunkpos+6, SEEK_SET);
|
||||||
|
|
||||||
/* first check, how many lines are unchanged at the beginning */
|
/* first check, how many lines are unchanged at the beginning */
|
||||||
firstline=0;
|
firstline=0;
|
||||||
while ((memcmp(old_framebuf+(firstline*fli_header->width), framebuf+(firstline*fli_header->width), fli_header->width)==0) && (firstline<fli_header->height)) firstline++;
|
while ((memcmp(old_framebuf+(firstline*fli_header->width), framebuf+(firstline*fli_header->width), fli_header->width)==0) && (firstline<fli_header->height)) firstline++;
|
||||||
|
|
||||||
/* then check from the end, how many lines are unchanged */
|
/* then check from the end, how many lines are unchanged */
|
||||||
if (firstline<fli_header->height) {
|
if (firstline<fli_header->height) {
|
||||||
lastline=fli_header->height-1;
|
lastline=fli_header->height-1;
|
||||||
while ((memcmp(old_framebuf+(lastline*fli_header->width), framebuf+(lastline*fli_header->width), fli_header->width)==0) && (lastline>firstline)) lastline--;
|
while ((memcmp(old_framebuf+(lastline*fli_header->width), framebuf+(lastline*fli_header->width), fli_header->width)==0) && (lastline>firstline)) lastline--;
|
||||||
numline=(lastline-firstline)+1;
|
numline=(lastline-firstline)+1;
|
||||||
} else {
|
} else {
|
||||||
numline=0;
|
numline=0;
|
||||||
}
|
}
|
||||||
if (numline==0) firstline=0;
|
if (numline==0) firstline=0;
|
||||||
|
|
||||||
|
@ -651,7 +652,7 @@ void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf
|
||||||
xc+=tc;
|
xc+=tc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lineend=ftell(f);
|
lineend=ftell(f);
|
||||||
fseek(f, linepos, SEEK_SET);
|
fseek(f, linepos, SEEK_SET);
|
||||||
fli_write_char(f, bc);
|
fli_write_char(f, bc);
|
||||||
fseek(f, lineend, SEEK_SET);
|
fseek(f, lineend, SEEK_SET);
|
||||||
|
@ -663,7 +664,7 @@ void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf
|
||||||
fseek(f, chunkpos, SEEK_SET);
|
fseek(f, chunkpos, SEEK_SET);
|
||||||
fli_write_long(f, chunk.size);
|
fli_write_long(f, chunk.size);
|
||||||
fli_write_short(f, chunk.magic);
|
fli_write_short(f, chunk.magic);
|
||||||
|
|
||||||
if (chunk.size & 1) chunk.size++;
|
if (chunk.size & 1) chunk.size++;
|
||||||
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
fseek(f,chunkpos+chunk.size,SEEK_SET);
|
||||||
}
|
}
|
||||||
|
@ -717,5 +718,5 @@ void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebu
|
||||||
}
|
}
|
||||||
if (lpf) pos[xc]=lpn;
|
if (lpf) pos[xc]=lpn;
|
||||||
yc++;
|
yc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
@ -417,7 +415,7 @@ get_info (const gchar *filename,
|
||||||
|
|
||||||
*width = 0; *height = 0; *frames = 0;
|
*width = 0; *height = 0; *frames = 0;
|
||||||
|
|
||||||
file = fopen (filename ,"rb");
|
file = g_fopen (filename ,"rb");
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
|
@ -453,7 +451,7 @@ load_image (const gchar *filename,
|
||||||
|
|
||||||
gint cnt;
|
gint cnt;
|
||||||
|
|
||||||
file = fopen (filename ,"rb");
|
file = g_fopen (filename ,"rb");
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
|
@ -706,7 +704,7 @@ save_image (const gchar *filename,
|
||||||
fli_header.aspect_y = 1; /* ... as GIMP supports it. */
|
fli_header.aspect_y = 1; /* ... as GIMP supports it. */
|
||||||
fli_header.oframe1 = fli_header.oframe2 = 0; /* will be fixed during the write */
|
fli_header.oframe1 = fli_header.oframe2 = 0; /* will be fixed during the write */
|
||||||
|
|
||||||
file = fopen (filename ,"wb");
|
file = g_fopen (filename ,"wb");
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for writing: %s"),
|
g_message (_("Could not open '%s' for writing: %s"),
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimpmath/gimpmath.h>
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimpmath/gimpmath.h>
|
||||||
|
|
||||||
#include "ppmtool.h"
|
#include "ppmtool.h"
|
||||||
#include "gimpressionist.h"
|
#include "gimpressionist.h"
|
||||||
|
@ -227,11 +226,12 @@ fopen_from_search_path (const gchar * fn, const char * mode)
|
||||||
{
|
{
|
||||||
FILE * f;
|
FILE * f;
|
||||||
gchar * full_filename;
|
gchar * full_filename;
|
||||||
f = fopen (fn, mode);
|
|
||||||
|
f = g_fopen (fn, mode);
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
full_filename = findfile (fn);
|
full_filename = findfile (fn);
|
||||||
f = fopen (full_filename, mode);
|
f = g_fopen (full_filename, mode);
|
||||||
g_free (full_filename);
|
g_free (full_filename);
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
|
@ -250,7 +250,8 @@ load_gimp_brush (const gchar *fn, ppm_t *p)
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "load_gimp_brush: Unable to open file \"%s\"!\n", fn);
|
g_printerr ("load_gimp_brush: Unable to open file \"%s\"!\n",
|
||||||
|
gimp_filename_to_utf8 (fn));
|
||||||
ppm_new (p, 10,10);
|
ppm_new (p, 10,10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,7 @@ load_gimp_brush (const gchar *fn, ppm_t *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose (f);
|
fclose (f);
|
||||||
free (ptr);
|
g_free (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -296,7 +297,8 @@ ppm_load (const char *fn, ppm_t *p)
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "ppm_load: Unable to open file \"%s\"!\n", fn);
|
g_printerr ("ppm_load: Unable to open file \"%s\"!\n",
|
||||||
|
gimp_filename_to_utf8 (fn));
|
||||||
ppm_new (p, 10,10);
|
ppm_new (p, 10,10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -307,8 +309,8 @@ ppm_load (const char *fn, ppm_t *p)
|
||||||
if (strcmp (line, "P5"))
|
if (strcmp (line, "P5"))
|
||||||
{
|
{
|
||||||
fclose (f);
|
fclose (f);
|
||||||
printf ("ppm_load: File \"%s\" not PPM/PGM? (line=\"%s\")%c\n",
|
g_printerr ("ppm_load: File \"%s\" not PPM/PGM? (line=\"%s\")%c\n",
|
||||||
fn, line, 7);
|
gimp_filename_to_utf8 (fn), line, 7);
|
||||||
ppm_new (p, 10,10);
|
ppm_new (p, 10,10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -320,8 +322,8 @@ ppm_load (const char *fn, ppm_t *p)
|
||||||
readline (f, line, 200);
|
readline (f, line, 200);
|
||||||
if (strcmp (line, "255"))
|
if (strcmp (line, "255"))
|
||||||
{
|
{
|
||||||
printf ("ppm_load: File \"%s\" not valid PPM/PGM? (line=\"%s\")%c\n",
|
g_printerr ("ppm_load: File \"%s\" not valid PPM/PGM? (line=\"%s\")%c\n",
|
||||||
fn, line, 7);
|
gimp_filename_to_utf8 (fn), line, 7);
|
||||||
ppm_new (p, 10,10);
|
ppm_new (p, 10,10);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -619,7 +621,7 @@ ppm_pad (ppm_t *p, int left,int right, int top, int bottom, guchar *bg)
|
||||||
void
|
void
|
||||||
ppm_save (ppm_t *p, const char *fn)
|
ppm_save (ppm_t *p, const char *fn)
|
||||||
{
|
{
|
||||||
FILE *f = fopen (fn, "wb");
|
FILE *f = g_fopen (fn, "wb");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
@ -90,7 +91,7 @@ get_early_line_from_preset (gchar *full_path, const gchar *prefix)
|
||||||
gint prefix_len, line_idx;
|
gint prefix_len, line_idx;
|
||||||
|
|
||||||
prefix_len = strlen (prefix);
|
prefix_len = strlen (prefix);
|
||||||
f = fopen (full_path, "rt");
|
f = g_fopen (full_path, "rt");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
/* Skip the preset magic. */
|
/* Skip the preset magic. */
|
||||||
|
@ -227,10 +228,11 @@ load_old_preset (const gchar *fname)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
f = fopen (fname, "rb");
|
f = g_fopen (fname, "rb");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Error opening file \"%s\" for reading!%c\n", fname, 7);
|
g_printerr ("Error opening file \"%s\" for reading!\n",
|
||||||
|
gimp_filename_to_utf8 (fname));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = fread (&pcvals, 1, sizeof (pcvals), f);
|
len = fread (&pcvals, 1, sizeof (pcvals), f);
|
||||||
|
@ -447,10 +449,11 @@ load_preset (const gchar *fn)
|
||||||
char line[1024] = "";
|
char line[1024] = "";
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
f = fopen (fn, "rt");
|
f = g_fopen (fn, "rt");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Error opening file \"%s\" for reading!\n", fn);
|
g_printerr ("Error opening file \"%s\" for reading!\n",
|
||||||
|
gimp_filename_to_utf8 (fn));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fgets (line, 10, f);
|
fgets (line, 10, f);
|
||||||
|
@ -567,9 +570,7 @@ delete_preset (GtkWidget *w, GtkTreeSelection *selection)
|
||||||
{
|
{
|
||||||
/* Don't delete global presets - bug # 147483 */
|
/* Don't delete global presets - bug # 147483 */
|
||||||
if (can_delete_preset (abs))
|
if (can_delete_preset (abs))
|
||||||
{
|
g_unlink (abs);
|
||||||
unlink (abs);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (abs);
|
g_free (abs);
|
||||||
}
|
}
|
||||||
|
@ -693,7 +694,7 @@ save_preset (void)
|
||||||
|
|
||||||
if (!thispath)
|
if (!thispath)
|
||||||
{
|
{
|
||||||
g_printerr ("Internal error: (save_preset) thispath == NULL");
|
g_printerr ("Internal error: (save_preset) thispath == NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,12 +705,13 @@ save_preset (void)
|
||||||
|
|
||||||
if (!g_file_test (presets_dir_path, G_FILE_TEST_IS_DIR))
|
if (!g_file_test (presets_dir_path, G_FILE_TEST_IS_DIR))
|
||||||
{
|
{
|
||||||
if (mkdir (presets_dir_path,
|
if (g_mkdir (presets_dir_path,
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR |
|
S_IRUSR | S_IWUSR | S_IXUSR |
|
||||||
S_IRGRP | S_IXGRP |
|
S_IRGRP | S_IXGRP |
|
||||||
S_IROTH | S_IXOTH) == -1)
|
S_IROTH | S_IXOTH) == -1)
|
||||||
{
|
{
|
||||||
g_printerr ("Error creating folder \"%s\"!\n", presets_dir_path);
|
g_printerr ("Error creating folder \"%s\"!\n",
|
||||||
|
gimp_filename_to_utf8 (presets_dir_path));
|
||||||
g_free (presets_dir_path);
|
g_free (presets_dir_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -737,10 +739,11 @@ save_preset (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen (fname, "wt");
|
f = g_fopen (fname, "wt");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
g_printerr ("Error opening file \"%s\" for writing!%c\n", fname, 7);
|
g_printerr ("Error opening file \"%s\" for writing!\n",
|
||||||
|
gimp_filename_to_utf8 (fname));
|
||||||
g_free (fname);
|
g_free (fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,10 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
@ -2399,7 +2398,7 @@ ifsfile_save_response (GtkWidget *dialog,
|
||||||
|
|
||||||
str = ifsvals_stringify (&ifsvals, elements);
|
str = ifsvals_stringify (&ifsvals, elements);
|
||||||
|
|
||||||
fh = fopen (filename, "w");
|
fh = g_fopen (filename, "w");
|
||||||
if (! fh)
|
if (! fh)
|
||||||
{
|
{
|
||||||
gchar *message =
|
gchar *message =
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
#include <jerror.h>
|
#include <jerror.h>
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ load_image (const gchar *filename,
|
||||||
jerr.pub.output_message = my_output_message;
|
jerr.pub.output_message = my_output_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((infile = fopen (filename, "rb")) == NULL)
|
if ((infile = g_fopen (filename, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
|
@ -830,7 +831,7 @@ load_thumbnail_image (const gchar *filename,
|
||||||
jerr.pub.emit_message = my_emit_message;
|
jerr.pub.emit_message = my_emit_message;
|
||||||
jerr.pub.output_message = my_output_message;
|
jerr.pub.output_message = my_output_message;
|
||||||
|
|
||||||
if ((infile = fopen (filename, "rb")) == NULL)
|
if ((infile = g_fopen (filename, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -30,6 +29,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
#include <jerror.h>
|
#include <jerror.h>
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ background_jpeg_save (PreviewPersistent *pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we cleanup here (load_image doesn't run in the background) */
|
/* we cleanup here (load_image doesn't run in the background) */
|
||||||
unlink (pp->file_name);
|
g_unlink (pp->file_name);
|
||||||
|
|
||||||
if (abort_me == &(pp->abort_me))
|
if (abort_me == &(pp->abort_me))
|
||||||
abort_me = NULL;
|
abort_me = NULL;
|
||||||
|
@ -253,7 +254,7 @@ save_image (const gchar *filename,
|
||||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
||||||
* requires it in order to write binary files.
|
* requires it in order to write binary files.
|
||||||
*/
|
*/
|
||||||
if ((outfile = fopen (filename, "wb")) == NULL)
|
if ((outfile = g_fopen (filename, "wb")) == NULL)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for writing: %s"),
|
g_message (_("Could not open '%s' for writing: %s"),
|
||||||
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
|
|
|
@ -39,9 +39,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
#include "libgimp/gimpui.h"
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,16 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
#include "libgimp/gimpui.h"
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
#include "rcm.h"
|
#include "rcm.h"
|
||||||
#include "rcm_misc.h"
|
#include "rcm_misc.h"
|
||||||
|
|
|
@ -38,14 +38,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "libgimpmath/gimpmath.h"
|
|
||||||
#include "libgimpwidgets/gimpwidgets.h"
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
#include "rcm.h"
|
#include "rcm.h"
|
||||||
#include "rcm_misc.h"
|
#include "rcm_misc.h"
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
#include "libgimp/gimpui.h"
|
#include "libgimp/gimpui.h"
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#if HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,9 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib.h> /* Include early for obscure Win32 build reasons */
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
|
@ -18,22 +18,23 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib.h> /* For G_OS_WIN32 */
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <time.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <libgimpbase/gimpwin32-io.h>
|
#include <libgimpbase/gimpwin32-io.h>
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif /* HAVE_SYS_SELECT_H */
|
#endif /* HAVE_SYS_SELECT_H */
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
#include "libgimp/gimpui.h"
|
#include "libgimp/gimpui.h"
|
||||||
|
@ -346,7 +347,7 @@ server_start (gint port,
|
||||||
|
|
||||||
/* Setup up the server log file */
|
/* Setup up the server log file */
|
||||||
if (logfile && *logfile)
|
if (logfile && *logfile)
|
||||||
server_log_file = fopen (logfile, "a");
|
server_log_file = g_fopen (logfile, "a");
|
||||||
else
|
else
|
||||||
server_log_file = NULL;
|
server_log_file = NULL;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +120,7 @@ read_command (GString *command)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
script_fu_text_console_interface (void)
|
script_fu_text_console_interface (void)
|
||||||
{
|
{
|
||||||
GString *command = g_string_new (NULL);
|
GString *command = g_string_new (NULL);
|
||||||
|
|
|
@ -18,14 +18,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
||||||
#include "siod/siod.h"
|
#include "siod/siod.h"
|
||||||
|
|
|
@ -16,10 +16,10 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "curve.h"
|
#include "curve.h"
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <float.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
|
||||||
|
@ -87,7 +84,7 @@ my_acosd (real v)
|
||||||
real
|
real
|
||||||
slope (real_coordinate_type coord1, real_coordinate_type coord2)
|
slope (real_coordinate_type coord1, real_coordinate_type coord2)
|
||||||
{
|
{
|
||||||
assert (coord2.x - coord1.x != 0);
|
g_assert (coord2.x - coord1.x != 0);
|
||||||
|
|
||||||
return (coord2.y - coord1.y) / (coord2.x - coord1.x);
|
return (coord2.y - coord1.y) / (coord2.x - coord1.x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
|
|
@ -29,13 +29,11 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <types.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
|
||||||
#define SCALE_WIDTH 100
|
#define SCALE_WIDTH 100
|
||||||
#define SCALE_DIGITS 8
|
#define SCALE_DIGITS 8
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* "$Id$"
|
|
||||||
*
|
|
||||||
* SGI image file plug-in for the GIMP.
|
* SGI image file plug-in for the GIMP.
|
||||||
*
|
*
|
||||||
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
||||||
|
@ -33,11 +31,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* "$Id$"
|
|
||||||
*
|
|
||||||
* SGI image file format library definitions.
|
* SGI image file format library definitions.
|
||||||
*
|
*
|
||||||
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
||||||
|
@ -27,15 +25,6 @@
|
||||||
#ifndef _SGI_H_
|
#ifndef _SGI_H_
|
||||||
# define _SGI_H_
|
# define _SGI_H_
|
||||||
|
|
||||||
# include "config.h"
|
|
||||||
|
|
||||||
# include <stdio.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
# ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
# endif
|
|
||||||
# include <string.h>
|
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* "$Id$"
|
|
||||||
*
|
|
||||||
* SGI image file format library routines.
|
* SGI image file format library routines.
|
||||||
*
|
*
|
||||||
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
|
||||||
|
@ -38,6 +36,34 @@
|
||||||
* Revision History:
|
* Revision History:
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.9 2005/03/04 13:23:31 neo
|
||||||
|
* 2005-03-04 Sven Neumann <sven@gimp.org>
|
||||||
|
*
|
||||||
|
* * plug-ins/FractalExplorer
|
||||||
|
* * plug-ins/Lighting
|
||||||
|
* * plug-ins/bmp
|
||||||
|
* * plug-ins/dbbrowser
|
||||||
|
* * plug-ins/faxg3
|
||||||
|
* * plug-ins/fits
|
||||||
|
* * plug-ins/flame
|
||||||
|
* * plug-ins/gfig
|
||||||
|
* * plug-ins/gflare
|
||||||
|
* * plug-ins/gfli
|
||||||
|
* * plug-ins/gimpressionist
|
||||||
|
* * plug-ins/ifscompose
|
||||||
|
* * plug-ins/jpeg
|
||||||
|
* * plug-ins/maze
|
||||||
|
* * plug-ins/pagecurl
|
||||||
|
* * plug-ins/print
|
||||||
|
* * plug-ins/rcm
|
||||||
|
* * plug-ins/script-fu
|
||||||
|
* * plug-ins/sel2path
|
||||||
|
* * plug-ins/sgi
|
||||||
|
* * plug-ins/twain
|
||||||
|
* * plug-ins/winicon
|
||||||
|
* * plug-ins/xjt: ported to gstdio, removed unnecessary includes,
|
||||||
|
* minor fixes to filename handling here and there.
|
||||||
|
*
|
||||||
* Revision 1.8 2003/04/07 11:59:33 neo
|
* Revision 1.8 2003/04/07 11:59:33 neo
|
||||||
* 2003-04-07 Sven Neumann <sven@gimp.org>
|
* 2003-04-07 Sven Neumann <sven@gimp.org>
|
||||||
*
|
*
|
||||||
|
@ -73,6 +99,13 @@
|
||||||
* Initial revision
|
* Initial revision
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include "sgi.h"
|
#include "sgi.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,9 +258,9 @@ sgiOpen(char *filename, /* I - File to open */
|
||||||
|
|
||||||
|
|
||||||
if (mode == SGI_READ)
|
if (mode == SGI_READ)
|
||||||
file = fopen(filename, "rb");
|
file = g_fopen(filename, "rb");
|
||||||
else
|
else
|
||||||
file = fopen(filename, "wb+");
|
file = g_fopen(filename, "wb+");
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
|
@ -59,9 +59,15 @@
|
||||||
* images.
|
* images.
|
||||||
* (07/23/04) v0.6 Added Mac OS X support.
|
* (07/23/04) v0.6 Added Mac OS X support.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include "libgimp/gimp.h"
|
||||||
|
|
||||||
#include "tw_dump.h"
|
#include "tw_dump.h"
|
||||||
#include "tw_func.h"
|
#include "tw_func.h"
|
||||||
#include "tw_util.h"
|
#include "tw_util.h"
|
||||||
|
@ -83,7 +89,7 @@ dumpPreTransferCallback(void *clientData)
|
||||||
* write to the root directory. Simplistic, but
|
* write to the root directory. Simplistic, but
|
||||||
* gets the job done.
|
* gets the job done.
|
||||||
*/
|
*/
|
||||||
outputFile = fopen(DUMP_FILE, "wb");
|
outputFile = g_fopen(DUMP_FILE, "wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -103,14 +109,14 @@ dumpBeginTransferCallback(pTW_IMAGEINFO imageInfo, void *clientData)
|
||||||
/* Keep going */
|
/* Keep going */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dumpDataTransferCallback
|
* dumpDataTransferCallback
|
||||||
*
|
*
|
||||||
* The following function is called for each memory
|
* The following function is called for each memory
|
||||||
* block that is transferred from the data source.
|
* block that is transferred from the data source.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dumpDataTransferCallback(pTW_IMAGEINFO imageInfo,
|
dumpDataTransferCallback(pTW_IMAGEINFO imageInfo,
|
||||||
pTW_IMAGEMEMXFER imageMemXfer,
|
pTW_IMAGEMEMXFER imageMemXfer,
|
||||||
void *clientData)
|
void *clientData)
|
||||||
|
@ -130,7 +136,7 @@ dumpDataTransferCallback(pTW_IMAGEINFO imageInfo,
|
||||||
/* Keep going */
|
/* Keep going */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dumpEndTransferCallback
|
* dumpEndTransferCallback
|
||||||
*
|
*
|
||||||
|
@ -187,7 +193,7 @@ dumpPostTransferCallback(int pendingCount, void *clientData)
|
||||||
disableDS(twSession);
|
disableDS(twSession);
|
||||||
closeDS(twSession);
|
closeDS(twSession);
|
||||||
closeDSM(twSession);
|
closeDSM(twSession);
|
||||||
|
|
||||||
/* Close the dump file */
|
/* Close the dump file */
|
||||||
fclose(outputFile);
|
fclose(outputFile);
|
||||||
|
|
||||||
|
@ -217,7 +223,7 @@ void readDumpedImage(pTW_SESSION twSession)
|
||||||
* write to the root directory. Simplistic, but
|
* write to the root directory. Simplistic, but
|
||||||
* gets the job done.
|
* gets the job done.
|
||||||
*/
|
*/
|
||||||
FILE *inputFile = fopen(DUMP_FILE, "rb");
|
FILE *inputFile = g_fopen(DUMP_FILE, "rb");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inform our application that we are getting ready
|
* Inform our application that we are getting ready
|
||||||
|
@ -242,9 +248,9 @@ void readDumpedImage(pTW_SESSION twSession)
|
||||||
1, imageMemXfer.BytesWritten, inputFile);
|
1, imageMemXfer.BytesWritten, inputFile);
|
||||||
|
|
||||||
/* Call the data transfer callback function */
|
/* Call the data transfer callback function */
|
||||||
if (!(*twSession->transferFunctions->txfrDataCb)
|
if (!(*twSession->transferFunctions->txfrDataCb)
|
||||||
(&imageInfo,
|
(&imageInfo,
|
||||||
&imageMemXfer,
|
&imageMemXfer,
|
||||||
twSession->clientData))
|
twSession->clientData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#include <glib.h> /* Needed when compiling with gcc */
|
#include <glib.h> /* Needed when compiling with gcc */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -91,7 +91,7 @@ LogMessage(char *format, ...)
|
||||||
|
|
||||||
/* Open the log file as necessary */
|
/* Open the log file as necessary */
|
||||||
if (!logFile)
|
if (!logFile)
|
||||||
logFile = fopen(DEBUG_LOGFILE, "w");
|
logFile = g_fopen(DEBUG_LOGFILE, "w");
|
||||||
|
|
||||||
time_of_day = time(NULL);
|
time_of_day = time(NULL);
|
||||||
ctime_string = ctime(&time_of_day);
|
ctime_string = ctime(&time_of_day);
|
||||||
|
|
|
@ -559,13 +559,13 @@ beginTransferCallback(pTW_IMAGEINFO imageInfo, void *clientData)
|
||||||
/* Create the GIMP image */
|
/* Create the GIMP image */
|
||||||
theClientData->image_id = gimp_image_new(imageInfo->ImageWidth,
|
theClientData->image_id = gimp_image_new(imageInfo->ImageWidth,
|
||||||
imageInfo->ImageLength, imageType);
|
imageInfo->ImageLength, imageType);
|
||||||
|
|
||||||
/* Set the actual resolution */
|
/* Set the actual resolution */
|
||||||
gimp_image_set_resolution (theClientData->image_id,
|
gimp_image_set_resolution (theClientData->image_id,
|
||||||
FIX32ToFloat(imageInfo->XResolution),
|
FIX32ToFloat(imageInfo->XResolution),
|
||||||
FIX32ToFloat(imageInfo->YResolution));
|
FIX32ToFloat(imageInfo->YResolution));
|
||||||
gimp_image_set_unit (theClientData->image_id, GIMP_UNIT_INCH);
|
gimp_image_set_unit (theClientData->image_id, GIMP_UNIT_INCH);
|
||||||
|
|
||||||
/* Create a layer */
|
/* Create a layer */
|
||||||
theClientData->layer_id = gimp_layer_new(theClientData->image_id,
|
theClientData->layer_id = gimp_layer_new(theClientData->image_id,
|
||||||
_("Background"),
|
_("Background"),
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ ico_init (const gchar *filename,
|
||||||
{
|
{
|
||||||
memset (ico, 0, sizeof (MsIcon));
|
memset (ico, 0, sizeof (MsIcon));
|
||||||
|
|
||||||
if (! (ico->fp = fopen (filename, "r")))
|
if (! (ico->fp = g_fopen (filename, "r")))
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for reading: %s"),
|
g_message (_("Could not open '%s' for reading: %s"),
|
||||||
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -236,9 +237,9 @@ ico_init (const gchar *filename,
|
||||||
MsIcon *ico,
|
MsIcon *ico,
|
||||||
gint num_icons)
|
gint num_icons)
|
||||||
{
|
{
|
||||||
memset (ico, 0, sizeof(MsIcon));
|
memset (ico, 0, sizeof (MsIcon));
|
||||||
|
|
||||||
if (! (ico->fp = fopen (filename, "wb")))
|
if (! (ico->fp = g_fopen (filename, "wb")))
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for writing: %s"),
|
g_message (_("Could not open '%s' for writing: %s"),
|
||||||
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <setjmp.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
/* Include for External Libraries */
|
/* Include for External Libraries */
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
|
@ -83,12 +84,12 @@ my_error_exit (j_common_ptr cinfo)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
xjpg_load_layer (char *filename,
|
xjpg_load_layer (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
int image_type,
|
int image_type,
|
||||||
char *layer_name,
|
char *layer_name,
|
||||||
gdouble layer_opacity,
|
gdouble layer_opacity,
|
||||||
GimpLayerModeEffects layer_mode
|
GimpLayerModeEffects layer_mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GimpPixelRgn l_pixel_rgn;
|
GimpPixelRgn l_pixel_rgn;
|
||||||
|
@ -110,7 +111,7 @@ xjpg_load_layer (char *filename,
|
||||||
|
|
||||||
l_layer_type = GIMP_GRAY_IMAGE;
|
l_layer_type = GIMP_GRAY_IMAGE;
|
||||||
|
|
||||||
if ((infile = fopen (filename, "rb")) == NULL)
|
if ((infile = g_fopen (filename, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("can't open \"%s\"\n", filename);
|
g_warning ("can't open \"%s\"\n", filename);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -267,10 +268,9 @@ xjpg_load_layer (char *filename,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gint
|
gint
|
||||||
xjpg_load_layer_alpha (char *filename,
|
xjpg_load_layer_alpha (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gint32 layer_id
|
gint32 layer_id)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GimpPixelRgn l_pixel_rgn;
|
GimpPixelRgn l_pixel_rgn;
|
||||||
GimpDrawable *l_drawable;
|
GimpDrawable *l_drawable;
|
||||||
|
@ -297,7 +297,7 @@ xjpg_load_layer_alpha (char *filename,
|
||||||
/* add alpha channel */
|
/* add alpha channel */
|
||||||
gimp_layer_add_alpha (layer_id);
|
gimp_layer_add_alpha (layer_id);
|
||||||
|
|
||||||
if ((infile = fopen (filename, "rb")) == NULL)
|
if ((infile = g_fopen (filename, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
/* No alpha found, thats OK, use full opaque alpha channel
|
/* No alpha found, thats OK, use full opaque alpha channel
|
||||||
* (there is no need not store alpha channels on full opaque channels)
|
* (there is no need not store alpha channels on full opaque channels)
|
||||||
|
@ -373,7 +373,7 @@ xjpg_load_layer_alpha (char *filename,
|
||||||
|
|
||||||
/* Check if jpeg file can be used as alpha channel
|
/* Check if jpeg file can be used as alpha channel
|
||||||
*/
|
*/
|
||||||
if((cinfo.output_components != 1) ||
|
if((cinfo.output_components != 1) ||
|
||||||
(cinfo.output_width != l_drawable->width) ||
|
(cinfo.output_width != l_drawable->width) ||
|
||||||
(cinfo.output_height != l_drawable->height))
|
(cinfo.output_height != l_drawable->height))
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@ xjpg_load_layer_alpha (char *filename,
|
||||||
fclose (infile);
|
fclose (infile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buffer to read in the layer and merge with the alpha from jpeg file */
|
/* buffer to read in the layer and merge with the alpha from jpeg file */
|
||||||
l_dstbuf = g_new (guchar, l_tile_height * l_drawable->width * l_drawable->bpp);
|
l_dstbuf = g_new (guchar, l_tile_height * l_drawable->width * l_drawable->bpp);
|
||||||
|
|
||||||
|
@ -466,13 +466,12 @@ xjpg_load_layer_alpha (char *filename,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
xjpg_load_channel (char *filename,
|
xjpg_load_channel (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gint32 drawable_id,
|
gint32 drawable_id,
|
||||||
char *channel_name,
|
char *channel_name,
|
||||||
gdouble channel_opacity,
|
gdouble channel_opacity,
|
||||||
guchar red, guchar green, guchar blue
|
guchar red, guchar green, guchar blue)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GimpPixelRgn l_pixel_rgn;
|
GimpPixelRgn l_pixel_rgn;
|
||||||
GimpDrawable *l_drawable;
|
GimpDrawable *l_drawable;
|
||||||
|
@ -493,7 +492,7 @@ xjpg_load_channel (char *filename,
|
||||||
cinfo.err = jpeg_std_error (&jerr.pub);
|
cinfo.err = jpeg_std_error (&jerr.pub);
|
||||||
jerr.pub.error_exit = my_error_exit;
|
jerr.pub.error_exit = my_error_exit;
|
||||||
|
|
||||||
if ((infile = fopen (filename, "rb")) == NULL)
|
if ((infile = g_fopen (filename, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("can't open \"%s\"\n", filename);
|
g_warning ("can't open \"%s\"\n", filename);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -586,7 +585,7 @@ xjpg_load_channel (char *filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
l_drawable = gimp_drawable_get (l_drawable_id);
|
l_drawable = gimp_drawable_get (l_drawable_id);
|
||||||
|
|
||||||
if((l_drawable->width != cinfo.output_width)
|
if((l_drawable->width != cinfo.output_width)
|
||||||
|| (l_drawable->height != cinfo.output_height)
|
|| (l_drawable->height != cinfo.output_height)
|
||||||
|| (l_drawable->bpp != cinfo.output_components) )
|
|| (l_drawable->bpp != cinfo.output_components) )
|
||||||
|
@ -664,17 +663,17 @@ xjpg_load_channel (char *filename,
|
||||||
* - save the drawable without alpha channel.
|
* - save the drawable without alpha channel.
|
||||||
* (optional clear full transparent pixels to 0,
|
* (optional clear full transparent pixels to 0,
|
||||||
* resulting in better compression)
|
* resulting in better compression)
|
||||||
* - save the alpha channel
|
* - save the alpha channel
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
xjpg_save_drawable (char *filename,
|
xjpg_save_drawable (const char *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID,
|
gint32 drawable_ID,
|
||||||
gint save_mode,
|
gint save_mode,
|
||||||
t_JpegSaveVals *jsvals)
|
t_JpegSaveVals *jsvals)
|
||||||
{
|
{
|
||||||
GimpPixelRgn pixel_rgn;
|
GimpPixelRgn pixel_rgn;
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
@ -698,7 +697,7 @@ xjpg_save_drawable (char *filename,
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
data = NULL;
|
data = NULL;
|
||||||
l_alpha_sum = 0xff;
|
l_alpha_sum = 0xff;
|
||||||
|
|
||||||
drawable = gimp_drawable_get (drawable_ID);
|
drawable = gimp_drawable_get (drawable_ID);
|
||||||
drawable_type = gimp_drawable_type (drawable_ID);
|
drawable_type = gimp_drawable_type (drawable_ID);
|
||||||
switch (drawable_type)
|
switch (drawable_type)
|
||||||
|
@ -711,7 +710,7 @@ xjpg_save_drawable (char *filename,
|
||||||
case GIMP_RGBA_IMAGE:
|
case GIMP_RGBA_IMAGE:
|
||||||
case GIMP_GRAYA_IMAGE:
|
case GIMP_GRAYA_IMAGE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_INDEXED_IMAGE:
|
case GIMP_INDEXED_IMAGE:
|
||||||
/*g_message ("jpeg: cannot operate on indexed color images");*/
|
/*g_message ("jpeg: cannot operate on indexed color images");*/
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -764,7 +763,7 @@ xjpg_save_drawable (char *filename,
|
||||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
||||||
* requires it in order to write binary files.
|
* requires it in order to write binary files.
|
||||||
*/
|
*/
|
||||||
if ((outfile = fopen (filename, "wb")) == NULL)
|
if ((outfile = g_fopen (filename, "wb")) == NULL)
|
||||||
{
|
{
|
||||||
g_message ("can't open %s\n", filename);
|
g_message ("can't open %s\n", filename);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -846,7 +845,7 @@ xjpg_save_drawable (char *filename,
|
||||||
temp = (guchar *) g_malloc (cinfo.image_width * cinfo.input_components);
|
temp = (guchar *) g_malloc (cinfo.image_width * cinfo.input_components);
|
||||||
data = (guchar *) g_malloc (rowstride * gimp_tile_height ());
|
data = (guchar *) g_malloc (rowstride * gimp_tile_height ());
|
||||||
src = data;
|
src = data;
|
||||||
|
|
||||||
while (cinfo.next_scanline < cinfo.image_height)
|
while (cinfo.next_scanline < cinfo.image_height)
|
||||||
{
|
{
|
||||||
if ((cinfo.next_scanline % gimp_tile_height ()) == 0)
|
if ((cinfo.next_scanline % gimp_tile_height ()) == 0)
|
||||||
|
@ -927,7 +926,7 @@ xjpg_save_drawable (char *filename,
|
||||||
* == full opaque image. We can remove the file
|
* == full opaque image. We can remove the file
|
||||||
* to save diskspace
|
* to save diskspace
|
||||||
*/
|
*/
|
||||||
remove(filename);
|
g_remove(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 7: release JPEG compression object */
|
/* Step 7: release JPEG compression object */
|
||||||
|
|
|
@ -47,35 +47,32 @@ typedef struct
|
||||||
} t_JpegSaveVals;
|
} t_JpegSaveVals;
|
||||||
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
xjpg_save_drawable (char *filename,
|
xjpg_save_drawable (const char *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID,
|
gint32 drawable_ID,
|
||||||
gint save_mode,
|
gint save_mode,
|
||||||
t_JpegSaveVals *jsvals);
|
t_JpegSaveVals *jsvals);
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
xjpg_load_layer (char *filename,
|
xjpg_load_layer (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
int image_type,
|
int image_type,
|
||||||
char *layer_name,
|
char *layer_name,
|
||||||
gdouble layer_opacity,
|
gdouble layer_opacity,
|
||||||
GimpLayerModeEffects layer_mode
|
GimpLayerModeEffects layer_mode);
|
||||||
);
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
xjpg_load_layer_alpha (char *filename,
|
xjpg_load_layer_alpha (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gint32 layer_id
|
gint32 layer_id);
|
||||||
);
|
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
xjpg_load_channel (char *filename,
|
xjpg_load_channel (const char *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gint32 drawable_id,
|
gint32 drawable_id,
|
||||||
char *channel_name,
|
char *channel_name,
|
||||||
gdouble channel_opacity,
|
gdouble channel_opacity,
|
||||||
guchar red, guchar green, guchar blue
|
guchar red, guchar green, guchar blue);
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -66,7 +65,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -74,9 +74,6 @@
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <process.h> /* getpid() */
|
#include <process.h> /* getpid() */
|
||||||
#include <direct.h> /* _mkdir */
|
|
||||||
#define mkdir(path,mode) _mkdir(path)
|
|
||||||
#define mode_t int
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XJT includes */
|
/* XJT includes */
|
||||||
|
@ -1634,7 +1631,6 @@ save_xjt_image (const gchar *filename,
|
||||||
gchar *l_jpg_file;
|
gchar *l_jpg_file;
|
||||||
gchar *l_cmd;
|
gchar *l_cmd;
|
||||||
FILE *l_fp_prp;
|
FILE *l_fp_prp;
|
||||||
mode_t l_mode_dir;
|
|
||||||
|
|
||||||
GimpImageBaseType l_image_type;
|
GimpImageBaseType l_image_type;
|
||||||
gint32 *l_layers_list;
|
gint32 *l_layers_list;
|
||||||
|
@ -1690,8 +1686,7 @@ save_xjt_image (const gchar *filename,
|
||||||
/* create temporary directory */
|
/* create temporary directory */
|
||||||
l_dirname = gimp_temp_name (".tmpdir");
|
l_dirname = gimp_temp_name (".tmpdir");
|
||||||
l_prop_file = g_strdup_printf ("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
|
l_prop_file = g_strdup_printf ("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
|
||||||
l_mode_dir = 0777;
|
if (g_mkdir (l_dirname, 0777) != 0)
|
||||||
if (mkdir (l_dirname, l_mode_dir) != 0)
|
|
||||||
{
|
{
|
||||||
g_message (_("Could not create working folder '%s': %s"),
|
g_message (_("Could not create working folder '%s': %s"),
|
||||||
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));
|
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));
|
||||||
|
@ -1699,7 +1694,7 @@ save_xjt_image (const gchar *filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create property file PRP */
|
/* create property file PRP */
|
||||||
l_fp_prp = fopen (l_prop_file, "w");
|
l_fp_prp = g_fopen (l_prop_file, "w");
|
||||||
if (l_fp_prp == NULL)
|
if (l_fp_prp == NULL)
|
||||||
{
|
{
|
||||||
g_message (_("Could not open '%s' for writing: %s"),
|
g_message (_("Could not open '%s' for writing: %s"),
|
||||||
|
@ -3282,7 +3277,6 @@ load_xjt_image (const gchar *filename)
|
||||||
gchar *l_prop_file;
|
gchar *l_prop_file;
|
||||||
gchar *l_jpg_file;
|
gchar *l_jpg_file;
|
||||||
gchar *l_cmd;
|
gchar *l_cmd;
|
||||||
mode_t l_mode_dir;
|
|
||||||
|
|
||||||
gint32 *l_layers_list;
|
gint32 *l_layers_list;
|
||||||
gint32 *l_channels_list;
|
gint32 *l_channels_list;
|
||||||
|
@ -3318,8 +3312,8 @@ load_xjt_image (const gchar *filename)
|
||||||
/* create temporary directory */
|
/* create temporary directory */
|
||||||
l_dirname = gimp_temp_name (".tmpdir");
|
l_dirname = gimp_temp_name (".tmpdir");
|
||||||
l_prop_file = g_strdup_printf("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
|
l_prop_file = g_strdup_printf("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
|
||||||
l_mode_dir = 0777;
|
|
||||||
if(mkdir(l_dirname, l_mode_dir) != 0)
|
if(g_mkdir(l_dirname, 0777) != 0)
|
||||||
{
|
{
|
||||||
g_message (_("Could not create working folder '%s': %s"),
|
g_message (_("Could not create working folder '%s': %s"),
|
||||||
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));
|
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));
|
||||||
|
|
Loading…
Reference in New Issue