Class BimodalTonalPalette
- java.lang.Object
-
- org.pushingpixels.ephemeral.chroma.palettes.BimodalTonalPalette
-
- All Implemented Interfaces:
BaseTonalPalette
public final class BimodalTonalPalette extends java.lang.Object implements BaseTonalPalette
A convenience class for retrieving colors that are sourced from an interpolation between two HCT seeds.BimodalTonalPalette is intended for use in a single thread due to its stateful caching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBimodalTonalPalette.TransitionRangestatic classBimodalTonalPalette.TransitionRangeBalancedDarkstatic classBimodalTonalPalette.TransitionRangeBalancedLightstatic classBimodalTonalPalette.TransitionRangeFidelityDarkstatic classBimodalTonalPalette.TransitionRangeFidelityLight
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,java.lang.Integer>cacheprivate TonalPalettepalette1private TonalPalettepalette2private BimodalTonalPalette.TransitionRangetransitionRange
-
Constructor Summary
Constructors Modifier Constructor Description privateBimodalTonalPalette(TonalPalette palette1, TonalPalette palette2, BimodalTonalPalette.TransitionRange transitionRange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BimodalTonalPalettefrom(Hct hct1, Hct hct2, BimodalTonalPalette.TransitionRange transitionRange)HctgetHct(double tone)Given a tone, use hue and chroma of palette to create a color, and return it as HCT.inttone(int tone)Create an ARGB color from this palette and the provided HCT tone.
-
-
-
Field Detail
-
palette1
private final TonalPalette palette1
-
palette2
private final TonalPalette palette2
-
transitionRange
private final BimodalTonalPalette.TransitionRange transitionRange
-
cache
private java.util.Map<java.lang.Integer,java.lang.Integer> cache
-
-
Constructor Detail
-
BimodalTonalPalette
private BimodalTonalPalette(TonalPalette palette1, TonalPalette palette2, BimodalTonalPalette.TransitionRange transitionRange)
-
-
Method Detail
-
from
public static BimodalTonalPalette from(Hct hct1, Hct hct2, BimodalTonalPalette.TransitionRange transitionRange)
-
tone
public int tone(int tone)
Description copied from interface:BaseTonalPaletteCreate an ARGB color from this palette and the provided HCT tone.- Specified by:
tonein interfaceBaseTonalPalette- Parameters:
tone- HCT tone, measured from 0 to 100.- Returns:
- ARGB representation of a color with that tone.
-
getHct
public Hct getHct(double tone)
Given a tone, use hue and chroma of palette to create a color, and return it as HCT.- Specified by:
getHctin interfaceBaseTonalPalette
-
-