Compartir a través de


ImageDecoder.SetTargetColorSpace(ColorSpace) Method

Definition

Specify the desired ColorSpace for the output.

[Android.Runtime.Register("setTargetColorSpace", "(Landroid/graphics/ColorSpace;)V", "", ApiSince=28)]
public void SetTargetColorSpace (Android.Graphics.ColorSpace? colorSpace);
[<Android.Runtime.Register("setTargetColorSpace", "(Landroid/graphics/ColorSpace;)V", "", ApiSince=28)>]
member this.SetTargetColorSpace : Android.Graphics.ColorSpace -> unit

Parameters

colorSpace
ColorSpace
Attributes

Remarks

Specify the desired ColorSpace for the output.

If non-null, the decoder will try to decode into colorSpace. If it is null, which is the default, or the request cannot be met, the decoder will pick either the color space embedded in the image or the ColorSpace best suited for the requested image configuration (for instance ColorSpace.Named#SRGB sRGB for the Bitmap.Config#ARGB_8888 configuration and ColorSpace.Named#EXTENDED_SRGB EXTENDED_SRGB for Bitmap.Config#RGBA_F16).

<p class="note">Only ColorSpace.Model#RGB color spaces are currently supported. An IllegalArgumentException will be thrown by #decodeDrawable decodeDrawable/ #decodeBitmap decodeBitmap when setting a non-RGB color space such as ColorSpace.Named#CIE_LAB Lab.</p>

<p class="note">Prior to android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, the specified color space's transfer function must be an ColorSpace.Rgb.TransferParameters ICC parametric curve. An IllegalArgumentException will be thrown by the decode methods if calling ColorSpace.Rgb#getTransferParameters() on the specified color space returns null. Starting from android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, the color spaces with non ICC parametric curve transfer function are allowed. E.g., ColorSpace.Named#BT2020_HLG BT2020_HLG. </p>

Like all setters on ImageDecoder, this must be called inside OnHeaderDecodedListener#onHeaderDecoded onHeaderDecoded.

Java documentation for android.graphics.ImageDecoder.setTargetColorSpace(android.graphics.ColorSpace).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to