xref: /aosp_15_r20/external/libmonet/quantize/PointProvider.java (revision 970e10460f970939fd510dd6ad3e0d65908272e3)
1*970e1046SAndroid Build Coastguard Worker /*
2*970e1046SAndroid Build Coastguard Worker  * Copyright 2021 Google LLC
3*970e1046SAndroid Build Coastguard Worker  *
4*970e1046SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*970e1046SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*970e1046SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*970e1046SAndroid Build Coastguard Worker  *
8*970e1046SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*970e1046SAndroid Build Coastguard Worker  *
10*970e1046SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*970e1046SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*970e1046SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*970e1046SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*970e1046SAndroid Build Coastguard Worker  * limitations under the License.
15*970e1046SAndroid Build Coastguard Worker  */
16*970e1046SAndroid Build Coastguard Worker 
17*970e1046SAndroid Build Coastguard Worker package com.google.ux.material.libmonet.quantize;
18*970e1046SAndroid Build Coastguard Worker 
19*970e1046SAndroid Build Coastguard Worker /** An interface to allow use of different color spaces by quantizers. */
20*970e1046SAndroid Build Coastguard Worker public interface PointProvider {
21*970e1046SAndroid Build Coastguard Worker   /** The four components in the color space of an sRGB color. */
fromInt(int argb)22*970e1046SAndroid Build Coastguard Worker   public double[] fromInt(int argb);
23*970e1046SAndroid Build Coastguard Worker 
24*970e1046SAndroid Build Coastguard Worker   /** The ARGB (i.e. hex code) representation of this color. */
toInt(double[] point)25*970e1046SAndroid Build Coastguard Worker   public int toInt(double[] point);
26*970e1046SAndroid Build Coastguard Worker 
27*970e1046SAndroid Build Coastguard Worker   /**
28*970e1046SAndroid Build Coastguard Worker    * Squared distance between two colors. Distance is defined by scientific color spaces and
29*970e1046SAndroid Build Coastguard Worker    * referred to as delta E.
30*970e1046SAndroid Build Coastguard Worker    */
distance(double[] a, double[] b)31*970e1046SAndroid Build Coastguard Worker   public double distance(double[] a, double[] b);
32*970e1046SAndroid Build Coastguard Worker }
33