Chromium Code Reviews| 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); |
| +} |