public class RGBChannelNames extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ALPHA
Name for the alpha channel.
|
static String |
BLUE
Name for the blue channel.
|
static String |
GREEN
Name for the green channel.
|
static String |
RED
Name for the red channel.
|
Modifier and Type | Method and Description |
---|---|
static String[] |
asArray(boolean includeAlpha)
Creates an array with all channel-names in R-G-B order.
|
static List<String> |
asList(boolean includeAlpha)
Creates a list with all channel-names in R-G-B order.
|
static Set<String> |
asSet(boolean includeAlpha)
Creates a set of the channel names.
|
static Optional<Integer> |
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.
|
public static final String RED
public static final String GREEN
public static final String BLUE
public static final String ALPHA
public static String[] asArray(boolean includeAlpha)
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not
accepted.public static List<String> asList(boolean includeAlpha)
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not
accepted.public static Set<String> asSet(boolean includeAlpha)
includeAlpha
- if true, the alpha channel is also accepted as valid. if false, it is not
accepted.public static Optional<Integer> deriveIndex(String channelName)
Names match only if lower-case.
channelName
- the name of the channelOptional.empty()
if name is anything
else.public static boolean isValidName(String channelName, boolean includeAlpha)
Names match only if lower-case.
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.channelName
is red, green, or blue.public static boolean isValidNameSet(Set<String> channelNames)
channelNames
- the channel names to check.public static boolean isValidNameSet(Set<String> channelNames, boolean includeAlpha)
channelNames
- the channel names to check.includeAlpha
- if true, expect RGBA. if false, expect RGB.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.