Class RGBChannelNames
Object
RGBChannelNames
Constants for referring to the channels in a RGB-stack or RGBA-stack.
- Author:
- Owen Feehan
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
asArray
(boolean includeAlpha) Creates an array with all channel-names in R-G-B order.asList
(boolean includeAlpha) Creates a list with all channel-names in R-G-B order.asSet
(boolean includeAlpha) Creates a set of the channel names.deriveIndex
(String channelName) Derives the index of a channel for a channel name.static boolean
isValidName
(String channelName, boolean includeAlpha) Whether the channel-name is one of red, green, or blue, or alpha.static boolean
isValidNameSet
(Set<String> channelNames) Do the channel-names correspond exactly to those expected either RGB or RGBA.static boolean
isValidNameSet
(Set<String> channelNames, boolean includeAlpha) Do the channel-names correspond exactly to those expected for one of RGB or RGBA.
-
Field Details
-
RED
Name for the red channel.- See Also:
-
GREEN
Name for the green channel.- See Also:
-
BLUE
Name for the blue channel.- See Also:
-
ALPHA
Name for the alpha channel.- See Also:
-
-
Method Details
-
asArray
Creates an array with all channel-names in R-G-B order.- Parameters:
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not accepted.- Returns:
- the array.
-
asList
Creates a list with all channel-names in R-G-B order.- Parameters:
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not accepted.- Returns:
- the list.
-
asSet
Creates a set of the channel names.- Parameters:
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not accepted.- Returns:
- the set.
-
deriveIndex
Derives the index of a channel for a channel name.Names match only if lower-case.
- Parameters:
channelName
- the name of the channel- Returns:
- 0 for red, 1 for green, 2 for blue or
Optional.empty()
if name is anything else.
-
isValidName
Whether the channel-name is one of red, green, or blue, or alpha.Names match only if lower-case.
- Parameters:
channelName
- name to check if it is valid.includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not accepted.- Returns:
- true iff
channelName
is red, green, or blue.
-
isValidNameSet
Do the channel-names correspond exactly to those expected either RGB or RGBA.- Parameters:
channelNames
- the channel names to check.- Returns:
- true if there are exactly the expected number of channel-names, and they correspond exactly to the expected names (which are lower-case).
-
isValidNameSet
Do the channel-names correspond exactly to those expected for one of RGB or RGBA.- Parameters:
channelNames
- the channel names to check.includeAlpha
- if true, expect RGBA. if false, expect RGB.- Returns:
- true if there are exactly the expected number of channel-names, and they correspond exactly to the expected names (which are lower-case).
-