OSDN Git Service

Method added to load scaled resource (with only alpha channel).
authorVictor Doba <dobavictor@google.com>
Wed, 20 Mar 2013 10:24:21 +0000 (11:24 +0100)
committerVictor Doba <dobavictor@google.com>
Wed, 20 Mar 2013 10:24:21 +0000 (11:24 +0100)
Change-Id: I1b9a58e0fd4c33c9748ad03f53d635c426a5102c

src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java

index 499170a..338cf51 100644 (file)
@@ -169,13 +169,14 @@ public abstract class ImageFilterRS extends ImageFilter {
         return bitmapAlloc;
     }
 
-    public Allocation loadResourceAlpha(int resource) {
+    public Allocation loadScaledResourceAlpha(int resource, int inSampleSize) {
         Resources res = null;
         synchronized(ImageFilterRS.class) {
             res = sRS.getApplicationContext().getResources();
         }
         final BitmapFactory.Options options = new BitmapFactory.Options();
         options.inPreferredConfig = Bitmap.Config.ALPHA_8;
+        options.inSampleSize      = inSampleSize;
         Bitmap bitmap = BitmapFactory.decodeResource(
                 res,
                 resource, options);
@@ -184,6 +185,10 @@ public abstract class ImageFilterRS extends ImageFilter {
         return ret;
     }
 
+    public Allocation loadResourceAlpha(int resource) {
+        return loadScaledResourceAlpha(resource, 1);
+    }
+
     public Allocation loadResource(int resource) {
         Resources res = null;
         synchronized(ImageFilterRS.class) {