Summary of Bitmap. createBitmap in Android and Bitmap cutting in Android

Source: Internet
Author: User
Document directory
  • Something you don't understand
The Bitmap. createBitmap function has six overload methods.

BitmapCutRefer to Methods 4 and 6 for reload, and Method 6 for reload is relatively simple.

  1. Public static Bitmap createBitmap (Bitmap src)
    Copy a new bitmap from the original bitmap src, which is the same as the original bitmap.

  2. Public static Bitmap createBitmap (int [] colors, int width,
    Int height, Bitmap. Config
    Config)
    This function creates a bitmap based on the color array,Note: The length of the color array> = width * height

    This function can be used to create a bitmap in a simple way: Create a blank map with a higher width and height, and then fill the color from left to right with the specified color array colors. Config is an enumeration that can be used to specify the bitmap "quality ".

  3. Public static Bitmap createBitmap (int [] colors, int offset,
    Int stride, int width, int height, Bitmap. Config
    Config)
    This method is similar to 2, but I still don't understand the role of offset and stride.

  4. Public static Bitmap createBitmap (Bitmap source, int x,
    Int y, int width, int height, Matrix m, boolean
    Filter)
    Cutting an image from the original bitmap is an advanced method. Advanced rotation methods such as Matrix can be used.
    Parameter description:
    Bitmap source: original Bitmap from
    Int x: Start x coordinate
    Int y: Start y coordinate
    Int width: the width of the graph to be captured.
    Int height: the width of the graph to be captured.
    Bitmap. Config config: An enumeration configuration that defines the quality of the captured new Bitmap.
    Returned value: returns a cut Bitmap.
  5. Public static Bitmap createBitmap (int width, int height, Bitmap. Config
    Config)
    Create a new bitmap based on parameters

  6. Public static Bitmap createBitmap (Bitmap source, int x,
    Int y, int width, int height)

    For a simple image cutting method, refer to the above 4.

     

Something you don't understand
  1. How Bitmap. Config controls Bitmap Creation

  2. In Bitmap. createBitmap's overloaded version 4Offset, stride, and filterWhat is the role
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.