Refine ColorSpace restrictions for Bitmaps
Bug: 123377741 Bug: 120870651 Bug: 121001670 Bug: 123374456 Bug: 124052364 Test: I90adb511c8fdefe016028da4fd53b079d8367bf6 RGBA_F16 is no longer restricted to particular ColorSpaces. (Previously, it was LINEAR_EXTENDED_SRGB when decoded, and EXTENDED_SRGB when created.) Instead, F16 is now EXTENDED if there is an EXTENDED variant, but is otherwise not special. It defaults to SRGB (but EXTENDED), but can be created or decoded to other ColorSpaces. Likewise, smaller Configs use the non-EXTENDED variant, when the EXTENDED variant was requested. ALPHA_8 always has a null ColorSpace. Add TransferParameters to EXTENDED_SRGB. This seems to be a relic from a time before Skia treated SkColorSpaces as non-bounded. Make it have the same parameters as SRGB, so that it can be used in native code. e.g. now we can draw to/from it. Fix a bug getting the ColorSpace for gray image. ImageDecoder's info previously reported that a gray image's ColorSpace is null. (Though it correctly decoded it with the proper ColorSpace.) Allow setColorSpace to request SRGB on an EXTENDED_SRGB F16 Bitmap. (It has no visible effect.) Do *not* allow setting a ColorSpace on an ALPHA_8 Bitmap (throw an Exception). Other attempts to create a Bitmap with ALPHA_8 and a non-null ColorSpace silently use null, for backwards compatibility. Copying *from* an ALPHA_8 to another Config returns a Bitmap with SRGB. Change-Id: Ied0426f6deff354df5998691703a18ddd33ccd3d
This commit is contained in:
committed by
Leon Scroggins III
parent
ac4bccb2ad
commit
bf3e464704
@@ -151,12 +151,9 @@ public class BitmapFactory {
|
||||
* 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 {@link ColorSpace.Named#SRGB sRGB} for
|
||||
* the {@link Bitmap.Config#ARGB_8888} configuration).</p>
|
||||
*
|
||||
* <p>{@link Bitmap.Config#RGBA_F16} always uses the
|
||||
* {@link ColorSpace.Named#LINEAR_EXTENDED_SRGB scRGB} color space).
|
||||
* Bitmaps in other configurations without an embedded color space are
|
||||
* assumed to be in the {@link ColorSpace.Named#SRGB sRGB} color space.</p>
|
||||
* {@link Bitmap.Config#ARGB_8888} configuration and
|
||||
* {@link ColorSpace.Named#EXTENDED_SRGB EXTENDED_SRGB} for
|
||||
* {@link Bitmap.Config#RGBA_F16}).</p>
|
||||
*
|
||||
* <p class="note">Only {@link ColorSpace.Model#RGB} color spaces are
|
||||
* currently supported. An <code>IllegalArgumentException</code> will
|
||||
|
||||
Reference in New Issue
Block a user