readPixels

Decodes an image into a bitmap.

Return

decoded bitmap


fun readPixels(bitmap: Bitmap?): Codec

Decodes an image into a bitmap.

Repeated calls to this function should give the same results, allowing the PixelRef to be immutable.

Bitmap specifies the description of the format (config, size) expected by the caller. This can simply be identical to the info returned by getImageInfo().

This contract also allows the caller to specify different output-configs, which the implementation can decide to support or not.

A size that does not match getImageInfo() implies a request to scale. If the generator cannot perform this scale, it will throw an exception.

If the info contains a non-null ColorSpace, the codec will perform the appropriate color space transformation.

If the caller passes in the ColorSpace that maps to the ICC profile reported by getICCProfile(), the color space transformation is a no-op.

If the caller passes a null SkColorSpace, no color space transformation will be done.

Return

this

Parameters

bitmap

the description of the format (config, size) expected by the caller


fun readPixels(bitmap: Bitmap?, frame: Int): Codec

Decodes a frame in a multi-frame image into a bitmap.

Repeated calls to this function should give the same results, allowing the PixelRef to be immutable.

Bitmap specifies the description of the format (config, size) expected by the caller. This can simply be identical to the info returned by getImageInfo().

This contract also allows the caller to specify different output-configs, which the implementation can decide to support or not.

A size that does not match getImageInfo() implies a request to scale. If the generator cannot perform this scale, it will throw an exception.

If the info contains a non-null ColorSpace, the codec will perform the appropriate color space transformation.

If the caller passes in the ColorSpace that maps to the ICC profile reported by getICCProfile(), the color space transformation is a no-op.

If the caller passes a null SkColorSpace, no color space transformation will be done.

Return

this

Parameters

bitmap

the description of the format (config, size) expected by the caller

frame

index of the frame in multi-frame image to decode


fun readPixels(bitmap: Bitmap?, frame: Int, priorFrame: Int): Codec

Decodes a frame in a multi-frame image into a bitmap.

Repeated calls to this function should give the same results, allowing the PixelRef to be immutable.

Bitmap specifies the description of the format (config, size) expected by the caller. This can simply be identical to the info returned by getImageInfo().

This contract also allows the caller to specify different output-configs, which the implementation can decide to support or not.

A size that does not match getImageInfo() implies a request to scale. If the generator cannot perform this scale, it will throw an exception.

If the info contains a non-null ColorSpace, the codec will perform the appropriate color space transformation.

If the caller passes in the ColorSpace that maps to the ICC profile reported by getICCProfile(), the color space transformation is a no-op.

If the caller passes a null SkColorSpace, no color space transformation will be done.

Return

this

Parameters

bitmap

the description of the format (config, size) expected by the caller

frame

index of the frame in multi-frame image to decode

priorFrame

index of the frame already in bitmap, might be used to optimize retrieving current frame