Class ColorInterpolator


  • public final class ColorInterpolator
    extends Object
    Interpolate between two color values.

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision: 4763 $, $LastChangedDate: 2018-11-19 11:04:56 +0100 (Mon, 19 Nov 2018) $, by $Author: averbraeck $, initial version 27 mei 2015
    Author:
    Peter Knoppers
    • Method Detail

      • interpolateColor

        public static Color interpolateColor​(Color zero,
                                             Color one,
                                             double ratio)
        Generate a Color that is interpolated between two given Color values. Interpolation is simply done per channel (R, G, B).
        Parameters:
        zero - Color; the color that corresponds to ratio == 0
        one - Color; the color that corresponds to ratio == 1
        ratio - double; the ratio (should be between 0 and 1)
        Returns:
        Color; the interpolated color