My first MFC small project (2) First-time bitmap

Source: Internet
Author: User

Bitmapsize = BMP. bmwidthbytes * BMP. bmheight; In this experiment, we learned a lot about BMP images, including basic components and operations (such as amplification and reduction ). The following is the dib file format:

 

 

This is the composition of a BMP image. It can be regarded as its data structure, which stores the data needed to display the image. The data in the Structure Body is complex, but here are some points.

Offsetbit is the displacement from the file header to the pixel;

Imagesize is the size of pixels;

Size indicates the size of the entire Dib file.

 

In the file header, offsetbit calculation is actually very simple, that is, the size of the file header and the information header add up (of course, the default is a 24-Bit Bitmap), but it is relatively simple because they are fixed sizes.

The imagesize calculation method looks complicated:

(M_bdbmpdata.width * 32) + 31)/32) * 4) * m_bdbmpdata.height. If the number of bytes occupied is a multiple of 4, use 0 to complete it.

If the information you prepare is complete, you can use the following formula for calculation:

Bitmapsize = BMP. bmwidthbytes * BMP. bmheight;

The first is the field in the bitmap structure, indicating the number of bytes occupied by each row.

 

Portal:

How was my first MFC small project (1) coming soon?
Bitmap conversion in my first MFC small project (3)

 

Troublemakers 2011-11-23

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.