draw Bitmap on Canvas - Android Graphics

Android examples for Graphics:Canvas

Description

draw Bitmap on Canvas

Demo Code


import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;

public class Main{
    public static void drawBitmap(Canvas mcanvas, Bitmap bitmap, Rect src,
            Rect dst, Paint paint) {
        mcanvas.drawBitmap(bitmap, src,//w  w  w  .ja  v  a2s.  c  o m
                new Rect(dst.left * GameView.screen_width
                        / GameView.standard_width,
                        dst.top * GameView.screen_height
                                / GameView.standard_height, dst.right
                                * GameView.screen_width
                                / GameView.standard_width, dst.bottom
                                * GameView.screen_height
                                / GameView.standard_height), paint);
    }
}

Related Tutorials