Merge pull request #2699 from uploadcare/better-cmyk

Convert CMYK to RGB like Google Chrome
This commit is contained in:
Alexander Karpinsky 2017-08-31 16:45:57 +03:00 committed by GitHub
commit 4029998d4f

View File

@ -536,12 +536,15 @@ rgb2cmyk(UINT8* out, const UINT8* in, int xsize)
static void
cmyk2rgb(UINT8* out, const UINT8* in, int xsize)
{
int x;
for (x = 0; x < xsize; x++, in += 4) {
*out++ = CLIP(255 - (in[0] + in[3]));
*out++ = CLIP(255 - (in[1] + in[3]));
*out++ = CLIP(255 - (in[2] + in[3]));
*out++ = 255;
int x, nk, tmp;
for (x = 0; x < xsize; x++) {
nk = 255 - in[3];
out[0] = CLIP(nk - MULDIV255(in[0], nk, tmp));
out[1] = CLIP(nk - MULDIV255(in[1], nk, tmp));
out[2] = CLIP(nk - MULDIV255(in[2], nk, tmp));
out[3] = 255;
out += 4;
in += 4;
}
}