Package net.paulhertz.pixelaudio
Enum Class PixelAudioMapper.ChannelNames
java.lang.Object
java.lang.Enum<PixelAudioMapper.ChannelNames>
net.paulhertz.pixelaudio.PixelAudioMapper.ChannelNames
- All Implemented Interfaces:
Serializable,Comparable<PixelAudioMapper.ChannelNames>,Constable
- Enclosing class:
- PixelAudioMapper
List of available color channels, "L" for lightness, since "B" for brightness is taken.
The expanded enum type allows me to provide some additional information, including extraction
methods for each channel. These all require a float[3] hsbPixel argument. Because of the
overhead involved in allocation of the hsbPixel array, callers are advised to make it
reusable for tight loops or to use the other extraction methods in the PixelAudioMapper class.
At the moment, I regard the extraction methods as experimental, but they may be worth
extending in the future, to have a single entry point for all color channel operations.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final PixelAudioMapper.ChannelNames.ChannelExtractorprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateChannelNames(String displayName, int index, PixelAudioMapper.ChannelNames.ChannelExtractor extractor) -
Method Summary
Modifier and TypeMethodDescriptionfloatextract(int rgb, float[] hsbPixel) intgetIndex()Returns the enum constant of this class with the specified name.static PixelAudioMapper.ChannelNames[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
R
-
G
-
B
-
H
-
S
-
L
-
A
-
ALL
-
-
Field Details
-
displayName
-
index
private final int index -
extractor
-
-
Constructor Details
-
ChannelNames
private ChannelNames(String displayName, int index, PixelAudioMapper.ChannelNames.ChannelExtractor extractor)
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getDisplayName
-
getIndex
public int getIndex() -
extract
public float extract(int rgb, float[] hsbPixel)
-