1 50 51 package com.lowagie.text.pdf; 52 53 57 public class GrayColor extends ExtendedColor { 58 59 private static final long serialVersionUID = -6571835680819282746L; 60 61 private float gray; 62 63 public static final GrayColor GRAYBLACK = new GrayColor(0f); 64 public static final GrayColor GRAYWHITE = new GrayColor(1f); 65 66 public GrayColor(int intGray) { 67 this((float)intGray / 255f); 68 } 69 70 public GrayColor(float floatGray) { 71 super(TYPE_GRAY, floatGray, floatGray, floatGray); 72 gray = normalize(floatGray); 73 } 74 75 public float getGray() { 76 return gray; 77 } 78 79 public boolean equals(Object obj) { 80 return obj instanceof GrayColor && ((GrayColor)obj).gray == this.gray; 81 } 82 83 public int hashCode() { 84 return Float.floatToIntBits(gray); 85 } 86 87 } 88 | Popular Tags |