    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint;
    018
    019import java.awt.Color;
    020
    021/**
    022 * Defines an interface for specifying color assignments to floating point values.
    023 */
    024public interface PaletteEntry {
    025
    026    /**
    027     * Indicates that the entry covers exactly one unique value (including, potentially, Float&#46;NaN).
    028     *
    029     * @return true if the entry covers exactly one unique value
    030     */
    031    boolean coversSingleEntry();
    032
    033    /**
    034     * Gets the integer ARGB color assignment associated with the input value. If the input value is not within the covered range of this instance, the return
    035     * value is undefined (though the value zero is often used).
    036     *
    037     * @param f valid floating point value, or a NaN.
    038     * @return an integer value
    039     */
    040    int getArgb(float f);
    041
    042    /**
    043     * Gets the color assignment associated with the input value. If the input value is not within the covered range of this instance, the return value is
    044     * undefined (though a null return is often used).
    045     *
    046     * @param f a valid floating point value, or a NaN.
    047     * @return a valid color instance or, potentially, a null if the floating point input is not within the covered range.
    048     */
    049    Color getColor(float f);
    050
    051    /**
    052     * Gets the lower-bound value for the palette entry
    053     *
    054     * @return if defined, a valid floating point value; otherwise, a null.
    055     */
    056    float getLowerBound();
    057
    058    /**
    059     * Gets the upper-bound value for the palette entry
    060     *
    061     * @return if defined, a valid floating point value; otherwise, a null.
    062     */
    063    float getUpperBound();
    064
    065    /**
    066     * Indicates whether the indicated floating-point value is within the range covered by this palette entry and can be assigned a valid color by the
    067     * implementation.
    068     *
    069     * @param f a valid floating point value, or a NaN.
    070     * @return true if the entry can assign a color to the entry; otherwise, false.
    071     */
    072    boolean isCovered(float f);
    073}