Makefile.am new file, explains i18n stuff

* Makefile.am
        * README.i18n: new file, explains i18n stuff

        * plug-ins/script-fu/scripts/(lots of files): applied
        gimp-ruth-981108-0, use nice SF-FONT and SF-FILENAME stuff

        * plug-ins/png/png.c: applied gimp-ruth-981108-1, fixes loader for
        some indexed pngs. Also default to level 6 compression, level 9
        compression is cpu hungry and isn't much of a win compared to 6.

        * plug-ins/tiff/tiff.c: applied gimp-ruth-981108-2, major tiff
        rework

-Yosh
This commit is contained in:
Manish Singh 1998-11-09 02:05:24 +00:00
parent f3fe31a693
commit 0771da2452
50 changed files with 1203 additions and 521 deletions

View File

@ -1,3 +1,18 @@
Sun Nov 8 17:51:52 PST 1998 Manish Singh <yosh@gimp.org>
* Makefile.am
* README.i18n: new file, explains i18n stuff
* plug-ins/script-fu/scripts/(lots of files): applied
gimp-ruth-981108-0, use nice SF-FONT and SF-FILENAME stuff
* plug-ins/png/png.c: applied gimp-ruth-981108-1, fixes loader for
some indexed pngs. Also default to level 6 compression, level 9
compression is cpu hungry and isn't much of a win compared to 6.
* plug-ins/tiff/tiff.c: applied gimp-ruth-981108-2, major tiff
rework
1998-11-08 Raja R Harinath <harinath@cs.umn.edu>
* configure.in (sendmail_path): Prefer /usr/sbin/sendmail to

View File

@ -5,6 +5,7 @@ SUBDIRS = po intl libgimp plug-ins app data
bin_SCRIPTS = gimptool
EXTRA_DIST = \
README.i18n \
MAINTAINERS \
TODO \
gtkrc \

141
README.i18n Normal file
View File

@ -0,0 +1,141 @@
This document exists to document the important things to care for
because of locale support.
Actually this one is maintained by me, that is Daniel Egger
(Daniel.Egger@t-online.de).
1. Why localisation?
Many persons from many countries start to get used to Linux.
Unfortunately not everyone is able to understand English. But
even those people some times like to use good software without
needing a dictionary beneath them.
So why not simply localise the software to make it available to
the mass which isn't wholly English native?
2. How?
GNU provides a very nice package called gettext. This one offers
the possibility to translate chosen messages from the native language
of the program into that one of the users if a necessary catalog is
provided. Gettext therefor provides some easy tools to create and maintain
such catalogs and a few functions which can be called by the program to
enable automatic translation. The program gets linked to gettext and
everything is fine.
By the way: gettext is a fixed part of glibc2 but will be shipped with
GIMP and so can be automatically compiled on every platform GIMP itself
runs on.
3. Deep inside...
GIMP provides a header file called gimpintl.h in the libgimp directory this
one checks whether gettext is available on the system and will deactivate
language support if it's not.
If it is useable it will define 3 functions which will be described below.
3.1 _() [more correctly: char * _( char * )]
This one is a macro for the function gettext(). With it every text may be
wrapped that is directly called directly in a function. If you use it the
given string will be tried to get translated in the native language of the
user according to his/her environmental settings.
The gettext function will do a lookup in the hashed gimp.mo which contains
all the translated texts.
- If it is found a pointer to the string will be returned to the caller.
- If not the caller will receive a pointer to the original string.
This way it is ensured that there isn't any harm caused to the program
(i.e. The GIMP) if no catalog isn't installed.
Please note that it is important to use _() directly (and not gettext())
for simple messages because of reasons that will be mentioned below.
3.2 N_() [more correctly: void ( void ) ]
This one is a macro for the function gettext_noop(). As you can see and
guess it doesn't really anything in the programm i.e. it is a dummy
function but nevertheless important. As it isn't possible to call functions
in a structure as seen here:
struct blurb
{
_("This won't work\n");
}
you have to do it in some other way. In GIMP such structures are often used
to create menues or similar things very simply. Here you have to use the
dummy to allow the generation of a template which will be described below.
This one doesn't do anything but it marks the text as important to the
gettext extractor.
The text has to be translated "by hand" with the next function.
3.3 gettext()
This function is the same as that mcaro in 3.1. But there is one big
difference: It is ignored by the gettext program which will create message
templates for us.
If you have strings that should be translated but are unfortunately in a
structure you have to do that on your own which means that you have to
parse the fields with the messages in a loop and translate the texts with
this gettext() function.
Please note that it may be necessary to free or allocate memory in this
case!
4. Some magic...
As you have seen we only did the programming part until now but this isn't
all by far.
To use catalogs we'll have to create them. Now there are 3 different files
which are importart:
gimp.pot:
This one is the so called template. It contains the messages which are
extracted from the sources and empty fields which have to get filled by the
author. It is used to start a new catalog or to update the an already
available one.
The Makefile will automatically call the program gettext which will extract
all messages that are wrapped by a _() or a N_() (but NOT gettext()) and
concat them to this template.
[language].po:
This file has to be an edited gimp.pot and contains the original messages
plus the translated ones. This file will be delivered together with GIMP
and is the base for the final catalog.
[language].mo:
This file is a compiled version of [language.po] which will be
automatically compiled by the Makefile and installed in the locale
directory of the system. It contains everything that the .po file
contains except not translated messages, comments and other overhead.
For maximum speed it is also hashed to allow gettext a faster search.
5. Tools and how to use them...
As mentioned the to get translated string are extracted directly from the
source and written to the template.
I guess many of you will now ask if it is necessary to add new strings
directly from the template or if there's a tool to achieve that.
I think I can calm down those one who fear of lots of had work just to
update the language files. There's a program called msgmerge which will
add all strings that are in the template but not in the uncompiled catalog
to it. Msgmerge does this job very nicely and also tries to apply some kind
of fuzzy search method for already translated string for possible
programmers work reduction: If a original string seems similar to a new one
and it already has a translation, it will be taken over to the new catalog
together with a remark that this one mustn't necessarily fit.
6. And more?
I hope I mentioned everything that is worth it and hope that this document
will clarify some things. If it doesn't please write me a mail and tell me
what you want to know. This text may contain errors, so if you find one
tell it to me, too....
Happy Gimping. Yours,
Daniel Egger

View File

@ -37,6 +37,22 @@
* Revision History:
*
* $Log$
* Revision 1.10 1998/11/09 02:04:34 yosh
* * Makefile.am
* * README.i18n: new file, explains i18n stuff
*
* * plug-ins/script-fu/scripts/(lots of files): applied
* gimp-ruth-981108-0, use nice SF-FONT and SF-FILENAME stuff
*
* * plug-ins/png/png.c: applied gimp-ruth-981108-1, fixes loader for
* some indexed pngs. Also default to level 6 compression, level 9
* compression is cpu hungry and isn't much of a win compared to 6.
*
* * plug-ins/tiff/tiff.c: applied gimp-ruth-981108-2, major tiff
* rework
*
* -Yosh
*
* Revision 1.9 1998/07/20 18:19:20 neo
* The new "Fixed Size" option now works with
* ellipse_select too. Made the entries use spinbuttons. Minor change
@ -169,7 +185,7 @@ GPlugInInfo PLUG_IN_INFO =
PngSaveVals pngvals =
{
FALSE,
9
6
};
int runme = FALSE;
@ -424,13 +440,20 @@ load_image(char *filename) /* I - File to load */
png_read_info(pp, info);
if (info->bit_depth < 8)
/*
* I have no idea why this used to be the way it was, luckily
* most people don't use 2bit or 4bit indexed images with PNG
*/
if (info->bit_depth < 8)
{
png_set_packing(pp);
png_set_expand(pp);
if (info->color_type != PNG_COLOR_TYPE_PALETTE) {
png_set_expand(pp);
if (info->valid & PNG_INFO_sBIT)
png_set_shift(pp, &(info->sig_bit));
if (info->valid & PNG_INFO_sBIT)
png_set_shift(pp, &(info->sig_bit));
}
}
else if (info->bit_depth == 16)
png_set_strip_16(pp);

View File

@ -48,6 +48,14 @@ typedef struct
gint run;
} TiffSaveInterface;
typedef struct {
gint32 ID;
GDrawable *drawable;
GPixelRgn pixel_rgn;
guchar *pixels;
guchar *pixel;
} channel_data;
/* Declare some local functions.
*/
static void query (void);
@ -57,6 +65,18 @@ static void run (char *name,
int *nreturn_vals,
GParam **return_vals);
static gint32 load_image (char *filename);
static void load_separate (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static void load_8bit (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static void load_default (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static gint save_image (char *filename,
gint32 image,
gint32 drawable);
@ -93,7 +113,7 @@ static TiffSaveInterface tsint =
FALSE /* run */
};
static char *image_comment;
static char *image_comment= NULL;
MAIN ()
@ -167,6 +187,9 @@ run (char *name,
static GParam values[2];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
#ifdef GIMP_HAVE_PARASITES
Parasite *parasite;
#endif /* GIMP_HAVE_PARASITES */
gint32 image;
run_mode = param[0].data.d_int32;
@ -194,29 +217,28 @@ run (char *name,
}
else if (strcmp (name, "file_tiff_save") == 0)
{
/* Do this right this time, if POSSIBLE query for parasites, otherwise
or if there isn't one, choose the DEFAULT_COMMENT */
#ifdef GIMP_HAVE_PARASITES
int image = param[1].data.d_int32;
/* get the image comment either from a parasite, or from our
* compiled-in default */
{
Parasite *parasite;
parasite = gimp_image_find_parasite(image, "gimp-comment");
if (!parasite_is_error(parasite))
image_comment = g_strdup(parasite->data);
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
image_comment = NULL;
parasite = gimp_image_find_parasite(image, "gimp-comment");
if (!parasite_is_error(parasite))
image_comment = g_strdup(parasite->data);
parasite_free(parasite);
if (!image_comment)
image_comment = g_strdup(DEFAULT_COMMENT);
}
if (!image_comment) image_comment = g_strdup(DEFAULT_COMMENT);
switch (run_mode)
{
case RUN_INTERACTIVE:
{
Parasite *parasite;
/* Possibly retrieve data */
gimp_get_data ("file_tiff_save", &tsvals);
#ifdef GIMP_HAVE_PARASITES
parasite = gimp_image_find_parasite(image, "tiff-save-options");
if (!parasite_is_error(parasite))
{
@ -224,6 +246,7 @@ run (char *name,
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
/* First acquire information with a dialog */
if (! save_dialog ())
@ -254,8 +277,8 @@ run (char *name,
case RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
{
Parasite *parasite;
gimp_get_data ("file_tiff_save", &tsvals);
#ifdef GIMP_HAVE_PARASITES
parasite = gimp_image_find_parasite(image, "tiff-save-options");
if (!parasite_is_error(parasite))
{
@ -263,6 +286,7 @@ run (char *name,
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
}
break;
@ -285,42 +309,31 @@ run (char *name,
static gint32 load_image (char *filename) {
TIFF *tif;
unsigned short bps, spp, photomet;
int cols, rows, maxval, alpha;
unsigned short bps, spp, photomet, planar;
int cols, rows, alpha;
int image, layer, tile_height;
unsigned short *redmap, *greenmap, *bluemap;
guchar cmap[768];
int image_type= 0, layer_type= 0;
unsigned short extra, *extra_types;
int col, row, start, i, j;
unsigned char sample;
int bitsleft;
int gray_val, red_val, green_val, blue_val, alpha_val;
int i, j;
guchar *source, *s, *dest, *d;
GDrawable *drawable;
GPixelRgn pixel_rgn;
char *name;
guchar colors[3]= {0, 0, 0};
typedef struct {
gint32 ID;
GDrawable *drawable;
GPixelRgn pixel_rgn;
guchar *pixels;
guchar *pixel;
} channel_data;
channel_data *channel= NULL;
TiffSaveVals save_vals;
#ifdef GIMP_HAVE_PARASITES
Parasite *parasite;
#endif /* GIMP_HAVE_PARASITES */
guint16 tmp;
tif = TIFFOpen (filename, "r");
if (!tif) {
g_message("TIFF Can't open \n%s", filename);
g_message("TIFF Can't open %s\n", filename);
gimp_quit ();
}
@ -333,10 +346,12 @@ static gint32 load_image (char *filename) {
bps = 1;
if (bps > 8) {
g_message("TIFF Can't handle samples wider than 8-bit");
g_message("TIFF Can't handle samples wider than 8-bit\n");
gimp_quit();
}
if (!TIFFGetField (tif, TIFFTAG_PLANARCONFIG, &planar))
planar = PLANARCONFIG_SEPARATE;
if (!TIFFGetField (tif, TIFFTAG_SAMPLESPERPIXEL, &spp))
spp = 1;
if (!TIFFGetField (tif, TIFFTAG_EXTRASAMPLES, &extra, &extra_types))
@ -364,20 +379,19 @@ static gint32 load_image (char *filename) {
/* test if the extrasample represents an associated alpha channel... */
if (extra > 0 && (extra_types[0] == EXTRASAMPLE_ASSOCALPHA)) {
alpha = 1;
--extra;
} else {
alpha = 0;
}
if (photomet == PHOTOMETRIC_RGB && spp > extra + 3) {
extra= spp - 3;
if (photomet == PHOTOMETRIC_RGB && spp > 3 + extra) {
alpha= 1;
} else if (photomet != PHOTOMETRIC_RGB && spp > extra + 1) {
extra= spp - 1;
extra= spp - 4;
} else if (photomet != PHOTOMETRIC_RGB && spp > 1 + extra) {
alpha= 1;
extra= spp - 2;
}
maxval = (1 << bps) - 1;
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
@ -419,15 +433,18 @@ static gint32 load_image (char *filename) {
save_vals.fillorder = FILLORDER_LSB2MSB;
else
save_vals.fillorder = tmp;
#ifdef GIMP_HAVE_PARASITES
parasite = parasite_new("tiff-save-options", 0,
sizeof(save_vals), &save_vals);
gimp_image_attach_parasite(image, parasite);
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
/* Attach a parasite containing the image description. Pretend to
* be a gimp comment so other plugins will use this description as
* an image comment where appropriate. */
#ifdef GIMP_HAVE_PARASITES
{
char *img_desc;
@ -444,8 +461,10 @@ static gint32 load_image (char *filename) {
parasite_free(parasite);
}
}
#endif /* GIMP_HAVE_PARASITES */
/* any resolution info in the file? */
#ifdef GIMP_HAVE_RESOLUTION_INFO
{
float xres=0, yres=0;
unsigned short units;
@ -508,7 +527,7 @@ static gint32 load_image (char *filename) {
should feel free to shoot the author of the broken program
that produced the damaged TIFF file in the first place. */
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */
/* Install colormap for INDEXED images only */
@ -518,12 +537,12 @@ static gint32 load_image (char *filename) {
gimp_quit ();
}
for (i = 0, j = 0; i <= maxval; i++) {
for (i = 0, j = 0; i < (1 << bps); i++) {
cmap[j++] = redmap[i] >> 8;
cmap[j++] = greenmap[i] >> 8;
cmap[j++] = bluemap[i] >> 8;
}
gimp_image_set_cmap (image, cmap, maxval + 1);
gimp_image_set_cmap (image, cmap, (1 << bps));
}
layer = gimp_layer_new (image, "Background", cols, rows, layer_type,
@ -531,25 +550,153 @@ static gint32 load_image (char *filename) {
gimp_image_add_layer (image, layer, 0);
drawable = gimp_drawable_get (layer);
source= g_new (guchar, TIFFScanlineSize (tif));
tile_height = gimp_tile_height ();
if (extra > 0) {
channel = g_new (channel_data, extra);
/* Add alpha channels as appropriate */
for (i= 0; i < extra; ++i) {
channel[i].ID= gimp_channel_new(image, "TIFF Channel", cols, rows,
100.0, colors);
gimp_image_add_channel(image, channel[i].ID, 0);
channel[i].drawable= gimp_drawable_get (channel[i].ID);
channel[i].pixels= g_new(guchar, tile_height * cols);
gimp_pixel_rgn_init (&(channel[i].pixel_rgn), channel[i].drawable, 0, 0,
cols, rows, TRUE, FALSE);
}
}
if (planar == PLANARCONFIG_SEPARATE) {
load_separate(tif, drawable, channel, bps, photomet,
rows, cols, alpha, extra);
} else if (bps == 8) {
load_8bit(tif, drawable, channel, bps, photomet, rows, cols, alpha, extra);
} else {
load_default(tif, drawable, channel, bps, photomet,
rows, cols, alpha, extra);
}
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
for (i= 0; i < extra; ++i) {
gimp_drawable_flush (channel[i].drawable);
gimp_drawable_detach (channel[i].drawable);
}
return image;
}
static void
load_8bit(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int gray_val, red_val, green_val, blue_val, alpha_val;
int col, row, start, i;
int tile_height = gimp_tile_height ();
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
if (extra - alpha > 0)
channel = g_new (channel_data, extra - alpha);
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
/* Add alpha channels as appropriate */
for (i= 0; alpha + i < extra; ++i) {
channel[i].ID= gimp_channel_new(image, "TIFF Channel", cols, rows,
100.0, colors);
gimp_image_add_channel(image, channel[i].ID, 0);
channel[i].drawable= gimp_drawable_get (channel[i].ID);
channel[i].pixels= g_new(guchar, tile_height * cols);
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
gimp_pixel_rgn_init (&(channel[i].pixel_rgn), channel[i].drawable, 0, 0,
cols, rows, TRUE, FALSE);
for (i= 0; i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
s= source;
for (col = 0; col < cols; col++) {
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
if (alpha) {
gray_val= *s++;
alpha_val= *s++;
if (alpha_val)
*d++ = gray_val * 255 / alpha_val;
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = *s++;
}
break;
case PHOTOMETRIC_MINISWHITE:
if (alpha) {
gray_val= *s++;
alpha_val= *s++;
if (alpha_val)
*d++ = ((255 - gray_val) * 255) / alpha_val;
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ~(*s++);
}
break;
case PHOTOMETRIC_PALETTE:
*d++= *s++;
if (alpha) *d++= *s++;
break;
case PHOTOMETRIC_RGB:
if (alpha) {
red_val= *s++;
green_val= *s++;
blue_val= *s++;
alpha_val= *s++;
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
*d++ = alpha_val;
} else {
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
}
break;
default:
/* This case was handled earlier */
g_assert_not_reached();
}
for (i= 0; i < extra; ++i) {
*channel[i].pixel++ = *s++;
}
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
for (i= 0; alpha + i < extra; ++i) {
gimp_pixel_rgn_set_rect(&(channel[i].pixel_rgn), channel[i].pixels,
0, start, cols, 1+row-start);
}
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
}
/* Step through all <= 8-bit samples in an image */
@ -564,121 +711,109 @@ static gint32 load_image (char *filename) {
var = ( *s >> bitsleft ) & maxval; \
}
static void
load_default(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int gray_val, red_val, green_val, blue_val, alpha_val;
int col, row, start, i;
int bitsleft, maxval = (1 << bps) - 1;
int tile_height = gimp_tile_height ();
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
/* Special cases: Scanline is compatible with GIMP storage */
if (extra == 0 && bps == 8) {
if (TIFFReadScanline (tif, d, row, 0) < 0) {
g_message("TIFF Bad data read on line %d", row);
gimp_quit ();
}
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Or read in and process each sample -- slower */
} else {
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
for (i= 0; i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
for (i= 0; alpha + i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
/* Set s/bitleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = (gray_val * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = (gray_val * 255) / maxval;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
break;
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = (gray_val * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = (gray_val * 255) / maxval;
}
break;
case PHOTOMETRIC_MINISWHITE:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = ((maxval - gray_val) * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ((maxval - gray_val) * 255) / maxval;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = ((maxval - gray_val) * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ((maxval - gray_val) * 255) / maxval;
}
break;
case PHOTOMETRIC_PALETTE:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(*d++);
if (alpha) {
NEXTSAMPLE(*d++);
if (alpha) {
NEXTSAMPLE(*d++);
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
break;
case PHOTOMETRIC_RGB:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(red_val)
NEXTSAMPLE(green_val)
NEXTSAMPLE(blue_val)
if (alpha) {
NEXTSAMPLE(alpha_val)
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
*d++ = alpha_val;
} else {
*d++ = red_val;
*d++ = green_val;
*d++ = blue_val;
NEXTSAMPLE(red_val)
NEXTSAMPLE(green_val)
NEXTSAMPLE(blue_val)
if (alpha) {
NEXTSAMPLE(alpha_val)
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
*d++ = alpha_val;
} else {
*d++ = red_val;
*d++ = green_val;
*d++ = blue_val;
}
break;
default:
/* This case was handled earlier */
g_assert_not_reached();
}
for (i= 0; i < extra; ++i) {
NEXTSAMPLE(alpha_val);
*channel[i].pixel++ = alpha_val;
}
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
@ -690,11 +825,155 @@ static gint32 load_image (char *filename) {
start= row + 1;
}
}
}
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
static void
load_separate(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int col, row, start;
int bitsleft, maxval = (1 << bps) - 1;
int tile_height = gimp_tile_height ();
return image;
TIFFPrintDirectory(tif, stdout, 0);
if (photomet != PHOTOMETRIC_RGB) {
g_message("So far PLANARCONFIG_SEPARATE only supports RGB images");
gimp_quit();
}
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
/* RED channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha)])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* GREEN channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 1) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha) + 1])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* BLUE channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 2) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha) + 2])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* ALPHA channel */
if (alpha) {
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 3) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * 4 + 3])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
}
}
/*
@ -851,6 +1130,7 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
/* TIFFSetField( tif, TIFFTAG_STRIPBYTECOUNTS, rows / rowsperstrip ); */
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
#ifdef GIMP_HAVE_RESOLUTION_INFO
/* resolution fields */
{
float resolution = gimp_image_get_resolution(image);
@ -861,10 +1141,12 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
}
}
#endif GIMP_HAVE_RESOLUTION_INFO
/* do we have a comment? If so, create a new parasite to hold it,
* and attach it to the image. The attach function automatically
* detaches a previous incarnation of the parasite. */
#ifdef GIMP_HAVE_PARASITES
if (image_comment && *image_comment != '\000')
{
Parasite *parasite;
@ -875,6 +1157,7 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
gimp_image_attach_parasite (image, parasite);
parasite_free (parasite);
}
#endif /* GIMP_HAVE_PARASITES */
if (drawable_type == INDEXED_IMAGE)
TIFFSetField (tif, TIFFTAG_COLORMAP, red, grn, blu);

View File

@ -37,6 +37,22 @@
* Revision History:
*
* $Log$
* Revision 1.10 1998/11/09 02:04:34 yosh
* * Makefile.am
* * README.i18n: new file, explains i18n stuff
*
* * plug-ins/script-fu/scripts/(lots of files): applied
* gimp-ruth-981108-0, use nice SF-FONT and SF-FILENAME stuff
*
* * plug-ins/png/png.c: applied gimp-ruth-981108-1, fixes loader for
* some indexed pngs. Also default to level 6 compression, level 9
* compression is cpu hungry and isn't much of a win compared to 6.
*
* * plug-ins/tiff/tiff.c: applied gimp-ruth-981108-2, major tiff
* rework
*
* -Yosh
*
* Revision 1.9 1998/07/20 18:19:20 neo
* The new "Fixed Size" option now works with
* ellipse_select too. Made the entries use spinbuttons. Minor change
@ -169,7 +185,7 @@ GPlugInInfo PLUG_IN_INFO =
PngSaveVals pngvals =
{
FALSE,
9
6
};
int runme = FALSE;
@ -424,13 +440,20 @@ load_image(char *filename) /* I - File to load */
png_read_info(pp, info);
if (info->bit_depth < 8)
/*
* I have no idea why this used to be the way it was, luckily
* most people don't use 2bit or 4bit indexed images with PNG
*/
if (info->bit_depth < 8)
{
png_set_packing(pp);
png_set_expand(pp);
if (info->color_type != PNG_COLOR_TYPE_PALETTE) {
png_set_expand(pp);
if (info->valid & PNG_INFO_sBIT)
png_set_shift(pp, &(info->sig_bit));
if (info->valid & PNG_INFO_sBIT)
png_set_shift(pp, &(info->sig_bit));
}
}
else if (info->bit_depth == 16)
png_set_strip_16(pp);

View File

@ -23,7 +23,7 @@
(define (script-fu-3d-outline-logo text-pattern text size font outline-blur-radius shadow-blur-radius bump-map-blur-radius noninteractive s-offset-x s-offset-y)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text img -1 0 0 text 30 TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -83,8 +83,8 @@
""
SF-PATTERN "Pattern" "Parque #1"
SF-STRING "Text String" "The Gimp"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Roostheavy"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Roostheavy-*-r-*-*-24-*-*-*-p-*-*-*"
SF-VALUE "Outline blur radius" "5"
SF-VALUE "Shadow blur radius" "10"
SF-VALUE "Bump-map (alpha layer) blur radius" "5"

View File

@ -166,24 +166,7 @@
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Begin Blend" '(0 0 0)
SF-COLOR "End Blend" '(255 255 255)
SF-VALUE "Supersample" "TRUE"
SF-TOGGLE "Supersample?" TRUE
SF-VALUE "Number of Xtiles" "5"
SF-VALUE "Number of Ytiles" "5"
)

View File

@ -6,7 +6,7 @@
(border (/ size 4))
(grow (/ size 30))
(feather (/ size 4))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -45,6 +45,6 @@
"1997"
""
SF-STRING "Text String" "ALIEN"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "futura_poster"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Glow Color" '(63 252 0))

View File

@ -153,7 +153,7 @@
)
)
(set! theText (car (gimp-text theImage
(set! theText (car (gimp-text-fontname theImage
-1
0
0
@ -162,12 +162,7 @@
TRUE
inFontSize
PIXELS
"*"
inFont
"*"
"*"
"*"
"*")))
inFont)))
(set! theCharWidth (car (gimp-drawable-width theText) ))
(gimp-edit-cut theImage theText)
@ -196,7 +191,7 @@
(if (equal? "" theLine)
()
(begin
(set! theText (car (gimp-text theImage
(set! theText (car (gimp-text-fontname theImage
-1
0
0
@ -205,12 +200,7 @@
TRUE
inFontSize
PIXELS
"*"
inFont
"*"
"*"
"*"
"*")))
inFont)))
(set! theLineHeight (car (gimp-drawable-height theText) ) )
(gimp-layer-set-offsets theText
(* theCharWidth theIndent)
@ -242,13 +232,13 @@
"8th April 1998"
"Chris Gutteridge / ECS @ University of Southampton, England"
"bar"
SF-STRING "File Name:" "afile"
SF-STRING "Font:" "Charter"
SF-VALUE "Font size:" "45"
SF-COLOR "Text Color:" '(0 0 0)
SF-FILENAME "File Name" "afile"
SF-FONT "Font" "-*-Charter-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(45 2 1000 1 10 0 1)
SF-COLOR "Text Color" '(0 0 0)
SF-TOGGLE "Transparent BG?" FALSE
SF-COLOR "Background Color:" '(255 255 255)
SF-VALUE "Buffer amount (% height of text):" "35"
SF-COLOR "Background Color" '(255 255 255)
SF-ADJUSTMENT "Buffer amount (% height of text)" '(35 0 100 1 10 0 0)
SF-TOGGLE "Flatten Image?" TRUE
)
@ -262,9 +252,9 @@
"bar"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
SF-STRING "File Name:" "afile"
SF-STRING "Font:" "Charter"
SF-VALUE "Font size:" "45"
SF-COLOR "Text Color:" '(0 0 0)
SF-FILENAME "File Name" "afile"
SF-FONT "Font" "-*-Charter-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(45 2 1000 1 10 0 1)
SF-COLOR "Text Color" '(0 0 0)
SF-TOGGLE "Flatten Image?" TRUE
)

View File

@ -3,7 +3,7 @@
(define (script-fu-basic1-logo text size font bg-color text-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text img -1 0 0 text 10 TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -42,7 +42,7 @@
"1996"
""
SF-STRING "Text String" "The Gimp"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Dragonwick"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Dragonwick-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Text Color" '(6 6 206))

View File

@ -12,7 +12,7 @@
(define (script-fu-basic2-logo text size font bg-color text-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text img -1 0 0 text 10 TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -58,7 +58,7 @@
"1996"
""
SF-STRING "Text String" "SCRIPT-FU"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "futura_poster"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Text Color" '(206 6 50))

View File

@ -182,4 +182,4 @@
SF-COLOR "Text color" '(0 0 0)
SF-VALUE "Padding" "2"
SF-VALUE "Bevel width" "4"
SF-VALUE "Pressed?" "FALSE")
SF-TOGGLE "Pressed?" FALSE)

View File

@ -14,7 +14,7 @@
(f-size (scale size 0.075))
(ds-size (scale size 0.05))
(ts-size (- b-size-2 3))
(text-layer (car (gimp-text img -1 0 0 text b-size TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(blend-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blend" 100 NORMAL)))
@ -82,8 +82,8 @@
""
SF-VALUE "Blend Mode" "FG-BG-RGB"
SF-STRING "Text String" "The GIMP"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "Crillee"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Crillee-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Text Color" '(124 174 255)
SF-COLOR "Starting Blend" '(22 9 129)

View File

@ -22,7 +22,7 @@
(define (script-fu-bovinated-logo text size font)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
@ -76,5 +76,5 @@
"April 1998"
""
SF-STRING "Text String" "Fear the Cow"
SF-VALUE "Font Size (in pixels)" "80"
SF-STRING "Font" "roostheavy")
SF-ADJUSTMENT "Font Size (pixels)" '(80 2 1000 1 10 0 1)
SF-FONT "Font" "-*-roostheavy-*-r-*-*-24-*-*-*-p-*-*-*")

View File

@ -90,11 +90,11 @@
"28th April 1998"
"Chris Gutteridge / ECS @ University of Southampton, England"
""
SF-VALUE "Image Size:" "256"
SF-VALUE "Granularity (0 - 15):" "7"
SF-COLOR "Color 1:" '(33 100 58)
SF-COLOR "Color 2:" '(170 170 60)
SF-COLOR "Color 3:" '(150 115 100)
SF-VALUE "Image Size" "256"
SF-ADJUSTMENT "Granularity (0 - 15)" '(7 0 15 1 1 0 0)
SF-COLOR "Color 1" '(33 100 58)
SF-COLOR "Color 2" '(170 170 60)
SF-COLOR "Color 3" '(150 115 100)
SF-TOGGLE "Smooth?" FALSE
SF-TOGGLE "Flatten?" TRUE
)

View File

@ -31,7 +31,7 @@
(brush-size (carve-scale size 0.3))
(b-size (carve-scale size 1.5))
(layer1 (car (gimp-image-active-drawable img)))
(mask-layer (car (gimp-text img -1 0 0 text b-size TRUE size PIXELS "*" font "*" "*" "*" "*")))
(mask-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width mask-layer)))
(height (car (gimp-drawable-height mask-layer)))
(mask-fs 0)
@ -158,8 +158,8 @@
"1997"
""
SF-STRING "Text String" "Marble"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Engraver"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Engraver-*-r-*-*-24-*-*-*-p-*-*-*"
; SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture3.jpg")
SF-FILENAME "Background Img" (string-append "" gimp-data-dir "/scripts/texture3.jpg")
SF-TOGGLE "Carve Raised Text" FALSE)

View File

@ -24,7 +24,7 @@
(define (script-fu-chalk-logo text size font bg-color chalk-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -42,7 +42,7 @@
; is there any other way to do this?
; the sobel edge detect won't work with the methods in other scripts
(gimp-palette-set-foreground chalk-color)
(set! float-layer (car (gimp-text img text-layer 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(set! float-layer (car (gimp-text-fontname img text-layer 0 0 text border TRUE size PIXELS font)))
(gimp-floating-sel-anchor float-layer)
; the actual effect
@ -74,7 +74,7 @@
"October 1997"
""
SF-STRING "Text String" "CHALK"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "Cooper"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Cooper-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(0 0 0)
SF-COLOR "Chalk Color" '(255 255 255))

View File

@ -38,9 +38,8 @@
(define (script-fu-logo-chip-away text font font-size spread-amount blur-amount invert drop-shadow keep-bump bg-fill keep-back pattern)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text img -1 0 0
text 30 TRUE font-size PIXELS
"*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0
text 30 TRUE font-size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
@ -120,8 +119,8 @@
"1997"
""
SF-STRING "Text String" "Sloth"
SF-STRING "Font" "roostheavy"
SF-VALUE "Font size" "200"
SF-FONT "Font" "-*-roostheavy-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(200 2 1000 1 10 0 1)
SF-VALUE "Chip Amount" "30"
SF-VALUE "Blur Amount" "3"
SF-TOGGLE "Invert?" FALSE

View File

@ -8,7 +8,7 @@
(offx2 (* size (- 0.04)))
(offy2 (* size (- 0.03)))
(feather (* size 0.05))
(text-layer (car (gimp-text img -1 0 0 text b-size TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(layer1 (car (gimp-layer-new img width height RGBA_IMAGE "Layer 1" 100 DIFFERENCE)))
@ -74,6 +74,6 @@
"1997"
""
SF-STRING "Text String" "The GIMP"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Bodoni"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Bodoni-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(191 191 191))

View File

@ -64,6 +64,6 @@
"RGBA RGB"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-VALUE "Stains:" "3"
SF-TOGGLE "Darken Only: (better but only for images with alot of white)" TRUE
SF-VALUE "Stains" "3"
SF-TOGGLE "Darken Only? (better but only for images with alot of white)" TRUE
)

View File

@ -228,9 +228,9 @@
SF-VALUE "Red color mode (sin:0/cos:1/none:2)" "0"
SF-VALUE "Green color mode (sin:0/cos:1/none:2)" "0"
SF-VALUE "Blue color mode (sin:0/cos:1/none:2)" "0"
SF-VALUE "Red inversion before transformation" "FALSE"
SF-VALUE "Green inversion before transformation" "FALSE"
SF-VALUE "Blue inversion before transformation" "FALSE"
SF-TOGGLE "Red inversion before transformation" FALSE
SF-TOGGLE "Green inversion before transformation" FALSE
SF-TOGGLE "Blue inversion before transformation" FALSE
SF-VALUE "Start: red phase displacement (RAD)" "0"
SF-VALUE "Start: green phase displacement (RAD)" "0"
SF-VALUE "Start: blue phase displacement (RAD)" "0"
@ -243,7 +243,7 @@
SF-VALUE "End: red frequency (> 0)" "1"
SF-VALUE "End: green frequency (> 0)" "1"
SF-VALUE "End: blue frequency (> 0)" "1"
SF-VALUE "Red inversion after transformation" "FALSE"
SF-VALUE "Green inversion after transformation" "FALSE"
SF-VALUE "Blue inversion after transformation" "FALSE")
SF-TOGGLE "Red inversion after transformation" FALSE
SF-TOGGLE "Green inversion after transformation" FALSE
SF-TOGGLE "Blue inversion after transformation" FALSE)

View File

@ -22,7 +22,7 @@
(define (script-fu-comic-logo text size font gradient ol-width)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
@ -86,7 +86,7 @@
"April 1998"
""
SF-STRING "Text String" "Moo"
SF-VALUE "Font Size (in pixels)" "85"
SF-STRING "Font" "tribeca"
SF-ADJUSTMENT "Font Size (pixels)" '(85 2 1000 1 10 0 1)
SF-FONT "Font" "-*-tribeca-*-i-*-*-24-*-*-*-p-*-*-*"
SF-GRADIENT "Gradient" "Incandescent"
SF-VALUE "Outline width" "5")

View File

@ -12,7 +12,7 @@
(amplitude (/ size 40))
(shrink (+ 1 (/ size 30)))
(depth (/ size 20))
(text-layer (car (gimp-text img -1 0 0 text 0 TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(img-width (+ width (* 0.15 height) 10))
@ -107,7 +107,7 @@
"1997"
""
SF-STRING "Text String" "Cool Metal"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Crillee"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Crillee-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(255 255 255)
SF-TOGGLE "Seascape" FALSE)

View File

@ -77,7 +77,7 @@
(blur (sota-scale size 0.5 chrome-factor))
(displace (sota-scale size 0.25 chrome-factor))
(brush-size (sota-scale size 0.5 chrome-factor))
(text-layer (car (gimp-text img -1 0 0 text b-size TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(tile-ret (plug-in-tile 1 back-img back-layer width height TRUE))
@ -195,8 +195,8 @@
""
SF-VALUE "Chrome Factor" "1.0"
SF-STRING "Text String" "Crystal"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "Engraver"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Engraver-*-r-*-*-24-*-*-*-p-*-*-*"
; SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture1.jpg")
SF-FILENAME "Background Img" (string-append "" gimp-data-dir "/scripts/texture1.jpg")
; SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))

View File

@ -96,10 +96,10 @@
"RGB RGBA"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-VALUE "Threshold: bigger 1<-->255 smaller" "127"
SF-VALUE "Spread:" "8"
SF-VALUE "Granularity: (1 is low)" "4"
SF-VALUE "Threshold (bigger 1<-->255 smaller)" "127"
SF-VALUE "Spread" "8"
SF-VALUE "Granularity (1 is low)" "4"
SF-VALUE "Smooth" "2"
SF-TOGGLE "Smooth Horizontally" TRUE
SF-TOGGLE "Smooth Vertically" TRUE
SF-TOGGLE "Smooth Horizontally?" TRUE
SF-TOGGLE "Smooth Vertically?" TRUE
)

View File

@ -96,10 +96,10 @@
"RGB RGBA"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-VALUE "Threshold: bigger 1<-->255 smaller" "127"
SF-VALUE "Spread:" "8"
SF-VALUE "Granularity: (1 is low)" "4"
SF-VALUE "Threshold (bigger 1<-->255 smaller)" "127"
SF-VALUE "Spread" "8"
SF-VALUE "Granularity (1 is low)" "4"
SF-VALUE "Smooth" "2"
SF-TOGGLE "Smooth Horizontally" TRUE
SF-TOGGLE "Smooth Vertically" TRUE
SF-TOGGLE "Smooth Horizontally?" TRUE
SF-TOGGLE "Smooth Vertically?" TRUE
)

View File

@ -146,7 +146,7 @@
"RGB RGBA GRAY GRAYA"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-VALUE "Border Size:" "10"
SF-VALUE "Border Size" "10"
SF-TOGGLE "Apply generated Layermask?" FALSE
SF-TOGGLE "Clear unselected Maskarea?" TRUE
)

View File

@ -68,6 +68,6 @@
"1997"
""
SF-VALUE "Fonts" "'(\"Agate\" \"AlfredDrake\" \"Becker\" \"Blippo\" \"Bodoni\" \"Dragonwick\" \"Engraver\" \"Futura_Poster\" \"RoostHeavy\")"
SF-VALUE "Font Size" "32"
SF-ADJUSTMENT "Font Size (pixels)" '(32 2 1000 1 10 0 1)
SF-VALUE "Border" "10"
)

View File

@ -7,7 +7,7 @@
(define (script-fu-frosty-logo text size font bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 5))
(text-layer (car (gimp-text img -1 0 0 text (* border 2) TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(text-layer-mask (car (gimp-layer-create-mask text-layer BLACK-MASK)))
@ -83,6 +83,6 @@
"1997"
""
SF-STRING "Text String" "The GIMP"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Becker"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Becker-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(255 255 255))

View File

@ -156,12 +156,12 @@
"RGB RGBA GRAY GRAYA"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-COLOR "Color:" '(255 255 255)
SF-VALUE "Border Size:" "16"
SF-COLOR "Color" '(255 255 255)
SF-VALUE "Border Size" "16"
SF-TOGGLE "Blur Border?" TRUE
SF-VALUE "Granularity: (1 is low)" "4"
SF-VALUE "Granularity (1 is low)" "4"
SF-TOGGLE "Add Shadow?" FALSE
SF-VALUE "Shadow-Weight (%):" "100"
SF-ADJUSTMENT "Shadow-Weight (%)" '(100 0 100 1 10 0 0)
SF-TOGGLE "Work on Copy?" TRUE
SF-TOGGLE "Flatten Layers?" TRUE
)

View File

@ -135,8 +135,8 @@
"1997"
""
SF-STRING "Text String" "gimp.org"
SF-STRING "Font" "times"
SF-VALUE "Font size" "50"
SF-FONT "Font" "-*-times-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(50 2 1000 1 10 0 1)
SF-COLOR "Text Color" '(82 108 159)
SF-COLOR "Higlight Color" '(190 220 250)
SF-COLOR "Dark Color" '(46 74 92)
@ -154,8 +154,8 @@
"1997"
""
SF-STRING "Text String" "gimp.org"
SF-STRING "Font" "helvetica"
SF-VALUE "Font size" "24"
SF-FONT "Font" "-*-helvetica-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(24 2 1000 1 10 0 1)
SF-COLOR "Text Color" '(135 220 220)
SF-COLOR "Higlight Color" '(210 240 245)
SF-COLOR "Dark Color" '(46 74 92)

View File

@ -140,8 +140,8 @@
"1997"
""
SF-STRING "Text String" "Gimp.Org"
SF-STRING "Font" "helvetica"
SF-VALUE "Font Size" "18"
SF-FONT "Font" "-*-helvetica-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(18 2 1000 1 10 0 1)
SF-STRING "Weight" "medium"
SF-STRING "Slant" "r"
SF-STRING "Width" "normal"

View File

@ -24,7 +24,7 @@
(define (script-fu-glossy-logo text size font blend-gradient-text blend-gradient-outline grow-size bg-color use-pattern-text pattern-text use-pattern-outline pattern-outline use-pattern-overlay pattern-overlay noninteractive shadow-toggle s-offset-x s-offset-y flatten-toggle)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text img -1 0 0 text 30 TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
@ -126,8 +126,8 @@
"14/04/1998"
""
SF-STRING "Text String" "Galaxy"
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Font" "Eras"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Eras-*-r-*-*-24-*-*-*-p-*-*-*"
SF-GRADIENT "Blend Gradient (text)" "Shadows_2"
SF-GRADIENT "Blend Gradient (outline)" "Shadows_2"
SF-VALUE "How big outline?" "5"

View File

@ -8,7 +8,7 @@
(feather1 (/ size 3))
(feather2 (/ size 7))
(feather3 (/ size 10))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(glow-layer (car (gimp-layer-copy text-layer TRUE)))
@ -65,6 +65,6 @@
"1997"
""
SF-STRING "Text String" "GLOWING"
SF-VALUE "Font Size (in pixels)" "150"
SF-STRING "Font" "Slogan"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Slogan-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Background Color" '(7 0 20))

View File

@ -22,7 +22,7 @@
(define (script-fu-gradient-bevel-logo text size font bevel-height bevel-width)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(indentX (+ border 12))
@ -78,7 +78,7 @@
"April 1998"
""
SF-STRING "Text String" "Moo"
SF-VALUE "Font Size (in pixels)" "90"
SF-STRING "Font" "futura_poster"
SF-ADJUSTMENT "Font Size (pixels)" '(90 2 1000 1 10 0 1)
SF-FONT "Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
SF-VALUE "Bevel Height (sharpness)" "40"
SF-VALUE "Bevel Width" "2.5")

View File

@ -89,8 +89,8 @@
SF-STRING "Text" "The GIMP"
SF-COLOR "Text Color" '(255 0 0)
SF-COLOR "Frame Color" '(0 34 255)
SF-STRING "Font" "Becker"
SF-VALUE "Font Size" "100"
SF-FONT "Font" "-*-Becker-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-VALUE "Frame Size" "2")
;;; i26-gunya2.scm ends here

View File

@ -159,10 +159,8 @@
"1997"
""
SF-STRING "Text String" "NEON"
; SF-VALUE "Font Size (in pixels)" "150"
SF-ADJUSTMENT "Font Size" '(150 2 256 1 10 0 0)
; SF-STRING "Font" "Blippo"
SF-FONT "Font" "-*-blippo-*-*-*-*-*-*-*-*-*-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-Blippo-*-*-*-*-24-*-*-*-*-*-*-*"
SF-COLOR "Background Color" '(0 0 0)
SF-COLOR "Glow Color" '(38 211 255)
SF-TOGGLE "Create Shadow" FALSE)
SF-TOGGLE "Create Shadow?" FALSE)

View File

@ -20,7 +20,7 @@
(define (script-fu-newsprint-text string font font-size cell-size density)
(let* ((text-ext (gimp-text-get-extents string font-size PIXELS "*" font "*" "*" "*" "*"))
(let* ((text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
(wid (+ (car text-ext) 20))
(hi (+ (nth 1 text-ext) 20))
(img (car (gimp-image-new wid hi RGB)))
@ -37,7 +37,7 @@
(gimp-edit-clear img bg-layer)
(gimp-edit-clear img text-layer)
(gimp-floating-sel-anchor (car (gimp-text img text-layer 10 10 string 0 TRUE font-size PIXELS "*" font "*" "*" "*" "*")))
(gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 string 0 TRUE font-size PIXELS font)))
(set! text-mask (car (gimp-layer-create-mask text-layer ALPHA-MASK)))
(gimp-image-add-layer-mask img text-layer text-mask)
@ -63,8 +63,8 @@
"Austin Donnelly"
"1998"
""
SF-VALUE "Text String" "\"Newsprint\""
SF-VALUE "Font" "\"Helvetica\""
SF-VALUE "Font Size (in pixels)" "100"
SF-STRING "Text String" "Newsprint"
SF-FONT "Font" "-*-Helvetica-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-VALUE "Cell size (in pixels)" "7"
SF-VALUE "Density (percent)" "60")
SF-ADJUSTMENT "Density (%)" '(60 0 100 1 10 0 0))

View File

@ -192,30 +192,5 @@
SF-ADJUSTMENT "Blur Radius" '(3 0 64 1 10 0 0)
SF-COLOR "Color" '(0 0 0)
SF-ADJUSTMENT "Opacity" '(80 0 100 1 10 0 0)
SF-TOGGLE "Interpolate" TRUE
SF-TOGGLE "Allow Resizing" FALSE)
SF-TOGGLE "Interpolate?" TRUE
SF-TOGGLE "Allow Resizing?" FALSE)

View File

@ -67,8 +67,8 @@
"Chris Gutteridge / ECS @ University of Southampton, England"
""
SF-ADJUSTMENT "Image Size" '(256 0 2048 1 10 0 0)
SF-ADJUSTMENT "Granularity (0 - 15):" '(4 0 15 1 1 0 1)
SF-GRADIENT "Gradient:" "Land_and_Sea"
SF-ADJUSTMENT "Granularity (0 - 15)" '(4 0 15 1 1 0 0)
SF-GRADIENT "Gradient" "Land_and_Sea"
SF-TOGGLE "TRUE = Detail in middle, FALSE = tile" FALSE
)

View File

@ -188,18 +188,12 @@
"Spencer Kimball"
"1997"
""
; SF-VALUE "Chrome Saturation" "-80"
SF-ADJUSTMENT "Chrome Saturation" '(-80 -100 100 1 10 0 0)
; SF-VALUE "Chrome Lightness" "-47"
SF-ADJUSTMENT "Chrome Lightness" '(-47 -100 100 1 10 0 0)
; SF-VALUE "Chrome Factor" "0.75"
SF-ADJUSTMENT "Chrome Factor" '(.75 0 1 .1 .01 2 0)
SF-STRING "Text String" "The GIMP"
; SF-VALUE "Font Size (in pixels)" "150"
SF-ADJUSTMENT "Font size (in pixels)" '(150 1 1000 1 10 0 1)
; SF-STRING "Font" "RoostHeavy"
SF-FONT "Font" "-*-roostheavy-*-r-*-*-24-*-*-*-p-*-*-*"
; SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT "Font" "-*-RoostHeavy-*-r-*-*-24-*-*-*-p-*-*-*"
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
SF-COLOR "Highlight Balance" '(211 95 0)
SF-COLOR "Chrome Balance" '(0 0 0))

View File

@ -20,7 +20,7 @@
(define (script-fu-speed-text string font font-size density)
(let* ((text-ext (gimp-text-get-extents string font-size PIXELS "*" font "*" "*" "*" "*"))
(let* ((text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
(wid (+ (car text-ext) 20))
(hi (+ (nth 1 text-ext) 20))
(img (car (gimp-image-new wid hi RGB)))
@ -40,7 +40,7 @@
(gimp-edit-clear img bg-layer)
(gimp-edit-clear img text-layer)
(gimp-floating-sel-anchor (car (gimp-text img text-layer 10 10 string 0 TRUE font-size PIXELS "*" font "*" "*" "*" "*")))
(gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 string 0 TRUE font-size PIXELS font)))
; save the selection for later
(gimp-selection-layer-alpha img text-layer)
@ -83,7 +83,7 @@
"Austin Donnelly"
"1998"
""
SF-VALUE "Text String" "\"Speed!\""
SF-VALUE "Font" "\"Charter\""
SF-VALUE "Font Size (in pixels)" "100"
SF-VALUE "Density (percent)" "80")
SF-STRING "Text String" "Speed!"
SF-FONT "Font" "-*-Charter-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-ADJUSTMENT "Density (%)" '(80 0 100 1 10 0 0))

View File

@ -58,6 +58,6 @@
""
SF-VALUE "Radius (in pixels)" "100"
SF-VALUE "Lighting (degrees)" "45"
SF-VALUE "Shadow?" "TRUE"
SF-TOGGLE "Shadow?" TRUE
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Sphere Color" '(255 0 0))

View File

@ -73,9 +73,9 @@
"1997"
""
SF-STRING "Text String" "GIMP"
; SF-VALUE "Font Size (in pixels)" "150"
; SF-ADJUSTMENT "Font Size (pixels)" '(150 2 1000 1 10 0 1)
SF-ADJUSTMENT "Font Size (pixels)" '(150 0 512 1 10 0 1)
; SF-STRING "Font" "Blippo"
; SF-FONT "Font" "-*-Blippo-*-r-*-*-24-*-*-*-p-*-*-*"
SF-FONT "Font" "-*-blippo-*-r-*-*-24-*-*-*-p-*-*-*"
SF-COLOR "Burst Color" '(60 196 33)
SF-COLOR "BG Color" '(255 255 255))

View File

@ -49,7 +49,7 @@
(gimp-selection-grow img (/ edge-size 2.0))
(gimp-selection-invert img)
(gimp-edit-clear img sparkle-layer)
(if (= 1 edge-only)
(if (= edge-only TRUE)
(begin
(gimp-selection-load img selection)
(gimp-selection-shrink img (/ edge-size 2.0))
@ -90,7 +90,7 @@
SF-FONT "Font" "-*-becker-*-r-*-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Hit Rate [0.0,1.0]" '(0.2 0 1 .01 .01 2 0)
SF-ADJUSTMENT "Edge Width" '(2 0 128 1 1 0 0)
SF-VALUE "Edge Only [0/1]" "0"
SF-TOGGLE "Edge Only?" FALSE
SF-COLOR "Base Color" '(0 40 0)
SF-COLOR "Background Color" '(255 255 255))

View File

@ -70,8 +70,7 @@
"RGBA RGB"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
; SF-VALUE "Radius:" "5"
SF-ADJUSTMENT "Radius:" '(5 0 128 1 1 0 0)
SF-ADJUSTMENT "Radius" '(5 0 128 1 1 0 0)
SF-TOGGLE "Blur Vertically?" TRUE
SF-TOGGLE "Blur Horizontally?" TRUE
SF-TOGGLE "Blur Type: TRUE=RLE, FALSE=IIR" FALSE

View File

@ -369,9 +369,9 @@
(gimp-display-new img)
(gimp-displays-flush)
(if (or (= base-radius 0) (= wheel-radius 0))
(gimp-text img -1 0 0
(gimp-text-fontname img -1 0 0
"`Base-radius'\n and\n`Rad.;hyp<0<epi'\n require\n non zero values."
1 1 18 PIXELS "*" "helvetica" "*" "*" "*" "*")
1 1 18 PIXELS "-*-helvetica-*-r-*-*-*-*-*-*-p-*-*-*")
(trochoid-rotate-gear total-step-num img the-layer
(/ drawable-size 2) (/ drawable-size 2)
base-radius wheel-radius pen-pos hue-rate

View File

@ -96,29 +96,4 @@
SF-ADJUSTMENT "Amplitude" '(10 1 101 1 10 1 0)
SF-ADJUSTMENT "Wavelength" '(10 .10 100 1 10 1 0)
SF-ADJUSTMENT "Number of Frames" '(6 1 512 1 10 1 1)
SF-TOGGLE "Invert direction" FALSE)
SF-TOGGLE "Invert direction?" FALSE)

View File

@ -48,6 +48,14 @@ typedef struct
gint run;
} TiffSaveInterface;
typedef struct {
gint32 ID;
GDrawable *drawable;
GPixelRgn pixel_rgn;
guchar *pixels;
guchar *pixel;
} channel_data;
/* Declare some local functions.
*/
static void query (void);
@ -57,6 +65,18 @@ static void run (char *name,
int *nreturn_vals,
GParam **return_vals);
static gint32 load_image (char *filename);
static void load_separate (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static void load_8bit (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static void load_default (TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra);
static gint save_image (char *filename,
gint32 image,
gint32 drawable);
@ -93,7 +113,7 @@ static TiffSaveInterface tsint =
FALSE /* run */
};
static char *image_comment;
static char *image_comment= NULL;
MAIN ()
@ -167,6 +187,9 @@ run (char *name,
static GParam values[2];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
#ifdef GIMP_HAVE_PARASITES
Parasite *parasite;
#endif /* GIMP_HAVE_PARASITES */
gint32 image;
run_mode = param[0].data.d_int32;
@ -194,29 +217,28 @@ run (char *name,
}
else if (strcmp (name, "file_tiff_save") == 0)
{
/* Do this right this time, if POSSIBLE query for parasites, otherwise
or if there isn't one, choose the DEFAULT_COMMENT */
#ifdef GIMP_HAVE_PARASITES
int image = param[1].data.d_int32;
/* get the image comment either from a parasite, or from our
* compiled-in default */
{
Parasite *parasite;
parasite = gimp_image_find_parasite(image, "gimp-comment");
if (!parasite_is_error(parasite))
image_comment = g_strdup(parasite->data);
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
image_comment = NULL;
parasite = gimp_image_find_parasite(image, "gimp-comment");
if (!parasite_is_error(parasite))
image_comment = g_strdup(parasite->data);
parasite_free(parasite);
if (!image_comment)
image_comment = g_strdup(DEFAULT_COMMENT);
}
if (!image_comment) image_comment = g_strdup(DEFAULT_COMMENT);
switch (run_mode)
{
case RUN_INTERACTIVE:
{
Parasite *parasite;
/* Possibly retrieve data */
gimp_get_data ("file_tiff_save", &tsvals);
#ifdef GIMP_HAVE_PARASITES
parasite = gimp_image_find_parasite(image, "tiff-save-options");
if (!parasite_is_error(parasite))
{
@ -224,6 +246,7 @@ run (char *name,
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
/* First acquire information with a dialog */
if (! save_dialog ())
@ -254,8 +277,8 @@ run (char *name,
case RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
{
Parasite *parasite;
gimp_get_data ("file_tiff_save", &tsvals);
#ifdef GIMP_HAVE_PARASITES
parasite = gimp_image_find_parasite(image, "tiff-save-options");
if (!parasite_is_error(parasite))
{
@ -263,6 +286,7 @@ run (char *name,
tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder;
}
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
}
break;
@ -285,42 +309,31 @@ run (char *name,
static gint32 load_image (char *filename) {
TIFF *tif;
unsigned short bps, spp, photomet;
int cols, rows, maxval, alpha;
unsigned short bps, spp, photomet, planar;
int cols, rows, alpha;
int image, layer, tile_height;
unsigned short *redmap, *greenmap, *bluemap;
guchar cmap[768];
int image_type= 0, layer_type= 0;
unsigned short extra, *extra_types;
int col, row, start, i, j;
unsigned char sample;
int bitsleft;
int gray_val, red_val, green_val, blue_val, alpha_val;
int i, j;
guchar *source, *s, *dest, *d;
GDrawable *drawable;
GPixelRgn pixel_rgn;
char *name;
guchar colors[3]= {0, 0, 0};
typedef struct {
gint32 ID;
GDrawable *drawable;
GPixelRgn pixel_rgn;
guchar *pixels;
guchar *pixel;
} channel_data;
channel_data *channel= NULL;
TiffSaveVals save_vals;
#ifdef GIMP_HAVE_PARASITES
Parasite *parasite;
#endif /* GIMP_HAVE_PARASITES */
guint16 tmp;
tif = TIFFOpen (filename, "r");
if (!tif) {
g_message("TIFF Can't open \n%s", filename);
g_message("TIFF Can't open %s\n", filename);
gimp_quit ();
}
@ -333,10 +346,12 @@ static gint32 load_image (char *filename) {
bps = 1;
if (bps > 8) {
g_message("TIFF Can't handle samples wider than 8-bit");
g_message("TIFF Can't handle samples wider than 8-bit\n");
gimp_quit();
}
if (!TIFFGetField (tif, TIFFTAG_PLANARCONFIG, &planar))
planar = PLANARCONFIG_SEPARATE;
if (!TIFFGetField (tif, TIFFTAG_SAMPLESPERPIXEL, &spp))
spp = 1;
if (!TIFFGetField (tif, TIFFTAG_EXTRASAMPLES, &extra, &extra_types))
@ -364,20 +379,19 @@ static gint32 load_image (char *filename) {
/* test if the extrasample represents an associated alpha channel... */
if (extra > 0 && (extra_types[0] == EXTRASAMPLE_ASSOCALPHA)) {
alpha = 1;
--extra;
} else {
alpha = 0;
}
if (photomet == PHOTOMETRIC_RGB && spp > extra + 3) {
extra= spp - 3;
if (photomet == PHOTOMETRIC_RGB && spp > 3 + extra) {
alpha= 1;
} else if (photomet != PHOTOMETRIC_RGB && spp > extra + 1) {
extra= spp - 1;
extra= spp - 4;
} else if (photomet != PHOTOMETRIC_RGB && spp > 1 + extra) {
alpha= 1;
extra= spp - 2;
}
maxval = (1 << bps) - 1;
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
@ -419,15 +433,18 @@ static gint32 load_image (char *filename) {
save_vals.fillorder = FILLORDER_LSB2MSB;
else
save_vals.fillorder = tmp;
#ifdef GIMP_HAVE_PARASITES
parasite = parasite_new("tiff-save-options", 0,
sizeof(save_vals), &save_vals);
gimp_image_attach_parasite(image, parasite);
parasite_free(parasite);
#endif /* GIMP_HAVE_PARASITES */
/* Attach a parasite containing the image description. Pretend to
* be a gimp comment so other plugins will use this description as
* an image comment where appropriate. */
#ifdef GIMP_HAVE_PARASITES
{
char *img_desc;
@ -444,8 +461,10 @@ static gint32 load_image (char *filename) {
parasite_free(parasite);
}
}
#endif /* GIMP_HAVE_PARASITES */
/* any resolution info in the file? */
#ifdef GIMP_HAVE_RESOLUTION_INFO
{
float xres=0, yres=0;
unsigned short units;
@ -508,7 +527,7 @@ static gint32 load_image (char *filename) {
should feel free to shoot the author of the broken program
that produced the damaged TIFF file in the first place. */
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */
/* Install colormap for INDEXED images only */
@ -518,12 +537,12 @@ static gint32 load_image (char *filename) {
gimp_quit ();
}
for (i = 0, j = 0; i <= maxval; i++) {
for (i = 0, j = 0; i < (1 << bps); i++) {
cmap[j++] = redmap[i] >> 8;
cmap[j++] = greenmap[i] >> 8;
cmap[j++] = bluemap[i] >> 8;
}
gimp_image_set_cmap (image, cmap, maxval + 1);
gimp_image_set_cmap (image, cmap, (1 << bps));
}
layer = gimp_layer_new (image, "Background", cols, rows, layer_type,
@ -531,25 +550,153 @@ static gint32 load_image (char *filename) {
gimp_image_add_layer (image, layer, 0);
drawable = gimp_drawable_get (layer);
source= g_new (guchar, TIFFScanlineSize (tif));
tile_height = gimp_tile_height ();
if (extra > 0) {
channel = g_new (channel_data, extra);
/* Add alpha channels as appropriate */
for (i= 0; i < extra; ++i) {
channel[i].ID= gimp_channel_new(image, "TIFF Channel", cols, rows,
100.0, colors);
gimp_image_add_channel(image, channel[i].ID, 0);
channel[i].drawable= gimp_drawable_get (channel[i].ID);
channel[i].pixels= g_new(guchar, tile_height * cols);
gimp_pixel_rgn_init (&(channel[i].pixel_rgn), channel[i].drawable, 0, 0,
cols, rows, TRUE, FALSE);
}
}
if (planar == PLANARCONFIG_SEPARATE) {
load_separate(tif, drawable, channel, bps, photomet,
rows, cols, alpha, extra);
} else if (bps == 8) {
load_8bit(tif, drawable, channel, bps, photomet, rows, cols, alpha, extra);
} else {
load_default(tif, drawable, channel, bps, photomet,
rows, cols, alpha, extra);
}
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
for (i= 0; i < extra; ++i) {
gimp_drawable_flush (channel[i].drawable);
gimp_drawable_detach (channel[i].drawable);
}
return image;
}
static void
load_8bit(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int gray_val, red_val, green_val, blue_val, alpha_val;
int col, row, start, i;
int tile_height = gimp_tile_height ();
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
if (extra - alpha > 0)
channel = g_new (channel_data, extra - alpha);
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
/* Add alpha channels as appropriate */
for (i= 0; alpha + i < extra; ++i) {
channel[i].ID= gimp_channel_new(image, "TIFF Channel", cols, rows,
100.0, colors);
gimp_image_add_channel(image, channel[i].ID, 0);
channel[i].drawable= gimp_drawable_get (channel[i].ID);
channel[i].pixels= g_new(guchar, tile_height * cols);
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
gimp_pixel_rgn_init (&(channel[i].pixel_rgn), channel[i].drawable, 0, 0,
cols, rows, TRUE, FALSE);
for (i= 0; i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
s= source;
for (col = 0; col < cols; col++) {
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
if (alpha) {
gray_val= *s++;
alpha_val= *s++;
if (alpha_val)
*d++ = gray_val * 255 / alpha_val;
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = *s++;
}
break;
case PHOTOMETRIC_MINISWHITE:
if (alpha) {
gray_val= *s++;
alpha_val= *s++;
if (alpha_val)
*d++ = ((255 - gray_val) * 255) / alpha_val;
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ~(*s++);
}
break;
case PHOTOMETRIC_PALETTE:
*d++= *s++;
if (alpha) *d++= *s++;
break;
case PHOTOMETRIC_RGB:
if (alpha) {
red_val= *s++;
green_val= *s++;
blue_val= *s++;
alpha_val= *s++;
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
*d++ = alpha_val;
} else {
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
}
break;
default:
/* This case was handled earlier */
g_assert_not_reached();
}
for (i= 0; i < extra; ++i) {
*channel[i].pixel++ = *s++;
}
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
for (i= 0; alpha + i < extra; ++i) {
gimp_pixel_rgn_set_rect(&(channel[i].pixel_rgn), channel[i].pixels,
0, start, cols, 1+row-start);
}
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
}
/* Step through all <= 8-bit samples in an image */
@ -564,121 +711,109 @@ static gint32 load_image (char *filename) {
var = ( *s >> bitsleft ) & maxval; \
}
static void
load_default(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int gray_val, red_val, green_val, blue_val, alpha_val;
int col, row, start, i;
int bitsleft, maxval = (1 << bps) - 1;
int tile_height = gimp_tile_height ();
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
/* Special cases: Scanline is compatible with GIMP storage */
if (extra == 0 && bps == 8) {
if (TIFFReadScanline (tif, d, row, 0) < 0) {
g_message("TIFF Bad data read on line %d", row);
gimp_quit ();
}
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Or read in and process each sample -- slower */
} else {
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
for (i= 0; i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
for (i= 0; alpha + i < extra; ++i) {
channel[i].pixel= channel[i].pixels + cols * (row % tile_height);
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
/* Set s/bitleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
switch (photomet) {
case PHOTOMETRIC_MINISBLACK:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = (gray_val * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = (gray_val * 255) / maxval;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
break;
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = (gray_val * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = (gray_val * 255) / maxval;
}
break;
case PHOTOMETRIC_MINISWHITE:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = ((maxval - gray_val) * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ((maxval - gray_val) * 255) / maxval;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
if (alpha_val)
*d++ = ((maxval - gray_val) * 65025) / (alpha_val * maxval);
else
*d++ = 0;
*d++ = alpha_val;
} else {
*d++ = ((maxval - gray_val) * 255) / maxval;
}
break;
case PHOTOMETRIC_PALETTE:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(*d++);
if (alpha) {
NEXTSAMPLE(*d++);
if (alpha) {
NEXTSAMPLE(*d++);
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
break;
case PHOTOMETRIC_RGB:
for (col = 0; col < cols; col++) {
NEXTSAMPLE(red_val)
NEXTSAMPLE(green_val)
NEXTSAMPLE(blue_val)
if (alpha) {
NEXTSAMPLE(alpha_val)
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
*d++ = alpha_val;
} else {
*d++ = red_val;
*d++ = green_val;
*d++ = blue_val;
NEXTSAMPLE(red_val)
NEXTSAMPLE(green_val)
NEXTSAMPLE(blue_val)
if (alpha) {
NEXTSAMPLE(alpha_val)
if (alpha_val) {
*d++ = (red_val * 255) / alpha_val;
*d++ = (green_val * 255) / alpha_val;
*d++ = (blue_val * 255) / alpha_val;
} else {
*d++ = 0;
*d++ = 0;
*d++ = 0;
}
for (i= 0; alpha + i < extra; ++i) {
NEXTSAMPLE(sample);
*channel[i].pixel++ = sample;
}
}
*d++ = alpha_val;
} else {
*d++ = red_val;
*d++ = green_val;
*d++ = blue_val;
}
break;
default:
/* This case was handled earlier */
g_assert_not_reached();
}
for (i= 0; i < extra; ++i) {
NEXTSAMPLE(alpha_val);
*channel[i].pixel++ = alpha_val;
}
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
@ -690,11 +825,155 @@ static gint32 load_image (char *filename) {
start= row + 1;
}
}
}
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
static void
load_separate(TIFF *tif, GDrawable *drawable,
channel_data *channel,
unsigned short bps, unsigned short photomet,
int rows, int cols, int alpha, int extra)
{
guchar *source, *dest, *s, *d;
GPixelRgn pixel_rgn;
int col, row, start;
int bitsleft, maxval = (1 << bps) - 1;
int tile_height = gimp_tile_height ();
return image;
TIFFPrintDirectory(tif, stdout, 0);
if (photomet != PHOTOMETRIC_RGB) {
g_message("So far PLANARCONFIG_SEPARATE only supports RGB images");
gimp_quit();
}
source= g_new (guchar, TIFFScanlineSize (tif));
dest = g_new (guchar, tile_height * cols * drawable->bpp);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, cols, rows, TRUE, FALSE);
/* RED channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if (TIFFReadScanline (tif, source, row, 0) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha)])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* GREEN channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 1) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha) + 1])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* BLUE channel */
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 2) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * (3 + alpha) + 2])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
/* ALPHA channel */
if (alpha) {
for (start= 0, row = 0; row < rows; ++row) {
d= dest + cols * (row % tile_height) * drawable->bpp;
if ((row % tile_height) == 0) {
if (rows - row < tile_height)
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, rows - row);
else
gimp_pixel_rgn_get_rect(&pixel_rgn, dest, 0, start, cols, tile_height);
gimp_progress_update ((double) row / (double) rows);
}
if (TIFFReadScanline (tif, source, row, 3) < 0) {
g_message("TIFF Bad data read on line %d\n", row);
gimp_quit ();
}
/* Set s/bitsleft ready to use NEXTSAMPLE macro */
s= source;
bitsleft= 8;
for (col = 0; col < cols; col++) {
NEXTSAMPLE(d[col * 4 + 3])
}
if (((row + 1) % tile_height) == 0 || row + 1 == rows) {
gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, start, cols, 1+row-start);
gimp_progress_update ((double) row / (double) rows);
start= row + 1;
}
}
}
}
/*
@ -851,6 +1130,7 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
/* TIFFSetField( tif, TIFFTAG_STRIPBYTECOUNTS, rows / rowsperstrip ); */
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
#ifdef GIMP_HAVE_RESOLUTION_INFO
/* resolution fields */
{
float resolution = gimp_image_get_resolution(image);
@ -861,10 +1141,12 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
}
}
#endif GIMP_HAVE_RESOLUTION_INFO
/* do we have a comment? If so, create a new parasite to hold it,
* and attach it to the image. The attach function automatically
* detaches a previous incarnation of the parasite. */
#ifdef GIMP_HAVE_PARASITES
if (image_comment && *image_comment != '\000')
{
Parasite *parasite;
@ -875,6 +1157,7 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
gimp_image_attach_parasite (image, parasite);
parasite_free (parasite);
}
#endif /* GIMP_HAVE_PARASITES */
if (drawable_type == INDEXED_IMAGE)
TIFFSetField (tif, TIFFTAG_COLORMAP, red, grn, blu);