another special case fix from Nick Lamb. I said it before, and I'll say it

* plug-ins/tiff/tiff.c: another special case fix from Nick Lamb. I said it
before, and I'll say it again: TIFF sucks

* app/fuzzy_select.c: find_boundary works nicer in indexed mode

* app/paint_funcs.c: generate dissolve random number table better (thanks Owen)

* README: bring up to date

-Yosh
This commit is contained in:
Manish Singh
1998-05-02 07:44:58 +00:00
parent 96b1e436b9
commit f15158ace9
10 changed files with 131 additions and 26 deletions

View File

@ -1,3 +1,15 @@
Sat May 2 00:41:36 PDT 1998 Manish Singh <yosh@gimp.org>
* plug-ins/tiff/tiff.c: another special case fix from Nick Lamb.
I said it before, and I'll say it again: TIFF sucks
* app/fuzzy_select.c: find_boundary works nicer in indexed mode
* app/paint_funcs.c: generate dissolve random number table better
(thanks Owen)
* README: bring up to date
Fri May 1 23:09:33 EDT 1998 Matthew Wilson <msw@gimp.org>
* app/channels_dialog.c: handle double click on our own since

11
README
View File

@ -70,7 +70,7 @@ sure that it really is portable (we think we did it right) as well as
robust. It also will probably change sometime in (near) the future to
implement some form of compression for the tiles.
The GIMP's new home page is at
The GIMP's home page is at
http://www.gimp.org
@ -79,7 +79,7 @@ tutorials, news, etc. All things GIMP-ish are available from there.
The automated plug-in registry is located at
http://gimp.foebud.org/registry
http://registry.gimp.org
There you can get the latest versions of plug-ins using a convenient
forms-based interface.
@ -97,7 +97,6 @@ substituting <list-name> for "gimp-user" or "gimp-developer" (without
the quotes, of course) depending on the list you want to subscribe
to. The mailing list archives can be found at
http://www.levien.com/~gimp-dev/current/
http://www.findmail.com/listsaver/gimp-developer/
Gimp-user is a mailing list dedicated to user problems, hints and
@ -124,9 +123,9 @@ You can find them in the ps-menurc file. To use them, copy this file to
~/.gimp/menurc
We sincerely hope you enjoy the program. Please report problems to
gimp-developer@scam.xcf.berkeley.edu. Before reporting a problem, you
may want to see if someone else has already did (check the mailing
list archives for this).
bugs@gimp.org. Before reporting a problem, you may want to see if someone
else has already did (check the http://www.wilberworks.com/bugs.cgi for
this).
Have fun,

View File

@ -201,11 +201,13 @@ find_contiguous_segment (unsigned char *col, PixelRegion *src,
static void
find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
int has_alpha, int antialias, int threshold,
int has_alpha, int antialias, int threshold, int indexed,
int x, int y, unsigned char *col)
{
int start, end, i;
int val;
int bytes;
Tile *tile;
if (threshold == 0) threshold = 1;
@ -222,6 +224,13 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
src->x = x;
src->y = y;
bytes = src->bytes;
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
if ( ! find_contiguous_segment (col, src, mask, src->w,
src->bytes, has_alpha,
antialias, threshold, x, &start, &end))
@ -229,8 +238,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
for (i = start + 1; i < end; i++)
{
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y + 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y + 1, col);
}
}
@ -242,7 +251,9 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
Channel *mask;
unsigned char *start;
int has_alpha;
int indexed;
int type;
int bytes;
Tile *tile;
if (sample_merged)
@ -260,7 +271,13 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
drawable_width (drawable), drawable_height (drawable), FALSE);
has_alpha = drawable_has_alpha (drawable);
}
indexed = drawable_indexed (drawable);
bytes = drawable_bytes (drawable);
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
mask = channel_new_mask (gimage->ID, srcPR.w, srcPR.h);
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
@ -272,7 +289,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, x, y, start);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);
tile_unref (tile, FALSE);
}

View File

@ -325,6 +325,15 @@ paint_funcs_setup ()
srand (RANDOM_SEED);
for (i = 0; i < RANDOM_TABLE_SIZE; i++)
random_table[i] = rand ();
for (i = 0; i < RANDOM_TABLE_SIZE; i++)
{
int tmp;
int swap = i + rand () % (RANDOM_TABLE_SIZE - i);
tmp = random_table[i];
random_table[i] = random_table[swap];
random_table[swap] = tmp;
}
}

View File

@ -325,6 +325,15 @@ paint_funcs_setup ()
srand (RANDOM_SEED);
for (i = 0; i < RANDOM_TABLE_SIZE; i++)
random_table[i] = rand ();
for (i = 0; i < RANDOM_TABLE_SIZE; i++)
{
int tmp;
int swap = i + rand () % (RANDOM_TABLE_SIZE - i);
tmp = random_table[i];
random_table[i] = random_table[swap];
random_table[swap] = tmp;
}
}

View File

@ -201,11 +201,13 @@ find_contiguous_segment (unsigned char *col, PixelRegion *src,
static void
find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
int has_alpha, int antialias, int threshold,
int has_alpha, int antialias, int threshold, int indexed,
int x, int y, unsigned char *col)
{
int start, end, i;
int val;
int bytes;
Tile *tile;
if (threshold == 0) threshold = 1;
@ -222,6 +224,13 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
src->x = x;
src->y = y;
bytes = src->bytes;
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
if ( ! find_contiguous_segment (col, src, mask, src->w,
src->bytes, has_alpha,
antialias, threshold, x, &start, &end))
@ -229,8 +238,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
for (i = start + 1; i < end; i++)
{
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y + 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y + 1, col);
}
}
@ -242,7 +251,9 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
Channel *mask;
unsigned char *start;
int has_alpha;
int indexed;
int type;
int bytes;
Tile *tile;
if (sample_merged)
@ -260,7 +271,13 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
drawable_width (drawable), drawable_height (drawable), FALSE);
has_alpha = drawable_has_alpha (drawable);
}
indexed = drawable_indexed (drawable);
bytes = drawable_bytes (drawable);
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
mask = channel_new_mask (gimage->ID, srcPR.w, srcPR.h);
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
@ -272,7 +289,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, x, y, start);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);
tile_unref (tile, FALSE);
}

View File

@ -201,11 +201,13 @@ find_contiguous_segment (unsigned char *col, PixelRegion *src,
static void
find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
int has_alpha, int antialias, int threshold,
int has_alpha, int antialias, int threshold, int indexed,
int x, int y, unsigned char *col)
{
int start, end, i;
int val;
int bytes;
Tile *tile;
if (threshold == 0) threshold = 1;
@ -222,6 +224,13 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
src->x = x;
src->y = y;
bytes = src->bytes;
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
if ( ! find_contiguous_segment (col, src, mask, src->w,
src->bytes, has_alpha,
antialias, threshold, x, &start, &end))
@ -229,8 +238,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
for (i = start + 1; i < end; i++)
{
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y + 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y + 1, col);
}
}
@ -242,7 +251,9 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
Channel *mask;
unsigned char *start;
int has_alpha;
int indexed;
int type;
int bytes;
Tile *tile;
if (sample_merged)
@ -260,7 +271,13 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
drawable_width (drawable), drawable_height (drawable), FALSE);
has_alpha = drawable_has_alpha (drawable);
}
indexed = drawable_indexed (drawable);
bytes = drawable_bytes (drawable);
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
mask = channel_new_mask (gimage->ID, srcPR.w, srcPR.h);
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
@ -272,7 +289,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, x, y, start);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);
tile_unref (tile, FALSE);
}

View File

@ -201,11 +201,13 @@ find_contiguous_segment (unsigned char *col, PixelRegion *src,
static void
find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
int has_alpha, int antialias, int threshold,
int has_alpha, int antialias, int threshold, int indexed,
int x, int y, unsigned char *col)
{
int start, end, i;
int val;
int bytes;
Tile *tile;
if (threshold == 0) threshold = 1;
@ -222,6 +224,13 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
src->x = x;
src->y = y;
bytes = src->bytes;
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
if ( ! find_contiguous_segment (col, src, mask, src->w,
src->bytes, has_alpha,
antialias, threshold, x, &start, &end))
@ -229,8 +238,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
for (i = start + 1; i < end; i++)
{
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, i, y + 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y - 1, col);
find_contiguous_region_helper (mask, src, has_alpha, antialias, threshold, indexed, i, y + 1, col);
}
}
@ -242,7 +251,9 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
Channel *mask;
unsigned char *start;
int has_alpha;
int indexed;
int type;
int bytes;
Tile *tile;
if (sample_merged)
@ -260,7 +271,13 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
drawable_width (drawable), drawable_height (drawable), FALSE);
has_alpha = drawable_has_alpha (drawable);
}
indexed = drawable_indexed (drawable);
bytes = drawable_bytes (drawable);
if(indexed)
{
bytes = has_alpha ? 4 : 3;
}
mask = channel_new_mask (gimage->ID, srcPR.w, srcPR.h);
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
@ -272,7 +289,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, x, y, start);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);
tile_unref (tile, FALSE);
}

View File

@ -1,5 +1,7 @@
/* tiff loading and saving for the GIMP
* -Peter Mattis
* various fixes along the route to GIMP 1.0
* -Nick Lamb and others (list yourselves here people)
*
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
@ -310,6 +312,8 @@ load_image (char *filename)
else
alpha = 0;
if (spp > 3) alpha = 1; /* Kludge - like all the rest of this -- njl195 */
TIFFGetField (tif, TIFFTAG_IMAGEWIDTH, &cols);
TIFFGetField (tif, TIFFTAG_IMAGELENGTH, &rows);

View File

@ -1,5 +1,7 @@
/* tiff loading and saving for the GIMP
* -Peter Mattis
* various fixes along the route to GIMP 1.0
* -Nick Lamb and others (list yourselves here people)
*
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
@ -310,6 +312,8 @@ load_image (char *filename)
else
alpha = 0;
if (spp > 3) alpha = 1; /* Kludge - like all the rest of this -- njl195 */
TIFFGetField (tif, TIFFTAG_IMAGEWIDTH, &cols);
TIFFGetField (tif, TIFFTAG_IMAGELENGTH, &rows);