Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2858)

Unified Diff: experimental/HelloSkia/src/com/example/HelloSkiaActivity.java

Issue 16336004: create simple skia app for android using jni (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: experimental/HelloSkia/src/com/example/HelloSkiaActivity.java
diff --git a/experimental/HelloSkia/src/com/example/HelloSkiaActivity.java b/experimental/HelloSkia/src/com/example/HelloSkiaActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..064d620738781cfe335161bd7cfa7c71827c7405
--- /dev/null
+++ b/experimental/HelloSkia/src/com/example/HelloSkiaActivity.java
@@ -0,0 +1,54 @@
+package com.example;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.View;
+import android.os.Bundle;
+import android.util.Log;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+
+public class HelloSkiaActivity extends Activity
+{
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(new SkiaDrawView(this));
+
+ try
+ {
+ // Load skia and then the app shared object in this order
+ System.loadLibrary("skia_android");
+ System.loadLibrary("HelloSkia");
+
+ } catch (UnsatisfiedLinkError e)
+ {
+ Log.d("HelloSkia", "Link Error: " + e);
+ return;
+ }
+ }
+
+ private class SkiaDrawView extends View
+ {
+ public SkiaDrawView(Context ctx)
+ {
+ super(ctx);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas)
+ {
+ // Create a bitmap for skia to draw into
+ Bitmap skiaBitmap = Bitmap.createBitmap(400, 400, Bitmap.Config.ARGB_8888);
djsollen 2013/06/03 18:24:45 make the bitmap the same size as the canvas you ar
Zach Reizner 2013/06/03 22:54:25 Done.
+ drawIntoBitmap(skiaBitmap);
+
+ // Present the bitmap on the screen
+ canvas.drawBitmap(skiaBitmap, 0, 0, null);
+ }
+ }
+
+
+ private native void drawIntoBitmap(Bitmap image);
+}
« experimental/HelloSkia/res/layout/main.xml ('K') | « experimental/HelloSkia/res/values/strings.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698