summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/graphics/BitmapFactory.java
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2013-08-21 10:26:23 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-08-21 10:26:23 -0700
commited2515e853a0440555d76b2b935086211107dcef (patch)
tree51f63324de5be53072371251471448b200315aeb /graphics/java/android/graphics/BitmapFactory.java
parent2a5053e05be81577ea686347b60b38e058532de7 (diff)
parent908d9bfafd576755d06f0566fc4cac3831476f63 (diff)
downloadframeworks_base-ed2515e853a0440555d76b2b935086211107dcef.zip
frameworks_base-ed2515e853a0440555d76b2b935086211107dcef.tar.gz
frameworks_base-ed2515e853a0440555d76b2b935086211107dcef.tar.bz2
am 908d9bfa: am dc70afae: Merge "Add inPremutiplied option to BitmapFactory.Options, functionality in Bitmap" into klp-dev
* commit '908d9bfafd576755d06f0566fc4cac3831476f63': Add inPremutiplied option to BitmapFactory.Options, functionality in Bitmap
Diffstat (limited to 'graphics/java/android/graphics/BitmapFactory.java')
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index d45cc4a..5ace987 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -44,6 +44,7 @@ public class BitmapFactory {
public Options() {
inDither = false;
inScaled = true;
+ inPremultiplied = true;
}
/**
@@ -125,6 +126,26 @@ public class BitmapFactory {
public Bitmap.Config inPreferredConfig = Bitmap.Config.ARGB_8888;
/**
+ * If true (which is the default), the resulting bitmap will have its
+ * color channels pre-multipled by the alpha channel.
+ *
+ * <p>This should NOT be set to false for images to be directly drawn by
+ * the view system or through a {@link Canvas}. The view system and
+ * {@link Canvas} assume all drawn images are pre-multiplied to simplify
+ * draw-time blending, and will throw a RuntimeException when
+ * un-premultiplied are drawn.</p>
+ *
+ * <p>This is likely only useful if you want to manipulate raw encoded
+ * image data, e.g. with RenderScript or custom OpenGL.</p>
+ *
+ * <p>This does not affect bitmaps without an alpha channel.</p>
+ *
+ * @see Bitmap#hasAlpha()
+ * @see Bitmap#isPremultiplied()
+ */
+ public boolean inPremultiplied;
+
+ /**
* If dither is true, the decoder will attempt to dither the decoded
* image.
*/