C # Bitmap Processing pointer problems

Source: Internet
Author: User
Problems | pointers

Today, the algorithm was found in the past in C + + with the UINT pointer access to 32-bit ARGB bitmap, each offset is exactly one pixel, so direct use of "+ +" instead of "+ + 4". Similarly, when directly using a coordinate access, you should use "I * STRIDE/4 + j" instead of "I * stride + j". But when you move to C # code, you find that if you use the same UINT pointer to access the bitmap, there may not be a problem when stride equals width*4, and the problem will occur once the Noffset is not 0. But the second bug didn't prove to happen every time. Find time to correct the code, in the absence of improved algorithm, it is recommended to use the byte type pointer for bitmap access.


Article Source: Http://spaces.msn.com/sharkoo/Blog/cns!D8E832CE4545AF!153.entry

Add: When the lock locates all the stride=width*4, when the lock is part of the bitmap, stride will not be equal to width*4.



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.