Freigeben über


BitmapFactory.Options.InPreferredColorSpace Property

Definition

If this is non-null, the decoder will try to decode into this color space.

[Android.Runtime.Register("inPreferredColorSpace", ApiSince=26)]
public Android.Graphics.ColorSpace InPreferredColorSpace { get; set; }
[<Android.Runtime.Register("inPreferredColorSpace", ApiSince=26)>]
member this.InPreferredColorSpace : Android.Graphics.ColorSpace with get, set

Property Value

Attributes

Remarks

If this is non-null, the decoder will try to decode into this color space. If it is null, or the request cannot be met, the decoder will pick either the color space embedded in the image or the color space best suited for the requested image configuration (for instance ColorSpace.Named#SRGB sRGB for 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 the decode methods 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, non ICC parametric curve transfer function is allowed. E.g., ColorSpace.Named#BT2020_HLG BT2020_HLG.</p>

After decode, the bitmap's color space is stored in #outColorSpace.

Java documentation for android.graphics.BitmapFactory.Options.inPreferredColorSpace.

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