Two methods, 1,canvas.drawbitmap (); 2,drawable.draw (canvas);
Bitmap.Config.ARGB_8888: The RGB represents 8 bytes each, and the transparency channel occupies 8 bytes.
The first is to useInputStreamis= context.getresources (). Openrawresource (r.drawable.Panda);used to get resources It then uses Bitmapfactory to convert the is to a bitmap object.
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 2;
bitmap1 = BitmapFactory.decodeStream(is, null, opts);
This Bitmapfactory.options object can be used to set the sample rate of transcoding and other properties. Of course, it can be simplified to use:
bitmap2 = BitmapFactory.decodeStream(is);
You can also use the CreateBitmap () method to create an image from a pixel.
The following example shows several ways to draw an image.
From for notes (Wiz)
Android Blitz: Drawing images