mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-02-26 13:52:49 +01:00
Add support for the sRGB chunk in PNG files in addition to the cHRM and gAMA
chunks.
This commit is contained in:
parent
3f4308b68d
commit
9a5c5ec65d
@ -2665,6 +2665,7 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
num_colors = 0, // Number of colors
|
num_colors = 0, // Number of colors
|
||||||
linesize; // Bytes per line
|
linesize; // Bytes per line
|
||||||
bool alpha; // Alpha transparency?
|
bool alpha; // Alpha transparency?
|
||||||
|
int srgb_intent; // sRGB color?
|
||||||
png_color *palette; // Color palette information
|
png_color *palette; // Color palette information
|
||||||
int num_palette; // Number of colors
|
int num_palette; // Number of colors
|
||||||
int num_trans; // Number of transparent colors
|
int num_trans; // Number of transparent colors
|
||||||
@ -2771,8 +2772,14 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
pdfio_obj_t *icc_obj = pdfioFileCreateICCObjFromData(dict->pdf, icc_data, icc_datalen, num_colors);
|
pdfio_obj_t *icc_obj = pdfioFileCreateICCObjFromData(dict->pdf, icc_data, icc_datalen, num_colors);
|
||||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromICCObj(dict->pdf, icc_obj));
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromICCObj(dict->pdf, icc_obj));
|
||||||
}
|
}
|
||||||
|
else if (png_get_sRGB(pp, info, &srgb_intent))
|
||||||
|
{
|
||||||
|
PDFIO_DEBUG("copy_png: Explicit sRGB\n");
|
||||||
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromStandard(dict->pdf, num_colors, PDFIO_CS_SRGB));
|
||||||
|
}
|
||||||
else if (png_get_cHRM(pp, info, &wx, &wy, &rx, &ry, &gx, &gy, &bx, &by) && png_get_gAMA(pp, info, &gamma))
|
else if (png_get_cHRM(pp, info, &wx, &wy, &rx, &ry, &gx, &gy, &bx, &by) && png_get_gAMA(pp, info, &gamma))
|
||||||
{
|
{
|
||||||
|
PDFIO_DEBUG("copy_png: Color primaries [%g %g %g %g %g %g %g %g], gamma %g\n", wx, wy, rx, ry, gx, gy, bx, by, gamma);
|
||||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPrimaries(dict->pdf, num_colors, gamma, wx, wy, rx, ry, gx, gy, bx, by));
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPrimaries(dict->pdf, num_colors, gamma, wx, wy, rx, ry, gx, gy, bx, by));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user