Android Help on Creating multiple copies of same bitmap using canvas on a surface view
i want to create same copy of a bitmap image on draw method. i am using surface veiw and extending
public class Panel extends SurfaceView implements SurfaceHolder.Callback
{
@Override
public void onDraw(Canvas canvas) {
Bitmap redCoin1 = BitmapFactory.decodeResource(getResources(),R.drawable.red);
how do i copy the same redcoin1 .开发者_运维技巧 i need 18 copies on screan. how do i go ahead with it.
Regards Zaheer
Please don't decode bitmaps in onDraw()
! Your performance will fall through the floor and you may run out of memory.
Decode the bitmap in your constructor and use Canvas.drawBitmap()
in onDraw()
to draw it wherever it's needed, as many times as you want.
精彩评论