From 4cfdb3c09571c22206ca38f652283be7180f8636 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Thu, 26 Nov 2009 11:49:37 -0600 Subject: [PATCH] [devel] Add comment about TODO: issue warning if user tries to premultiply in a nonliner colorspace. --- pngread.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pngread.c b/pngread.c index 0afec895d..96b844f07 100644 --- a/pngread.c +++ b/pngread.c @@ -425,6 +425,24 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr) else png_warning(png_ptr, "Ignoring extra png_read_update_info() call; row buffer not reallocated"); + +#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA) + { + /* TO DO: + * Check for linear colorspace and if not, issue a warning. + * If gAMA is present with gamma == 1.0, it's linear. + * If iCCP is present, assume user knows what they are doing + * and it's linear. + * If gAMA is present with gamma != 1.0, it's not linear. + * If no gAMA or iCCP, assume not linear. + * If not linear do: + * png_warning(png_ptr, + * "Premultiply should only be used with gamma == 1.0"); + */ + } +#endif + png_read_transform_info(png_ptr, info_ptr); }