This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 5381c2dcc328739b9d82e462da5e2135a8d23c2a (commit) from cf7258563111632ca23dbf29221e16402dc50b24 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/5381c2dcc328739b9d82e462da5e2135a8d23...
commit 5381c2dcc328739b9d82e462da5e2135a8d23c2a Author: Cyril Hrubis metan@ucw.cz Date: Sat Jun 29 00:03:11 2013 +0200
loaders: TIFF: A few fixes.
Enable 1bpp
Fix MINISWHITE
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_TIFF.c b/libs/loaders/GP_TIFF.c index 6d12b2f..ac49d06 100644 --- a/libs/loaders/GP_TIFF.c +++ b/libs/loaders/GP_TIFF.c @@ -101,6 +101,38 @@ static const char *compression_name(uint16_t compression) return "Unknown"; }
+static const char *photometric_name(uint16_t photometric) +{ + switch (photometric) { + case PHOTOMETRIC_MINISWHITE: + return "Min is White"; + case PHOTOMETRIC_MINISBLACK: + return "Min is black"; + case PHOTOMETRIC_RGB: + return "RGB"; + case PHOTOMETRIC_PALETTE: + return "Palette"; + case PHOTOMETRIC_MASK: + return "Mask"; + case PHOTOMETRIC_SEPARATED: + return "Separated"; + case PHOTOMETRIC_YCBCR: + return "YCBCR"; + case PHOTOMETRIC_CIELAB: + return "CIELAB"; + case PHOTOMETRIC_ICCLAB: + return "ICCLAB"; + case PHOTOMETRIC_ITULAB: + return "ITULAB"; + case PHOTOMETRIC_LOGL: + return "LOGL"; + case PHOTOMETRIC_LOGLUV: + return "LOGLUV"; + default: + return "Unknown"; + } +} + struct tiff_header { /* compulsory tiff data */ uint32_t w, h; @@ -174,6 +206,9 @@ static GP_PixelType match_grayscale_pixel_type(TIFF *tiff, }
switch (header->bits_per_sample) { + case 1: + GP_DEBUG(1, "Have 1bit Bitmap"); + return GP_PIXEL_G1; case 2: GP_DEBUG(1, "Have 2bit Grayscale"); return GP_PIXEL_G2; @@ -220,21 +255,19 @@ static GP_PixelType match_pixel_type(TIFF *tiff, struct tiff_header *header) if (!TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &header->photometric)) return GP_PIXEL_UNKNOWN;
+ GP_DEBUG(1, "Have photometric %s", + photometric_name(header->photometric)); + switch (header->photometric) { /* 1-bit or 4, 8-bit grayscale */ - case 0: - case 1: + case PHOTOMETRIC_MINISWHITE: + case PHOTOMETRIC_MINISBLACK: return match_grayscale_pixel_type(tiff, header); - break; - /* RGB */ - case 2: + case PHOTOMETRIC_RGB: return match_rgb_pixel_type(tiff, header); - break; - /* Palette */ - case 3: - /* The palete is RGB161616 map it to BGR888 for now */ + /* The palete is RGB161616 map it to BGR888 for now */ + case PHOTOMETRIC_PALETTE: return GP_PIXEL_RGB888; - break; default: GP_DEBUG(1, "Unimplemented photometric interpretation %u", (unsigned) header->photometric); @@ -335,7 +368,7 @@ int tiff_read_palette(TIFF *tiff, GP_Context *res, struct tiff_header *header, int tiff_read(TIFF *tiff, GP_Context *res, struct tiff_header *header, GP_ProgressCallback *callback) { - uint32_t y; + uint32_t i, y; uint16_t planar_config, samples, s;
GP_DEBUG(1, "Reading tiff data"); @@ -395,6 +428,11 @@ int tiff_read(TIFF *tiff, GP_Context *res, struct tiff_header *header, default: break; } + + /* We need to negate the values when Min is White */ + if (header->photometric == PHOTOMETRIC_MINISWHITE) + for (i = 0; i < res->bytes_per_row; i++) + addr[i] = ~addr[i]; }
if (GP_ProgressCallbackReport(callback, y, res->h, res->w)) { @@ -433,8 +471,7 @@ GP_Context *GP_ReadTIFF(void *t, GP_ProgressCallback *callback) }
switch (header.photometric) { - /* Palette */ - case 3: + case PHOTOMETRIC_PALETTE: err = tiff_read_palette(t, res, &header, callback); break; default:
-----------------------------------------------------------------------
Summary of changes: libs/loaders/GP_TIFF.c | 63 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 50 insertions(+), 13 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.