1 50 51 package com.lowagie.text.pdf; 52 53 57 public class CMYKColor extends ExtendedColor { 58 59 private static final long serialVersionUID = 5940378778276468452L; 60 float cyan; 61 float magenta; 62 float yellow; 63 float black; 64 65 72 public CMYKColor(int intCyan, int intMagenta, int intYellow, int intBlack) { 73 this((float)intCyan / 255f, (float)intMagenta / 255f, (float)intYellow / 255f, (float)intBlack / 255f); 74 } 75 76 83 public CMYKColor(float floatCyan, float floatMagenta, float floatYellow, float floatBlack) { 84 super(TYPE_CMYK, 1f - floatCyan - floatBlack, 1f - floatMagenta - floatBlack, 1f - floatYellow - floatBlack); 85 cyan = normalize(floatCyan); 86 magenta = normalize(floatMagenta); 87 yellow = normalize(floatYellow); 88 black = normalize(floatBlack); 89 } 90 91 94 public float getCyan() { 95 return cyan; 96 } 97 98 101 public float getMagenta() { 102 return magenta; 103 } 104 105 108 public float getYellow() { 109 return yellow; 110 } 111 112 115 public float getBlack() { 116 return black; 117 } 118 119 public boolean equals(Object obj) { 120 if (!(obj instanceof CMYKColor)) 121 return false; 122 CMYKColor c2 = (CMYKColor)obj; 123 return (cyan == c2.cyan && magenta == c2.magenta && yellow == c2.yellow && black == c2.black); 124 } 125 126 public int hashCode() { 127 return Float.floatToIntBits(cyan) ^ Float.floatToIntBits(magenta) ^ Float.floatToIntBits(yellow) ^ Float.floatToIntBits(black); 128 } 129 130 } 131 | Popular Tags |