001/*******************************************************************************
002 * This software is provided as a supplement to the authors' textbooks on digital
003 *  image processing published by Springer-Verlag in various languages and editions.
004 * Permission to use and distribute this software is granted under the BSD 2-Clause 
005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 
006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 
007 * Visit http://imagingbook.com for additional details.
008 *******************************************************************************/
009
010package imagingbook.pub.color.image;
011
012public abstract class ChromaticAdaptation {
013        
014        protected float[] white1 = null;
015        protected float[] white2 = null;
016
017        // actual transformation of color coordinates.
018        // XYZ1 are interpreted relative to white point W1.
019        // Returns a new color adapted to white point W2.
020        public abstract float[] apply (float[] XYZ1);
021        
022        protected ChromaticAdaptation() {
023        }
024
025        protected ChromaticAdaptation (float[] white1, float[] white2) {
026                this.white1 = white1.clone();
027                this.white2 = white2.clone();
028        }
029        
030        protected ChromaticAdaptation(Illuminant illum1, Illuminant illum2) {
031                this(illum1.getXyzFloat(), illum2.getXyzFloat());
032        }
033
034        public float[] getSourceWhite() {
035                return white1;
036        }
037        
038        public float[] getTargetWhite() {
039                return white2;
040        }
041
042}