Mercurial > MadButterfly
changeset 505:c468e397614d Android_Skia
Fix issue of initialize rdman and add shape::stroke_width().
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 01 Dec 2009 22:55:26 +0800 |
parents | 28b9f3e84e2b |
children | 47c6fd9dd83c |
files | Android/java/org/madbutterfly/InvalidStateException.java Android/java/org/madbutterfly/MBView.java Android/java/org/madbutterfly/_jni.java Android/java/org/madbutterfly/coord.java Android/java/org/madbutterfly/shape.java |
diffstat | 5 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Android/java/org/madbutterfly/InvalidStateException.java Tue Dec 01 22:55:26 2009 +0800 +++ b/Android/java/org/madbutterfly/InvalidStateException.java Tue Dec 01 22:55:26 2009 +0800 @@ -2,7 +2,7 @@ import java.lang.Exception; -class InvalidStateException extends Exception { +public class InvalidStateException extends Exception { public InvalidStateException() { super(); }
--- a/Android/java/org/madbutterfly/MBView.java Tue Dec 01 22:55:26 2009 +0800 +++ b/Android/java/org/madbutterfly/MBView.java Tue Dec 01 22:55:26 2009 +0800 @@ -29,6 +29,8 @@ mode = new PorterDuffXfermode(PorterDuff.Mode.SRC); copy_pnt = new Paint(); copy_pnt.setXfermode(mode); + w = 100; + h = 100; } public redraw_man get_rdman() { @@ -51,6 +53,12 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) { this.w = w; this.h = h; + + if(rdman == null) { + get_rdman(); + return; + } + cr_bmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); cr.setBitmap(cr_bmap); backend_bmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); @@ -64,5 +72,6 @@ holder = getHolder(); canvas = holder.lockCanvas(); canvas.drawBitmap(backend_bmap, 0, 0, copy_pnt); + holder.unlockCanvasAndPost(canvas); } }
--- a/Android/java/org/madbutterfly/_jni.java Tue Dec 01 22:55:26 2009 +0800 +++ b/Android/java/org/madbutterfly/_jni.java Tue Dec 01 22:55:26 2009 +0800 @@ -23,6 +23,7 @@ native static void rdman_shape_changed(int rdman, int shape); native static void rdman_shape_free(int rdman, int shape); native static int rdman_shape_path_new(int rdman, String data); + native static void sh_set_stroke_width(int shape, float w); /* paint_t */ native static int rdman_paint_color_new(int rdman, float r, float g,
--- a/Android/java/org/madbutterfly/coord.java Tue Dec 01 22:55:26 2009 +0800 +++ b/Android/java/org/madbutterfly/coord.java Tue Dec 01 22:55:26 2009 +0800 @@ -28,5 +28,7 @@ _jni.rdman_add_shape(rdman._rdman_addr, member.addr, addr); members.add(member); member.parent = this; + _jni.rdman_coord_changed(rdman._rdman_addr, addr); + _jni.rdman_shape_changed(rdman._rdman_addr, member.addr); } }
--- a/Android/java/org/madbutterfly/shape.java Tue Dec 01 22:55:26 2009 +0800 +++ b/Android/java/org/madbutterfly/shape.java Tue Dec 01 22:55:26 2009 +0800 @@ -21,4 +21,8 @@ if(addr != 0) _jni.rdman_shape_free(rdman._rdman_addr, addr); } + + public void set_stroke_width(float w) { + _jni.sh_set_stroke_width(addr, w); + } }