FakeColorSpaceProfiles


class FakeColorSpaceProfiles : ColorSpaceProfilesWrapper


A fake implementation of ColorSpaceProfilesWrapper for testing.

Allows mock values to be configured for supported color spaces, image formats, and dynamic range profiles.

Summary

Public constructors

FakeColorSpaceProfiles(
    supportedColorSpaces: Map<Int, Set<String>>,
    supportedImageFormats: Map<String, Set<Int>>,
    supportedDynamicRangeProfiles: Map<Pair<String, Int>, Set<Long>>,
    supportedColorSpacesForDynamicRange: Map<Pair<Int, Long>, Set<String>>
)

Public functions

open Set<String>

Get the supported color spaces for a given image format.

open Set<String>
getSupportedColorSpacesForDynamicRange(
    imageFormat: Int,
    dynamicRangeProfile: Long
)

Get the supported color spaces for a given image format and dynamic range profile.

open Set<Long>
getSupportedDynamicRangeProfiles(
    cameraColorSpace: String,
    imageFormat: Int
)

Get the supported dynamic range profiles for a given color space and image format.

open Set<Int>

Get the supported image formats for a given color space.

open T?
<T : Any> unwrapAs(type: Class<T>)

Attempts to unwrap this object into the specified underlying type.

Public constructors

FakeColorSpaceProfiles

FakeColorSpaceProfiles(
    supportedColorSpaces: Map<Int, Set<String>> = emptyMap(),
    supportedImageFormats: Map<String, Set<Int>> = emptyMap(),
    supportedDynamicRangeProfiles: Map<Pair<String, Int>, Set<Long>> = emptyMap(),
    supportedColorSpacesForDynamicRange: Map<Pair<Int, Long>, Set<String>> = emptyMap()
)

Public functions

getSupportedColorSpaces

Added in 1.7.0-rc01
open fun getSupportedColorSpaces(imageFormat: Int): Set<String>

Get the supported color spaces for a given image format.

Parameters
imageFormat: Int

The image format to query.

Value is one of the following:

  • 0
  • 4
  • 842094169
  • 538982489
  • 16
  • 17
  • 20
  • 256
  • 1768253795
  • 35
  • 39
  • 40
  • 41
  • 42
  • 32
  • 36
  • 37
  • 38
  • 1144402265
  • 257
  • 34
  • 1212500294
  • 54
  • 4101
  • 4098
  • 4099
  • 540422489
  • 60
  • 4102
  • 56
  • 55
  • 57
  • 58
  • 59
  • -3
  • -2
  • -1
  • 1
  • 2
  • 3
  • 22
  • 43
  • 33
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53

Returns
Set<String>

The set of supported CameraColorSpaces.

getSupportedColorSpacesForDynamicRange

Added in 1.7.0-rc01
open fun getSupportedColorSpacesForDynamicRange(
    imageFormat: Int,
    dynamicRangeProfile: Long
): Set<String>

Get the supported color spaces for a given image format and dynamic range profile.

Parameters
imageFormat: Int

The image format to query.

Value is one of the following:

  • 0
  • 4
  • 842094169
  • 538982489
  • 16
  • 17
  • 20
  • 256
  • 1768253795
  • 35
  • 39
  • 40
  • 41
  • 42
  • 32
  • 36
  • 37
  • 38
  • 1144402265
  • 257
  • 34
  • 1212500294
  • 54
  • 4101
  • 4098
  • 4099
  • 540422489
  • 60
  • 4102
  • 56
  • 55
  • 57
  • 58
  • 59
  • -3
  • -2
  • -1
  • 1
  • 2
  • 3
  • 22
  • 43
  • 33
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53

dynamicRangeProfile: Long

The dynamic range profile to query.

Value is one of the following:

  • 1
  • 2
  • 4
  • 8
  • 16
  • 32
  • 64
  • 128
  • 256
  • 512
  • 1024
  • 2048
  • 4096

Returns
Set<String>

The set of supported CameraColorSpaces.

getSupportedDynamicRangeProfiles

Added in 1.7.0-rc01
open fun getSupportedDynamicRangeProfiles(
    cameraColorSpace: String,
    imageFormat: Int
): Set<Long>

Get the supported dynamic range profiles for a given color space and image format.

Parameters
cameraColorSpace: String

The CameraColorSpace to query.

Value is one of the following:

  • UNKNOWN
  • SRGB
  • LINEAR_SRGB
  • EXTENDED_SRGB
  • LINEAR_EXTENDED_SRGB
  • BT709
  • BT2020
  • DCI_P3
  • DISPLAY_P3
  • NTSC_1953
  • SMPTE_C
  • ADOBE_RGB
  • PRO_PHOTO_RGB
  • ACES
  • ACESCG
  • CIE_XYZ
  • CIE_LAB
  • BT2020_HLG
  • BT2020_PQ

imageFormat: Int

The image format to query.

Value is one of the following:

  • 0
  • 4
  • 842094169
  • 538982489
  • 16
  • 17
  • 20
  • 256
  • 1768253795
  • 35
  • 39
  • 40
  • 41
  • 42
  • 32
  • 36
  • 37
  • 38
  • 1144402265
  • 257
  • 34
  • 1212500294
  • 54
  • 4101
  • 4098
  • 4099
  • 540422489
  • 60
  • 4102
  • 56
  • 55
  • 57
  • 58
  • 59
  • -3
  • -2
  • -1
  • 1
  • 2
  • 3
  • 22
  • 43
  • 33
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53

Returns
Set<Long>

A set of framework dynamic range profiles (e.g., android.hardware.camera2.params.DynamicRangeProfiles.HDR10)

getSupportedImageFormatsForColorSpace

Added in 1.7.0-rc01
open fun getSupportedImageFormatsForColorSpace(cameraColorSpace: String): Set<Int>

Get the supported image formats for a given color space.

Parameters
cameraColorSpace: String

The CameraColorSpace to query.

Value is one of the following:

  • UNKNOWN
  • SRGB
  • LINEAR_SRGB
  • EXTENDED_SRGB
  • LINEAR_EXTENDED_SRGB
  • BT709
  • BT2020
  • DCI_P3
  • DISPLAY_P3
  • NTSC_1953
  • SMPTE_C
  • ADOBE_RGB
  • PRO_PHOTO_RGB
  • ACES
  • ACESCG
  • CIE_XYZ
  • CIE_LAB
  • BT2020_HLG
  • BT2020_PQ

Returns
Set<Int>

The set of supported image formats.

unwrapAs

Added in 1.7.0-rc01
open fun <T : Any> unwrapAs(type: Class<T>): T?

Attempts to unwrap this object into the specified underlying type.

Callers should use this method to retrieve the wrapped platform object.

Implementation Notes

  • If the requested type is not supported by this wrapper, this method must return null.

  • Implementations designed for testing (e.g., fakes, mocks, or no-op wrappers) should return null to signal that no real underlying object is available.

Parameters
<T : Any>

The expected type of the underlying object.

type: Class<T>

The Class representing the expected type of the underlying object.

Returns
T?

The underlying object cast to T, or null if the object cannot be unwrapped into the requested type.