Class ColorInfo
ColorInfo is used to interpret a color: color type + alpha type + color space.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDescribes how to interpret the alpha component of a pixel.static @interfaceDescribes how pixel bits encode color.static @interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAlpha types.static final intAlpha types.static final intAlpha types.static final intAlpha types.static final intCompression types.static final intCompression types.static final intCompression types.static final intCompression types.static final intCompression types.static final intAliases.static final intAliases.static final intAliases.static final intSpecial format for big-endian CPU; GPU does not support this.static final intstatic final intstatic final intstatic final intSpecial format for big-endian CPU; GPU does not support this.static final intColor types.static final intstatic final intstatic final intA runtime alias based on host endianness, packed as(b << 0) | (g << 8) | (r << 16) | (a << 24)an uint32 value.static final intstatic final intstatic final intstatic final intstatic final intColor types.static final intstatic final intAliases.static final intAliases.static final intAliases.static final intAliases.static final intstatic final intColor types.static final intstatic final intstatic final intstatic final intstatic final intstatic final intA runtime alias based on host endianness, packed as(r << 0) | (g << 8) | (b << 16) | (a << 24)an uint32 value.static final intstatic final intstatic final intstatic final intstatic final intstatic final intColor types. -
Method Summary
Modifier and TypeMethodDescriptionstatic intbytesPerPixel(int ct) Returns the number of bytes required to store a pixel.static intcolorTypeChannelFlags(int ct) static intReturns the number of color types but avoids inlining at compile-time.static booleancolorTypeIsAlphaOnly(int ct) static StringcolorTypeToString(int ct) static intmaxBitsPerChannel(int ct) static intvalidateAlphaType(int ct, int at) Returns a valid AlphaType for ct.
-
Field Details
-
COMPRESSION_NONE
public static final int COMPRESSION_NONECompression types.Core GL_COMPRESSED_* VK_FORMAT_*_BLOCK ETC2_RGB8_UNORM RGB8_ETC2 ETC2_R8G8B8_UNORM BC1_RGB8_UNORM RGB_S3TC_DXT1_EXT BC1_RGB_UNORM BC1_RGBA8_UNORM RGBA_S3TC_DXT1_EXT BC1_RGBA_UNORM - See Also:
-
COMPRESSION_ETC2_RGB8_UNORM
public static final int COMPRESSION_ETC2_RGB8_UNORMCompression types.Core GL_COMPRESSED_* VK_FORMAT_*_BLOCK ETC2_RGB8_UNORM RGB8_ETC2 ETC2_R8G8B8_UNORM BC1_RGB8_UNORM RGB_S3TC_DXT1_EXT BC1_RGB_UNORM BC1_RGBA8_UNORM RGBA_S3TC_DXT1_EXT BC1_RGBA_UNORM - See Also:
-
COMPRESSION_BC1_RGB8_UNORM
public static final int COMPRESSION_BC1_RGB8_UNORMCompression types.Core GL_COMPRESSED_* VK_FORMAT_*_BLOCK ETC2_RGB8_UNORM RGB8_ETC2 ETC2_R8G8B8_UNORM BC1_RGB8_UNORM RGB_S3TC_DXT1_EXT BC1_RGB_UNORM BC1_RGBA8_UNORM RGBA_S3TC_DXT1_EXT BC1_RGBA_UNORM - See Also:
-
COMPRESSION_BC1_RGBA8_UNORM
public static final int COMPRESSION_BC1_RGBA8_UNORMCompression types.Core GL_COMPRESSED_* VK_FORMAT_*_BLOCK ETC2_RGB8_UNORM RGB8_ETC2 ETC2_R8G8B8_UNORM BC1_RGB8_UNORM RGB_S3TC_DXT1_EXT BC1_RGB_UNORM BC1_RGBA8_UNORM RGBA_S3TC_DXT1_EXT BC1_RGBA_UNORM - See Also:
-
COMPRESSION_COUNT
public static final int COMPRESSION_COUNTCompression types.Core GL_COMPRESSED_* VK_FORMAT_*_BLOCK ETC2_RGB8_UNORM RGB8_ETC2 ETC2_R8G8B8_UNORM BC1_RGB8_UNORM RGB_S3TC_DXT1_EXT BC1_RGB_UNORM BC1_RGBA8_UNORM RGBA_S3TC_DXT1_EXT BC1_RGBA_UNORM - See Also:
-
AT_UNKNOWN
public static final int AT_UNKNOWNAlpha types.Describes how to interpret the alpha component of a pixel. A pixel may be opaque, or alpha, describing multiple levels of transparency.
In simple blending, alpha weights the source color and the destination color to create a new color. If alpha describes a weight from zero to one:
result color = source color * alpha + destination color * (1 - alpha)
In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
RGB may have alpha included in each component value; the stored value is the original RGB multiplied by alpha. Premultiplied color components improve performance, but it will reduce the image quality. The usual practice is to premultiply alpha in the GPU, since they were converted into floating-point values.
- See Also:
-
AT_OPAQUE
public static final int AT_OPAQUEAlpha types.Describes how to interpret the alpha component of a pixel. A pixel may be opaque, or alpha, describing multiple levels of transparency.
In simple blending, alpha weights the source color and the destination color to create a new color. If alpha describes a weight from zero to one:
result color = source color * alpha + destination color * (1 - alpha)
In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
RGB may have alpha included in each component value; the stored value is the original RGB multiplied by alpha. Premultiplied color components improve performance, but it will reduce the image quality. The usual practice is to premultiply alpha in the GPU, since they were converted into floating-point values.
- See Also:
-
AT_PREMUL
public static final int AT_PREMULAlpha types.Describes how to interpret the alpha component of a pixel. A pixel may be opaque, or alpha, describing multiple levels of transparency.
In simple blending, alpha weights the source color and the destination color to create a new color. If alpha describes a weight from zero to one:
result color = source color * alpha + destination color * (1 - alpha)
In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
RGB may have alpha included in each component value; the stored value is the original RGB multiplied by alpha. Premultiplied color components improve performance, but it will reduce the image quality. The usual practice is to premultiply alpha in the GPU, since they were converted into floating-point values.
- See Also:
-
AT_UNPREMUL
public static final int AT_UNPREMULAlpha types.Describes how to interpret the alpha component of a pixel. A pixel may be opaque, or alpha, describing multiple levels of transparency.
In simple blending, alpha weights the source color and the destination color to create a new color. If alpha describes a weight from zero to one:
result color = source color * alpha + destination color * (1 - alpha)
In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
RGB may have alpha included in each component value; the stored value is the original RGB multiplied by alpha. Premultiplied color components improve performance, but it will reduce the image quality. The usual practice is to premultiply alpha in the GPU, since they were converted into floating-point values.
- See Also:
-
CT_UNKNOWN
public static final int CT_UNKNOWNColor types.Describes a layout of pixel data in CPU or GPU memory. A pixel may be an alpha mask, a grayscale, RGB, or RGBA. It specifies the channels, their type, and width. It does not refer to a texture format and the mapping to texture formats may be many-to-many. It does not specify the sRGB encoding of the stored values.
Color types are divided into two classes: array and packed.
For array types, the components are listed in order of where they appear in memory. For example,CT_RGBA_8888means that the pixel memory should be interpreted as an array of uint8 values, and the R channel appears at the first uint8 value. This is the same naming convention as Vulkan.
For packed types, the first component appear in the least-significant bits. For example,CT_BGR_565means that each pixel is packed as(b << 0) | (g << 5) | (r << 11), an uint16 value. This is in the reverse order of Vulkan's naming convention.Note that if bytes-per-pixel of a color type is 1, 2, 4, or 8, then Arc3D requires pixel memory to be aligned to bytes-per-pixel, otherwise it should be aligned to the size of data type as normal.
- See Also:
-
CT_BGR_565
public static final int CT_BGR_565Color types.Describes a layout of pixel data in CPU or GPU memory. A pixel may be an alpha mask, a grayscale, RGB, or RGBA. It specifies the channels, their type, and width. It does not refer to a texture format and the mapping to texture formats may be many-to-many. It does not specify the sRGB encoding of the stored values.
Color types are divided into two classes: array and packed.
For array types, the components are listed in order of where they appear in memory. For example,CT_RGBA_8888means that the pixel memory should be interpreted as an array of uint8 values, and the R channel appears at the first uint8 value. This is the same naming convention as Vulkan.
For packed types, the first component appear in the least-significant bits. For example,CT_BGR_565means that each pixel is packed as(b << 0) | (g << 5) | (r << 11), an uint16 value. This is in the reverse order of Vulkan's naming convention.Note that if bytes-per-pixel of a color type is 1, 2, 4, or 8, then Arc3D requires pixel memory to be aligned to bytes-per-pixel, otherwise it should be aligned to the size of data type as normal.
- See Also:
-
CT_R_8
public static final int CT_R_8Color types.Describes a layout of pixel data in CPU or GPU memory. A pixel may be an alpha mask, a grayscale, RGB, or RGBA. It specifies the channels, their type, and width. It does not refer to a texture format and the mapping to texture formats may be many-to-many. It does not specify the sRGB encoding of the stored values.
Color types are divided into two classes: array and packed.
For array types, the components are listed in order of where they appear in memory. For example,CT_RGBA_8888means that the pixel memory should be interpreted as an array of uint8 values, and the R channel appears at the first uint8 value. This is the same naming convention as Vulkan.
For packed types, the first component appear in the least-significant bits. For example,CT_BGR_565means that each pixel is packed as(b << 0) | (g << 5) | (r << 11), an uint16 value. This is in the reverse order of Vulkan's naming convention.Note that if bytes-per-pixel of a color type is 1, 2, 4, or 8, then Arc3D requires pixel memory to be aligned to bytes-per-pixel, otherwise it should be aligned to the size of data type as normal.
- See Also:
-
CT_RG_88
public static final int CT_RG_88Color types.Describes a layout of pixel data in CPU or GPU memory. A pixel may be an alpha mask, a grayscale, RGB, or RGBA. It specifies the channels, their type, and width. It does not refer to a texture format and the mapping to texture formats may be many-to-many. It does not specify the sRGB encoding of the stored values.
Color types are divided into two classes: array and packed.
For array types, the components are listed in order of where they appear in memory. For example,CT_RGBA_8888means that the pixel memory should be interpreted as an array of uint8 values, and the R channel appears at the first uint8 value. This is the same naming convention as Vulkan.
For packed types, the first component appear in the least-significant bits. For example,CT_BGR_565means that each pixel is packed as(b << 0) | (g << 5) | (r << 11), an uint16 value. This is in the reverse order of Vulkan's naming convention.Note that if bytes-per-pixel of a color type is 1, 2, 4, or 8, then Arc3D requires pixel memory to be aligned to bytes-per-pixel, otherwise it should be aligned to the size of data type as normal.
- See Also:
-
CT_RGB_888
@Internal public static final int CT_RGB_888- See Also:
-
CT_RGBX_8888
public static final int CT_RGBX_8888- See Also:
-
CT_RGBA_8888
public static final int CT_RGBA_8888- See Also:
-
CT_BGRA_8888
public static final int CT_BGRA_8888- See Also:
-
CT_RGBA_8888_SRGB
@Internal public static final int CT_RGBA_8888_SRGB- See Also:
-
CT_RGBA_1010102
public static final int CT_RGBA_1010102- See Also:
-
CT_BGRA_1010102
public static final int CT_BGRA_1010102- See Also:
-
CT_R_16
@Internal public static final int CT_R_16- See Also:
-
CT_R_F16
@Internal public static final int CT_R_F16- See Also:
-
CT_RG_1616
@Internal public static final int CT_RG_1616- See Also:
-
CT_RG_F16
@Internal public static final int CT_RG_F16- See Also:
-
CT_RGBA_16161616
public static final int CT_RGBA_16161616- See Also:
-
CT_RGBA_F16
public static final int CT_RGBA_F16- See Also:
-
CT_RGBA_F16_CLAMPED
public static final int CT_RGBA_F16_CLAMPED- See Also:
-
CT_RGBA_F32
public static final int CT_RGBA_F32- See Also:
-
CT_ALPHA_8
public static final int CT_ALPHA_8- See Also:
-
CT_ALPHA_16
public static final int CT_ALPHA_16- See Also:
-
CT_ALPHA_F16
public static final int CT_ALPHA_F16- See Also:
-
CT_GRAY_8
public static final int CT_GRAY_8- See Also:
-
CT_GRAY_ALPHA_88
@Internal public static final int CT_GRAY_ALPHA_88- See Also:
-
CT_ABGR_8888
@Internal public static final int CT_ABGR_8888Special format for big-endian CPU; GPU does not support this.- See Also:
-
CT_ARGB_8888
@Internal public static final int CT_ARGB_8888Special format for big-endian CPU; GPU does not support this.- See Also:
-
CT_RGBA_8888_NATIVE
public static final int CT_RGBA_8888_NATIVEA runtime alias based on host endianness, packed as(r << 0) | (g << 8) | (b << 16) | (a << 24)an uint32 value.This is not a standalone packed format, it just depends on CPU: on big-endian machine this is
CT_ABGR_8888; on little-endian machine this isCT_RGBA_8888.- See Also:
-
CT_BGRA_8888_NATIVE
public static final int CT_BGRA_8888_NATIVEA runtime alias based on host endianness, packed as(b << 0) | (g << 8) | (r << 16) | (a << 24)an uint32 value.This is not a standalone packed format, it just depends on CPU: on big-endian machine this is
CT_ARGB_8888; on little-endian machine this isCT_BGRA_8888.- See Also:
-
CT_R5G6B5_UNORM
public static final int CT_R5G6B5_UNORMAliases.- See Also:
-
CT_R8G8_UNORM
public static final int CT_R8G8_UNORMAliases.- See Also:
-
CT_A16_UNORM
public static final int CT_A16_UNORMAliases.- See Also:
-
CT_A16_FLOAT
public static final int CT_A16_FLOATAliases.- See Also:
-
CT_A16G16_UNORM
public static final int CT_A16G16_UNORMAliases.- See Also:
-
CT_R16G16_FLOAT
public static final int CT_R16G16_FLOATAliases.- See Also:
-
CT_R16G16B16A16_UNORM
public static final int CT_R16G16B16A16_UNORMAliases.- See Also:
-
CT_COUNT
@Internal public static final int CT_COUNT- See Also:
-
-
Method Details
-
colorTypeCount
public static int colorTypeCount()Returns the number of color types but avoids inlining at compile-time. -
bytesPerPixel
public static int bytesPerPixel(int ct) Returns the number of bytes required to store a pixel.- Returns:
- bytes per pixel
-
maxBitsPerChannel
public static int maxBitsPerChannel(int ct) -
validateAlphaType
public static int validateAlphaType(int ct, int at) Returns a valid AlphaType for ct. If there is more than one valid AlphaType, returns at, if valid.- Returns:
- a valid AlphaType
- Throws:
IllegalArgumentException- at is unknown, ct is not unknown, and ct has alpha channel.
-
colorTypeChannelFlags
@Internal public static int colorTypeChannelFlags(int ct) -
colorTypeIsAlphaOnly
public static boolean colorTypeIsAlphaOnly(int ct) -
colorTypeToString
-