Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 package com.example; | |
| 2 | |
| 3 import android.app.Activity; | |
| 4 import android.content.Context; | |
| 5 import android.view.View; | |
| 6 import android.os.Bundle; | |
| 7 import android.util.Log; | |
| 8 import android.graphics.Bitmap; | |
| 9 import android.graphics.Canvas; | |
| 10 | |
| 11 public class HelloSkiaActivity extends Activity | |
| 12 { | |
| 13 /** Called when the activity is first created. */ | |
| 14 @Override | |
| 15 public void onCreate(Bundle savedInstanceState) | |
| 16 { | |
| 17 super.onCreate(savedInstanceState); | |
| 18 setContentView(new SkiaDrawView(this)); | |
| 19 | |
| 20 try | |
| 21 { | |
| 22 // Load skia and then the app shared object in this order | |
| 23 System.loadLibrary("skia_android"); | |
| 24 System.loadLibrary("HelloSkia"); | |
| 25 | |
| 26 } catch (UnsatisfiedLinkError e) | |
| 27 { | |
| 28 Log.d("HelloSkia", "Link Error: " + e); | |
| 29 return; | |
| 30 } | |
| 31 } | |
| 32 | |
| 33 private class SkiaDrawView extends View | |
| 34 { | |
| 35 public SkiaDrawView(Context ctx) | |
| 36 { | |
| 37 super(ctx); | |
| 38 } | |
| 39 | |
| 40 @Override | |
| 41 protected void onDraw(Canvas canvas) | |
| 42 { | |
| 43 // Create a bitmap for skia to draw into | |
| 44 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.
| |
| 45 drawIntoBitmap(skiaBitmap); | |
| 46 | |
| 47 // Present the bitmap on the screen | |
| 48 canvas.drawBitmap(skiaBitmap, 0, 0, null); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 | |
| 53 private native void drawIntoBitmap(Bitmap image); | |
| 54 } | |
| OLD | NEW |