# HG changeset patch # User Thinker K.F. Li # Date 1259679326 -28800 # Node ID c468e397614d9fcfe04aad69f2c152eb81beb202 # Parent 28b9f3e84e2b92e7fa5889461ea4d4d631579d59 Fix issue of initialize rdman and add shape::stroke_width(). diff -r 28b9f3e84e2b -r c468e397614d Android/java/org/madbutterfly/InvalidStateException.java --- 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(); } diff -r 28b9f3e84e2b -r c468e397614d Android/java/org/madbutterfly/MBView.java --- 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); } } diff -r 28b9f3e84e2b -r c468e397614d Android/java/org/madbutterfly/_jni.java --- 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, diff -r 28b9f3e84e2b -r c468e397614d Android/java/org/madbutterfly/coord.java --- 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); } } diff -r 28b9f3e84e2b -r c468e397614d Android/java/org/madbutterfly/shape.java --- 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); + } }