Android Blitz: Drawing images

Source: Internet
Author: User

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.
  
 
  1. BitmapFactory.Options opts = new BitmapFactory.Options();
  2. opts.inSampleSize = 2;
  3. 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:
 
   
  
  1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.