1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 package org.apache.commons.imaging.color; 16 17 /** 18 * Represents a color in the DIN99 color space, a derivation of the CIE LAB color space. 19 * 20 * @see <a href="de.wikipedia.org/wiki/DIN99-Farbraum">de.wikipedia.org/wiki/DIN99-Farbraum</a> 21 * @see <a href= "https://pdfs.semanticscholar.org/647b/20bda458133ff2b883041746bc8cb75527fc.pdf">Comparison of the metrics between the CIELAB and the DIN99 22 * uniform color spaces</a> 23 * @see <a href="https://www.researchgate.net/publication/229891006_Uniform_colour_spaces_based_on_the_DIN99_colour-difference_formula">DIN99b P.284: 24 * Uniform_colour_spaces_based_on_the_DIN99_colour-difference_formula</a> 25 * @since 1.0-alpha3 26 */ 27 public final class ColorDin99Lab { 28 29 public final double l99; 30 31 public final double a99; 32 33 public final double b99; 34 35 public ColorDin99Lab(final double l99, final double a99, final double b99) { 36 this.l99 = l99; 37 this.a99 = a99; 38 this.b99 = b99; 39 } 40 41 @Override 42 public boolean equals(final Object o) { 43 if (this == o) { 44 return true; 45 } 46 if (o == null || getClass() != o.getClass()) { 47 return false; 48 } 49 50 final ColorDin99Lab that = (ColorDin99Lab) o; 51 if (Double.compare(that.l99, l99) != 0) { 52 return false; 53 } 54 if (Double.compare(that.a99, a99) != 0) { 55 return false; 56 } 57 if (Double.compare(that.b99, b99) != 0) { 58 return false; 59 } 60 61 return true; 62 } 63 64 @Override 65 public int hashCode() { 66 int result; 67 long temp; 68 temp = Double.doubleToLongBits(l99); 69 result = (int) (temp ^ temp >>> 32); 70 temp = Double.doubleToLongBits(a99); 71 result = 31 * result + (int) (temp ^ temp >>> 32); 72 temp = Double.doubleToLongBits(b99); 73 return 31 * result + (int) (temp ^ temp >>> 32); 74 } 75 76 @Override 77 public String toString() { 78 return "{l: " + l99 + ", a: " + a99 + ", b: " + b99 + "}"; 79 } 80 }