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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW
« 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