| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | #ifndef _MAGICKCORE_COLORSPACE_PRIVATE_H |
|---|
| 19 | #define _MAGICKCORE_COLORSPACE_PRIVATE_H |
|---|
| 20 | |
|---|
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 22 | extern "C" { |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | #include <magick/pixel.h> |
|---|
| 26 | |
|---|
| 27 | static inline void ConvertRGBToCMYK(MagickPixelPacket *pixel) |
|---|
| 28 | { |
|---|
| 29 | MagickRealType |
|---|
| 30 | black, |
|---|
| 31 | cyan, |
|---|
| 32 | magenta, |
|---|
| 33 | yellow; |
|---|
| 34 | |
|---|
| 35 | cyan=(MagickRealType) (QuantumRange-pixel->red); |
|---|
| 36 | magenta=(MagickRealType) (QuantumRange-pixel->green); |
|---|
| 37 | yellow=(MagickRealType) (QuantumRange-pixel->blue); |
|---|
| 38 | black=(MagickRealType) QuantumRange; |
|---|
| 39 | if (cyan < black) |
|---|
| 40 | black=cyan; |
|---|
| 41 | if (magenta < black) |
|---|
| 42 | black=magenta; |
|---|
| 43 | if (yellow < black) |
|---|
| 44 | black=yellow; |
|---|
| 45 | if (black == QuantumRange) |
|---|
| 46 | { |
|---|
| 47 | cyan=0.0; |
|---|
| 48 | magenta=0.0; |
|---|
| 49 | yellow=0.0; |
|---|
| 50 | } |
|---|
| 51 | else |
|---|
| 52 | { |
|---|
| 53 | cyan=(MagickRealType) (QuantumRange*(cyan-black)/ |
|---|
| 54 | (QuantumRange-black)); |
|---|
| 55 | magenta=(MagickRealType) (QuantumRange*(magenta-black)/ |
|---|
| 56 | (QuantumRange-black)); |
|---|
| 57 | yellow=(MagickRealType) (QuantumRange*(yellow-black)/ |
|---|
| 58 | (QuantumRange-black)); |
|---|
| 59 | } |
|---|
| 60 | pixel->colorspace=CMYKColorspace; |
|---|
| 61 | pixel->red=cyan; |
|---|
| 62 | pixel->green=magenta; |
|---|
| 63 | pixel->blue=yellow; |
|---|
| 64 | pixel->index=black; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 68 | } |
|---|
| 69 | #endif |
|---|
| 70 | |
|---|
| 71 | #endif |
|---|