From eaa6263b9640edbc728199ebd627659ef2c3fb9b Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 3 Oct 2023 20:52:11 +0000 Subject: Clarify byte packing is only for "raw" access Fixes: 264608640 Test: n/a doc only change Flag: DOCS_ONLY Change-Id: Ib8c18671d7f4fada5358a41229f61a2154bcf992 --- graphics/java/android/graphics/Bitmap.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'graphics/java') diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 1ff5a3d46f8e..250362b1e1e3 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -479,7 +479,8 @@ public final class Bitmap implements Parcelable { * This configuration may be useful when using opaque bitmaps * that do not require high color fidelity. * - *

Use this formula to pack into 16 bits:

+ *

When accessing directly via #copyPixelsFromBuffer or #copyPixelsToBuffer, + * use this formula to pack into 16 bits:

*
          * short color = (R & 0x1f) << 11 | (G & 0x3f) << 5 | (B & 0x1f);
          * 
@@ -516,7 +517,8 @@ public final class Bitmap implements Parcelable { * This configuration is very flexible and offers the best * quality. It should be used whenever possible. * - *

Use this formula to pack into 32 bits:

+ *

When accessing directly via #copyPixelsFromBuffer or #copyPixelsToBuffer, + * use this formula to pack into 32 bits:

*
          * int color = (A & 0xff) << 24 | (B & 0xff) << 16 | (G & 0xff) << 8 | (R & 0xff);
          * 
@@ -531,7 +533,8 @@ public final class Bitmap implements Parcelable { * This configuration is particularly suited for wide-gamut and * HDR content. * - *

Use this formula to pack into 64 bits:

+ *

When accessing directly via #copyPixelsFromBuffer or #copyPixelsToBuffer, + * use this formula to pack into 64 bits:

*
          * long color = (A & 0xffff) << 48 | (B & 0xffff) << 32 | (G & 0xffff) << 16 | (R & 0xffff);
          * 
@@ -556,7 +559,8 @@ public final class Bitmap implements Parcelable { * blending, such that the memory cost is the same as ARGB_8888 while enabling higher color * precision. * - *

Use this formula to pack into 32 bits:

+ *

When accessing directly via #copyPixelsFromBuffer or #copyPixelsToBuffer, + * use this formula to pack into 32 bits:

*
          * int color = (A & 0x3) << 30 | (B & 0x3ff) << 20 | (G & 0x3ff) << 10 | (R & 0x3ff);
          * 
-- cgit v1.2.3-59-g8ed1b