xtd 0.2.0
Loading...
Searching...
No Matches

◆ lock_bits() [1/2]

Locks a xtd::drawing::bitmap into system memory.

Parameters
rectA xtd::drawing::rectangle structure that specifies the portion of the xtd::drawing::bitmap to lock.
flagsAn xtd::drawing::imaging::image_lock_mode enumeration that specifies the access level (read/write) for the xtd::drawing::bitmap.
formatA xtd::drawing::imaging::pixel_format enumeration that specifies the data format of this xtd::drawing::bitmap.
Returns
A xtd::drawing::imaging::bitmap_data that contains information about this lock operation.
Remarks
Use the xtd::drawing::bitmap::lock_bits method to lock an existing bitmap in system memory so that it can be changed programmatically. You can change the color of an image with the xtd::drawing::bitmap::set_pixel method, although the xtd::drawing::bitmap::lock_bits method offers better performance for large-scale changes.
The xtd::drawing::imaging::bitmap_data specifies the attributes of the xtd::drawing::bitmap, such as size, pixel format, the starting address of the pixel data in memory, and length of each scan line (stride).
When calling this method, you should use a member of the xtd::drawing::imaging::pixel_format enumeration that contains a specific bits-per-pixel (BPP) value. Using xtd::drawing::imaging::pixel_format values such as xtd::drawing::imaging::pixel_format::indexed and xtd::drawing::imaging::pixel_format::gdi will throw an xtd::argument_exception. Also, passing the incorrect pixel format for a bitmap will throw an xtd::argument_exception.