summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-10-28 11:52:00 -0700
committerXavier Ducrohet <xav@android.com>2010-11-01 13:31:47 -0700
commit9f63ff263b0a97f0fa63e97136c18f6abccbfc68 (patch)
tree51941d0fad58ffb49097b1da5c7b7551da16a570 /tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
parent5c95212f6a8f5786b8199cdc4bb3725d15ada993 (diff)
downloadframeworks_base-9f63ff263b0a97f0fa63e97136c18f6abccbfc68.zip
frameworks_base-9f63ff263b0a97f0fa63e97136c18f6abccbfc68.tar.gz
frameworks_base-9f63ff263b0a97f0fa63e97136c18f6abccbfc68.tar.bz2
Layoutlib Canvas and Paint implementation through native delegates
Also fix native delegate generation to put "this" parameter even for methods that don't have any parameters. Change-Id: I5dd0c505871370ff7b4cda16de84a5b3ae438f73
Diffstat (limited to 'tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java')
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index 24fba72..e97b1e6 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -60,6 +60,20 @@ public class Bitmap_Delegate {
// ---- Public Helper methods ----
/**
+ * Returns the native delegate associated to a given {@link Bitmap_Delegate} object.
+ */
+ public static Bitmap_Delegate getDelegate(Bitmap bitmap) {
+ return sManager.getDelegate(bitmap.mNativeBitmap);
+ }
+
+ /**
+ * Returns the native delegate associated to a given an int referencing a {@link Bitmap} object.
+ */
+ public static Bitmap_Delegate getDelegate(int native_bitmap) {
+ return sManager.getDelegate(native_bitmap);
+ }
+
+ /**
* Creates and returns a {@link Bitmap} initialized with the given file content.
*/
public static Bitmap createBitmap(File input, Density density) throws IOException {
@@ -118,6 +132,13 @@ public class Bitmap_Delegate {
return BufferedImage.TYPE_INT_ARGB;
}
+ /**
+ * Returns the {@link BufferedImage} used by the delegate of the given {@link Bitmap}.
+ */
+ public BufferedImage getImage() {
+ return mImage;
+ }
+
// ---- native methods ----
/*package*/ static Bitmap nativeCreate(int[] colors, int offset, int stride, int width,
@@ -127,8 +148,7 @@ public class Bitmap_Delegate {
// create the image
BufferedImage image = new BufferedImage(width, height, imageType);
- // fill it
- //image.setRGB(x, y, rgb)
+ // FIXME fill the bitmap!
// create a delegate with the content of the stream.
Bitmap_Delegate delegate = new Bitmap_Delegate(image);