gimp/plug-ins/bmp/bmpwrite.c

606 lines
15 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* bmpwrite.c Writes Bitmap files. Even RLE encoded ones. */
/* (Windows (TM) doesn't read all of those, but who */
/* cares? ;-) */
/* I changed a few things over the time, so perhaps */
/* it dos now, but now there's no Windows left on */
/* my computer... */
1997-11-25 06:05:25 +08:00
/* Alexander.Schulz@stud.uni-karlsruhe.de */
/*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* ----------------------------------------------------------------------------
*/
New file. * plug-ins/makefile.msc: New file. * plug-ins/*/*.c (Well, not really all files, but many): Portability fixes. Include config.h, and guard inclusion of POSIX and Unix headers like <unistd.h>, <dirent.h> and <sys/time.h>. Include <string.h> if functions from it are used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(), thus no need to include <netinet/in.h>. Include <io.h> on Win32 when using open/read/write (which actually are defined as _open/_read/_write by glib.h). Define S_* macros if necessary on Win32. Define rint() and M_PI if necessary (these definitions should be factored out somewhere, no sense repeating them in lots of files). Open files in binary mode when needed. * plug-ins/FractalExplorer/FractalExplorer.c: Use g_malloc()/g_free(). Use g_strdup_printf(). * plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>. * plug-ins/destripe/destripe.c: Guard use of SIGBUS. * plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for NULL returns from g_malloc() and g_new() as they abort on failure. Use g_strdup_printf(). * plug-ins/gz/gz.c: Win32 version of running the subprocess. * plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for non-Unix (OS/2 and Win32), for instance HAVE_MMAP. * plug-ins/script-fu/interp_slib.c: Win32 version of myruntime(). * plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh). * plug-ins/script-fu/script-fu-console.c: Bypass on Win32. * plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use g_strdup_printf() instead of separate malloc() and sprintf(). Use g_strescape() for strings being passed to Scheme. Some Win32-only stuff.
1999-05-29 09:28:24 +08:00
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
New file. * plug-ins/makefile.msc: New file. * plug-ins/*/*.c (Well, not really all files, but many): Portability fixes. Include config.h, and guard inclusion of POSIX and Unix headers like <unistd.h>, <dirent.h> and <sys/time.h>. Include <string.h> if functions from it are used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(), thus no need to include <netinet/in.h>. Include <io.h> on Win32 when using open/read/write (which actually are defined as _open/_read/_write by glib.h). Define S_* macros if necessary on Win32. Define rint() and M_PI if necessary (these definitions should be factored out somewhere, no sense repeating them in lots of files). Open files in binary mode when needed. * plug-ins/FractalExplorer/FractalExplorer.c: Use g_malloc()/g_free(). Use g_strdup_printf(). * plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>. * plug-ins/destripe/destripe.c: Guard use of SIGBUS. * plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for NULL returns from g_malloc() and g_new() as they abort on failure. Use g_strdup_printf(). * plug-ins/gz/gz.c: Win32 version of running the subprocess. * plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for non-Unix (OS/2 and Win32), for instance HAVE_MMAP. * plug-ins/script-fu/interp_slib.c: Win32 version of myruntime(). * plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh). * plug-ins/script-fu/script-fu-console.c: Bypass on Win32. * plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use g_strdup_printf() instead of separate malloc() and sprintf(). Use g_strescape() for strings being passed to Scheme. Some Win32-only stuff.
1999-05-29 09:28:24 +08:00
#ifdef HAVE_UNISTD_H
#include <unistd.h>
New file. * plug-ins/makefile.msc: New file. * plug-ins/*/*.c (Well, not really all files, but many): Portability fixes. Include config.h, and guard inclusion of POSIX and Unix headers like <unistd.h>, <dirent.h> and <sys/time.h>. Include <string.h> if functions from it are used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(), thus no need to include <netinet/in.h>. Include <io.h> on Win32 when using open/read/write (which actually are defined as _open/_read/_write by glib.h). Define S_* macros if necessary on Win32. Define rint() and M_PI if necessary (these definitions should be factored out somewhere, no sense repeating them in lots of files). Open files in binary mode when needed. * plug-ins/FractalExplorer/FractalExplorer.c: Use g_malloc()/g_free(). Use g_strdup_printf(). * plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>. * plug-ins/destripe/destripe.c: Guard use of SIGBUS. * plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for NULL returns from g_malloc() and g_new() as they abort on failure. Use g_strdup_printf(). * plug-ins/gz/gz.c: Win32 version of running the subprocess. * plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for non-Unix (OS/2 and Win32), for instance HAVE_MMAP. * plug-ins/script-fu/interp_slib.c: Win32 version of myruntime(). * plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh). * plug-ins/script-fu/script-fu-console.c: Bypass on Win32. * plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use g_strdup_printf() instead of separate malloc() and sprintf(). Use g_strescape() for strings being passed to Scheme. Some Win32-only stuff.
1999-05-29 09:28:24 +08:00
#endif
1997-11-25 06:05:25 +08:00
#include <gtk/gtk.h>
1997-11-25 06:05:25 +08:00
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
1997-11-25 06:05:25 +08:00
#include "bmp.h"
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
#include "libgimp/stdplugins-intl.h"
1997-11-25 06:05:25 +08:00
guchar *pixels;
gint cur_progress;
1997-11-25 06:05:25 +08:00
gint max_progress;
1997-11-25 06:05:25 +08:00
typedef struct
{
gint run;
} BMPSaveInterface;
1997-11-25 06:05:25 +08:00
static BMPSaveInterface gsint =
1997-11-25 06:05:25 +08:00
{
FALSE /* run */
};
gint encoded = 0;
1997-11-25 06:05:25 +08:00
static gint save_dialog (void);
static void save_ok_callback (GtkWidget *widget,
gpointer data);
1997-11-25 06:05:25 +08:00
GimpPDBStatusType
WriteBMP (gchar *filename,
gint32 image,
gint32 drawable_ID)
1997-11-25 06:05:25 +08:00
{
FILE *outfile;
gint Red[MAXCOLORS];
gint Green[MAXCOLORS];
gint Blue[MAXCOLORS];
guchar *cmap;
gint rows, cols, Spcols, channels, MapSize, SpZeile;
glong BitsPerPixel;
gint colors;
gchar *temp_buf;
guchar *pixels;
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
GimpImageType drawable_type;
1998-03-17 17:39:40 +08:00
guchar puffer[50];
gint i;
1997-11-25 06:05:25 +08:00
/* first: can we save this image? */
drawable = gimp_drawable_get(drawable_ID);
drawable_type = gimp_drawable_type(drawable_ID);
gimp_pixel_rgn_init (&pixel_rgn, drawable,
0, 0, drawable->width, drawable->height, FALSE, FALSE);
1997-11-25 06:05:25 +08:00
switch (drawable_type)
{
case GIMP_RGB_IMAGE:
case GIMP_GRAY_IMAGE:
case GIMP_INDEXED_IMAGE:
1997-11-25 06:05:25 +08:00
break;
default:
g_message(_("BMP: cannot operate on unknown image types or alpha images"));
return GIMP_PDB_EXECUTION_ERROR;
1997-11-25 06:05:25 +08:00
break;
}
/* We can save it. So what colors do we use? */
switch (drawable_type)
{
case GIMP_RGB_IMAGE:
colors = 0;
1997-11-25 06:05:25 +08:00
BitsPerPixel = 24;
MapSize = 0;
channels = 3;
1997-11-25 06:05:25 +08:00
break;
case GIMP_GRAY_IMAGE:
colors = 256;
BitsPerPixel = 8;
MapSize = 1024;
channels = 1;
1997-11-25 06:05:25 +08:00
for (i = 0; i < colors; i++)
{
Red[i] = i;
1997-11-25 06:05:25 +08:00
Green[i] = i;
Blue[i] = i;
1997-11-25 06:05:25 +08:00
}
break;
case GIMP_INDEXED_IMAGE:
cmap = gimp_image_get_cmap (image, &colors);
MapSize = 4 * colors;
1997-11-25 06:05:25 +08:00
channels = 1;
if (colors > 16)
BitsPerPixel = 8;
else if (colors > 2)
BitsPerPixel = 4;
else
BitsPerPixel = 1;
1997-11-25 06:05:25 +08:00
for (i = 0; i < colors; i++)
{
Red[i] = *cmap++;
1997-11-25 06:05:25 +08:00
Green[i] = *cmap++;
Blue[i] = *cmap++;
1997-11-25 06:05:25 +08:00
}
break;
default:
fprintf (stderr, "%s: This should not happen\n", prog_name);
return GIMP_PDB_EXECUTION_ERROR;
1997-11-25 06:05:25 +08:00
}
/* Perhaps someone wants RLE encoded Bitmaps */
encoded = 0;
if ((BitsPerPixel == 8 || BitsPerPixel == 4) && interactive_bmp)
{
if (! save_dialog ())
return GIMP_PDB_CANCEL;
}
/* Let's take some file */
1997-11-25 06:05:25 +08:00
outfile = fopen (filename, "wb");
if (!outfile)
{
g_message (_("Can't open %s"), filename);
return GIMP_PDB_EXECUTION_ERROR;
1997-11-25 06:05:25 +08:00
}
1997-11-25 06:05:25 +08:00
/* fetch the image */
pixels = g_new (guchar, drawable->width * drawable->height * channels);
gimp_pixel_rgn_get_rect (&pixel_rgn, pixels,
0, 0, drawable->width, drawable->height);
1997-11-25 06:05:25 +08:00
/* And let's begin the progress */
1998-03-17 17:39:40 +08:00
if (interactive_bmp)
{
temp_buf = g_strdup_printf (_("Saving %s:"), filename);
1998-03-17 17:39:40 +08:00
gimp_progress_init (temp_buf);
g_free (temp_buf);
}
1997-11-25 06:05:25 +08:00
cur_progress = 0;
max_progress = drawable->height;
1997-11-25 06:05:25 +08:00
/* Now, we need some further information ... */
cols = drawable->width;
rows = drawable->height;
1997-11-25 06:05:25 +08:00
/* ... that we write to our headers. */
if ((BitsPerPixel != 24) &&
(cols % (8/BitsPerPixel)))
Spcols = (((cols / (8 / BitsPerPixel)) + 1) * (8 / BitsPerPixel));
else
Spcols = cols;
if ((((Spcols * BitsPerPixel) / 8) % 4) == 0)
SpZeile = ((Spcols * BitsPerPixel) / 8);
else
SpZeile = ((gint) (((Spcols * BitsPerPixel) / 8) / 4) + 1) * 4;
Bitmap_File_Head.bfSize = 0x36 + MapSize + (rows * SpZeile);
Bitmap_File_Head.zzHotX = 0;
Bitmap_File_Head.zzHotY = 0;
Bitmap_File_Head.bfOffs = 0x36 + MapSize;
Bitmap_File_Head.biSize = 40;
Bitmap_Head.biWidth = cols;
Bitmap_Head.biHeight = rows;
Bitmap_Head.biPlanes = 1;
Bitmap_Head.biBitCnt = BitsPerPixel;
if (encoded == 0)
Bitmap_Head.biCompr = 0;
else if (BitsPerPixel == 8)
Bitmap_Head.biCompr = 1;
else if (BitsPerPixel == 4)
Bitmap_Head.biCompr = 2;
else
Bitmap_Head.biCompr = 0;
Bitmap_Head.biSizeIm = SpZeile * rows;
{
gdouble xresolution;
gdouble yresolution;
gimp_image_get_resolution (image, &xresolution, &yresolution);
if (xresolution > GIMP_MIN_RESOLUTION &&
yresolution > GIMP_MIN_RESOLUTION)
{
/*
* xresolution and yresolution are in dots per inch.
* the BMP spec says that biXPels and biYPels are in
* pixels per meter as long ints (actually, "DWORDS"),
* so...
* n dots inch 100 cm m dots
* ------ * ------- * ------ = ------
* inch 2.54 cm m inch
*/
Bitmap_Head.biXPels = (long int) xresolution * 100.0 / 2.54;
Bitmap_Head.biYPels = (long int) yresolution * 100.0 / 2.54;
}
}
if (BitsPerPixel < 24)
Bitmap_Head.biClrUsed = colors;
else
Bitmap_Head.biClrUsed = 0;
Bitmap_Head.biClrImp = Bitmap_Head.biClrUsed;
1997-11-25 06:05:25 +08:00
#ifdef DEBUG
printf("\nSize: %u, Colors: %u, Bits: %u, Width: %u, Height: %u, Comp: %u, Zeile: %u\n",
(int)Bitmap_File_Head.bfSize,(int)Bitmap_Head.biClrUsed,Bitmap_Head.biBitCnt,(int)Bitmap_Head.biWidth,
(int)Bitmap_Head.biHeight, (int)Bitmap_Head.biCompr,SpZeile);
1997-11-25 06:05:25 +08:00
#endif
/* And now write the header and the colormap (if any) to disk */
Write (outfile, "BM", 2);
FromL (Bitmap_File_Head.bfSize, &puffer[0x00]);
FromS (Bitmap_File_Head.zzHotX, &puffer[0x04]);
FromS (Bitmap_File_Head.zzHotY, &puffer[0x06]);
FromL (Bitmap_File_Head.bfOffs, &puffer[0x08]);
FromL (Bitmap_File_Head.biSize, &puffer[0x0C]);
Write (outfile, puffer, 16);
FromL (Bitmap_Head.biWidth, &puffer[0x00]);
FromL (Bitmap_Head.biHeight, &puffer[0x04]);
FromS (Bitmap_Head.biPlanes, &puffer[0x08]);
FromS (Bitmap_Head.biBitCnt, &puffer[0x0A]);
FromL (Bitmap_Head.biCompr, &puffer[0x0C]);
FromL (Bitmap_Head.biSizeIm, &puffer[0x10]);
FromL (Bitmap_Head.biXPels, &puffer[0x14]);
FromL (Bitmap_Head.biYPels, &puffer[0x18]);
FromL (Bitmap_Head.biClrUsed, &puffer[0x1C]);
FromL (Bitmap_Head.biClrImp, &puffer[0x20]);
Write (outfile, puffer, 36);
WriteColorMap (outfile, Red, Green, Blue, MapSize);
1997-11-25 06:05:25 +08:00
/* After that is done, we write the image ... */
WriteImage (outfile,
pixels, cols, rows,
encoded, channels, BitsPerPixel, SpZeile, MapSize);
1997-11-25 06:05:25 +08:00
/* ... and exit normally */
fclose (outfile);
gimp_drawable_detach (drawable);
g_free (pixels);
return GIMP_PDB_SUCCESS;
1997-11-25 06:05:25 +08:00
}
void
WriteColorMap (FILE *f,
gint red[MAXCOLORS],
gint green[MAXCOLORS],
gint blue[MAXCOLORS],
gint size)
1997-11-25 06:05:25 +08:00
{
gchar trgb[4];
gint i;
size /= 4;
trgb[3] = 0;
for (i = 0; i < size; i++)
1997-11-25 06:05:25 +08:00
{
trgb[0] = (guchar) blue[i];
trgb[1] = (guchar) green[i];
trgb[2] = (guchar) red[i];
Write (f, trgb, 4);
1997-11-25 06:05:25 +08:00
}
}
void
WriteImage (FILE *f,
guchar *src,
gint width,
gint height,
gint encoded,
gint channels,
gint bpp,
gint spzeile,
gint MapSize)
1997-11-25 06:05:25 +08:00
{
guchar buf[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0};
guchar puffer[8];
guchar *temp, v;
guchar *Zeile, *ketten;
gint xpos, ypos, i, j, rowstride, laenge, thiswidth;
gint breite, n, k;
xpos = 0;
rowstride = width * channels;
1997-11-25 06:05:25 +08:00
/* We'll begin with the 24 bit Bitmaps, they are easy :-) */
if (bpp == 24)
1997-11-25 06:05:25 +08:00
{
for (ypos = height - 1; ypos >= 0; ypos--) /* for each row */
{
for (i = 0; i < width; i++) /* for each pixel */
{
temp = src + (ypos * rowstride) + (xpos * channels);
buf[2] = (guchar) *temp;
temp++;
buf[1] = (guchar) *temp;
temp++;
buf[0] = (guchar) *temp;
xpos++;
Write (f, buf, 3);
}
Write (f, &buf[3], spzeile - (width * 3));
cur_progress++;
if ((interactive_bmp) &&
((cur_progress % 5) == 0))
gimp_progress_update ((gdouble) cur_progress /
(gdouble) max_progress);
xpos = 0;
}
}
else
{
switch (encoded) /* now it gets more difficult */
{ /* uncompressed 1,4 and 8 bit */
case 0:
{
thiswidth = (width / (8 / bpp));
if (width % (8 / bpp))
thiswidth++;
for (ypos = height - 1; ypos >= 0; ypos--) /* for each row */
{
for (xpos = 0; xpos < width;) /* for each _byte_ */
{
v = 0;
for (i = 1;
(i <= (8 / bpp)) && (xpos < width);
i++, xpos++) /* for each pixel */
{
temp = src + (ypos * rowstride) + (xpos * channels);
v=v | ((guchar) *temp << (8 - (i * bpp)));
}
Write (f, &v, 1);
}
Write (f, &buf[3], spzeile - thiswidth);
xpos = 0;
cur_progress++;
if ((interactive_bmp) &&
((cur_progress % 5) == 0))
gimp_progress_update ((gdouble) cur_progress /
(gdouble) max_progress);
}
break;
}
default:
{ /* Save RLE encoded file, quite difficult */
laenge = 0;
buf[12] = 0;
buf[13] = 1;
buf[14] = 0;
buf[15] = 0;
Zeile = (guchar *) g_malloc (width / (8 / bpp) + 10);
ketten = (guchar *) g_malloc (width / (8 / bpp) + 10);
for (ypos = height - 1; ypos >= 0; ypos--)
{ /* each row separately */
/*printf("Line: %i\n",ypos); */
j = 0;
/* first copy the pixels to a buffer,
* making one byte from two 4bit pixels
*/
for (xpos = 0; xpos < width;)
{
v = 0;
for (i = 1;
(i <= (8 / bpp)) && (xpos < width);
i++, xpos++)
{ /* for each pixel */
temp = src + (ypos * rowstride) + (xpos * channels);
v = v | ((guchar) * temp << (8 - (i * bpp)));
}
Zeile[j++] = v;
}
breite = width / (8 / bpp);
if (width % (8 / bpp))
breite++;
/* then check for strings of equal bytes */
for (i = 0; i < breite;)
{
j = 0;
while ((i + j < breite) &&
(j < (255 / (8 / bpp))) &&
(Zeile[i + j] == Zeile[i]))
j++;
ketten[i] = j;
/*printf("%i:",ketten[i]); */
i += j;
}
/*printf("\n"); */
/* then write the strings and the other pixels to the file */
for (i = 0; i < breite;)
{
if (ketten[i] < 3)
/* strings of different pixels ... */
{
j = 0;
while ((i + j < breite) &&
(j < (255 / (8 / bpp))) &&
(ketten[i + j] < 3))
j += ketten[i + j];
/* this can only happen if j jumps over
* the end with a 2 in ketten[i+j]
*/
if (j > (255 / (8 / bpp)))
j -= 2;
/* 00 01 and 00 02 are reserved */
if (j > 2)
{
Write (f, &buf[12], 1);
n = j * (8 / bpp);
if (n + i * (8 / bpp) > width)
n--;
Write (f, &n, 1);
laenge += 2;
Write (f, &Zeile[i], j);
/*printf("0.%i.",n); */
/*for (k=j;k;k--) printf("#"); */
laenge += j;
if ((j) % 2)
{
Write (f, &buf[12], 1);
laenge++;
/*printf("0"); */
}
/*printf("|"); */
}
else
{
for (k = i; k < i + j; k++)
{
n = (8 / bpp);
if (n + i * (8 / bpp) > width)
n--;
Write (f, &n, 1);
Write (f, &Zeile[k], 1);
/*printf("%i.#|",n); */
laenge += 2;
}
}
i += j;
}
else
/* strings of equal pixels */
{
n = ketten[i] * (8 / bpp);
if (n + i * (8 / bpp) > width)
n--;
Write (f, &n, 1);
Write (f, &Zeile[i], 1);
/*printf("%i.#|",n); */
i += ketten[i];
laenge += 2;
}
}
/*printf("\n"); */
Write (f, &buf[14], 2); /* End of row */
laenge += 2;
cur_progress++;
if ((interactive_bmp) &&
((cur_progress % 5) == 0))
gimp_progress_update ((gdouble) cur_progress /
(gdouble) max_progress);
}
fseek (f, -2, SEEK_CUR); /* Overwrite last End of row ... */
Write (f, &buf[12], 2); /* ... with End of file */
fseek (f, 0x22, SEEK_SET); /* Write length of image */
FromL (laenge, puffer);
Write (f, puffer, 4);
fseek (f, 0x02, SEEK_SET); /* Write length of file */
laenge += (0x36 + MapSize);
FromL (laenge, puffer);
Write (f, puffer, 4);
g_free (ketten);
g_free (Zeile);
break;
}
}
1997-11-25 06:05:25 +08:00
}
if (interactive_bmp)
gimp_progress_update (1);
1997-11-25 06:05:25 +08:00
}
static gint
save_dialog (void)
1997-11-25 06:05:25 +08:00
{
GtkWidget *dlg;
GtkWidget *toggle;
GtkWidget *frame;
GtkWidget *vbox;
dlg = gimp_dialog_new (_("Save as BMP"), "bmp",
gimp_standard_help_func, "filters/bmp.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("OK"), save_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
_("Cancel"), gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
NULL);
1997-11-25 06:05:25 +08:00
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
1997-11-25 06:05:25 +08:00
NULL);
/* parameter settings */
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
frame = gtk_frame_new (_("Save Options"));
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
1997-11-25 06:05:25 +08:00
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
vbox = gtk_vbox_new (FALSE, 2);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
1997-11-25 06:05:25 +08:00
gtk_container_add (GTK_CONTAINER (frame), vbox);
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
toggle = gtk_check_button_new_with_label (_("RLE encoded"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
1997-11-25 06:05:25 +08:00
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
1997-11-25 06:05:25 +08:00
&encoded);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), encoded);
1997-11-25 06:05:25 +08:00
gtk_widget_show (toggle);
gtk_widget_show (vbox);
gtk_widget_show (frame);
gtk_widget_show (dlg);
gtk_main ();
gdk_flush ();
1997-11-25 06:05:25 +08:00
return gsint.run;
}
static void
save_ok_callback (GtkWidget *widget,
gpointer data)
{
gsint.run = TRUE;
1997-11-25 06:05:25 +08:00
gtk_widget_destroy (GTK_WIDGET (data));
}