diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-01-18 23:13:46 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-01-18 23:13:46 +0000 |
commit | 1f3a1e3f83772c4ccc91a723000fb2374014a4d2 (patch) | |
tree | b165bf15729fa287a73aaa13fb97333d3cafef85 /Build/source/libs/gd/libgd-src/src/gd_tiff.c | |
parent | be747857c72b720d2b81baead7c10f043e8a2588 (diff) |
libgd 2.2.4
git-svn-id: svn://tug.org/texlive/trunk@42987 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gd/libgd-src/src/gd_tiff.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/src/gd_tiff.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/Build/source/libs/gd/libgd-src/src/gd_tiff.c b/Build/source/libs/gd/libgd-src/src/gd_tiff.c index 26805ffcc4d..3f20c5b2645 100644 --- a/Build/source/libs/gd/libgd-src/src/gd_tiff.c +++ b/Build/source/libs/gd/libgd-src/src/gd_tiff.c @@ -29,6 +29,15 @@ */ /* $Id$ */ +/** + * File: TIFF IO + * + * Read and write TIFF images. + * + * There is only most basic support for the TIFF format available for now; + * for instance, multiple pages are not yet supported. + */ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -750,6 +759,7 @@ static int createFromTiffRgba(TIFF * tif, gdImagePtr im) int height = im->sy; uint32 *buffer; uint32 rgba; + int success; /* switch off colour merging on target gd image just while we write out * content - we want to preserve the alpha data until the user chooses @@ -762,18 +772,20 @@ static int createFromTiffRgba(TIFF * tif, gdImagePtr im) return GD_FAILURE; } - TIFFReadRGBAImage(tif, width, height, buffer, 0); - - for(y = 0; y < height; y++) { - for(x = 0; x < width; x++) { - /* if it doesn't already exist, allocate a new colour, - * else use existing one */ - rgba = buffer[(y * width + x)]; - a = (0xff - TIFFGetA(rgba)) / 2; - color = gdTrueColorAlpha(TIFFGetR(rgba), TIFFGetG(rgba), TIFFGetB(rgba), a); - - /* set pixel colour to this colour */ - gdImageSetPixel(im, x, height - y - 1, color); + success = TIFFReadRGBAImage(tif, width, height, buffer, 1); + + if (success) { + for(y = 0; y < height; y++) { + for(x = 0; x < width; x++) { + /* if it doesn't already exist, allocate a new colour, + * else use existing one */ + rgba = buffer[(y * width + x)]; + a = (0xff - TIFFGetA(rgba)) / 2; + color = gdTrueColorAlpha(TIFFGetR(rgba), TIFFGetG(rgba), TIFFGetB(rgba), a); + + /* set pixel colour to this colour */ + gdImageSetPixel(im, x, height - y - 1, color); + } } } @@ -781,7 +793,7 @@ static int createFromTiffRgba(TIFF * tif, gdImagePtr im) /* now reset colour merge for alpha blending routines */ gdImageAlphaBlending(im, alphaBlendingFlag); - return GD_SUCCESS; + return success; } /* |