diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-10-16 22:01:06 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-10-25 22:11:54 +0200 |
commit | dbffea4ff7adeae96a635c4fc1e13504a6cf2ad6 (patch) | |
tree | 608a1f298f3334f20ca822b4d10ec2bab29ea15d /include | |
parent | a101366eeb06d375b32d96f305bce5bc131f7b03 (diff) | |
download | mupdf-dbffea4ff7adeae96a635c4fc1e13504a6cf2ad6.tar.xz |
Handle premultiplied alpha in pixmap color conversions (CMYK only).
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/geometry.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/mupdf/fitz/geometry.h b/include/mupdf/fitz/geometry.h index f04e8f1c..2314bea1 100644 --- a/include/mupdf/fitz/geometry.h +++ b/include/mupdf/fitz/geometry.h @@ -15,6 +15,14 @@ static inline int fz_mul255(int a, int b) } /* + Undo alpha premultiplication. +*/ +static inline int fz_div255(int c, int a) +{ + return a ? c * (255 * 256 / a) >> 8 : 0; +} + +/* Expand a value A from the 0...255 range to the 0..256 range */ #define FZ_EXPAND(A) ((A)+((A)>>7)) |