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, generate has been updated
via 6e824825b32a4d3ed3fc9b7e41dee600d010b093 (commit)
from efe1e66de81808a60c5c3d3e91ae50eb973cf733 (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/6e824825b32a4d3ed3fc9b7e41dee600d010…
commit 6e824825b32a4d3ed3fc9b7e41dee600d010b093
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Sep 22 21:31:53 2011 +0200
Add support for png 1BPP palette (eg. black&white).
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index a533287..50395b4 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -108,7 +108,8 @@ GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res)
png_get_IHDR(png, png_info, &w, &h, &depth,
&color_type, NULL, NULL, NULL);
- GP_DEBUG(2, "Have %s PNG%s size %ux%u depth %i",
+ GP_DEBUG(2, "Have %s%s PNG%s size %ux%u depth %i",
+ color_type & PNG_COLOR_MASK_PALETTE ? "pallete " : "",
color_type & PNG_COLOR_MASK_COLOR ? "color" : "gray",
color_type & PNG_COLOR_MASK_ALPHA ? " with alpha channel" : "",
w, h, depth);
@@ -140,6 +141,17 @@ GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res)
break;
}
break;
+ case PNG_COLOR_TYPE_PALETTE:
+ /* Grayscale with BPP < 8 is usually saved as palette */
+ if (png_get_channels(png, png_info) == 1) {
+ switch (depth) {
+ case 1:
+ png_set_packswap(png);
+ pixel_type = GP_PIXEL_G1;
+ break;
+ }
+ }
+ break;
}
if (pixel_type == GP_PIXEL_UNKNOWN) {
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_PNG.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")