Mercurial > MadButterfly
view Android/java/org/madbutterfly/MBView.java @ 1160:1a699dc00fa3
Fix the issue of not removing node in old scene when switching scenes.
- When a timeline is playing and crossing two scenes (tween block),
nodes, for the old scene, in duplicate group must be removed. But,
it is not.
- It is fixed by checking if nodes, in the duplicate group, are also
in the key frame next to the new scene. All nodes that is not in
next key frame are remove.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 28 Dec 2010 13:35:34 +0800 |
parents | c468e397614d |
children |
line wrap: on
line source
package org.madbutterfly; import android.view.SurfaceView; import android.view.SurfaceHolder; import android.content.Context; import android.graphics.Canvas; import android.graphics.Bitmap; import android.graphics.Paint; import android.graphics.Xfermode; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; public class MBView extends SurfaceView { redraw_man rdman; Canvas cr, backend; Bitmap cr_bmap, backend_bmap; Paint copy_pnt; int w, h; public MBView(Context context) { super(context); Paint paint; Xfermode mode; rdman = null; cr = null; backend = null; mode = new PorterDuffXfermode(PorterDuff.Mode.SRC); copy_pnt = new Paint(); copy_pnt.setXfermode(mode); w = 100; h = 100; } public redraw_man get_rdman() { if(rdman != null) return rdman; w = getWidth(); h = getHeight(); cr_bmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); cr = new Canvas(cr_bmap); backend_bmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); backend = new Canvas(backend_bmap); rdman = new redraw_man(cr, backend, this); return rdman; } 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); backend.setBitmap(backend_bmap); } public void redraw() { SurfaceHolder holder; Canvas canvas; holder = getHolder(); canvas = holder.lockCanvas(); canvas.drawBitmap(backend_bmap, 0, 0, copy_pnt); holder.unlockCanvasAndPost(canvas); } }