Add alpha grayscale image support to TIFFReadRGBAImage

This commit is contained in:
Frank Warmerdam 2012-06-01 00:38:39 +00:00
parent 79a2449b27
commit 0dd52ae391
2 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2012-05-31 Frank Warmerdam <warmerdam@google.com>
* libtiff/tif_getimage.c: Add support for greyscale+alpha c/o Jérémie Laval.
http://bugzilla.maptools.org/show_bug.cgi?id=2398
2012-05-29 Frank Warmerdam <warmerdam@google.com>
* libtiff/tif_dir.c: avoid using specific set/get logic to process fields in custom directories,
@ -72,6 +77,7 @@
2011-12-22 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* libtiff/tif_win32.c: Eliminate some minor 64-bit warnings in
tif_win32.c. Patch by Edward Lam.
* configure.ac: Add libtiff private dependency on -llzma for

View File

@ -1,4 +1,4 @@
/* $Id: tif_getimage.c,v 1.79 2012-04-06 16:46:46 fwarmerdam Exp $ */
/* $Id: tif_getimage.c,v 1.80 2012-06-01 00:38:39 fwarmerdam Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -1208,6 +1208,26 @@ DECLAREContigPutFunc(putgreytile)
}
}
/*
* 8-bit greyscale with associated alpha => colormap/RGBA
*/
DECLAREContigPutFunc(putagreytile)
{
int samplesperpixel = img->samplesperpixel;
uint32** BWmap = img->BWmap;
(void) y;
while (h-- > 0) {
for (x = w; x-- > 0;)
{
*cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1);
pp += samplesperpixel;
}
cp += toskew;
pp += fromskew;
}
}
/*
* 16-bit greyscale => colormap/RGB
*/
@ -2473,6 +2493,9 @@ PickContigCase(TIFFRGBAImage* img)
img->put.contig = put16bitbwtile;
break;
case 8:
if (img->alpha && img->samplesperpixel == 2)
img->put.contig = putagreytile;
else
img->put.contig = putgreytile;
break;
case 4: