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

◆ get_rgb() [2/2]

xtd::byte * xtd::drawing::image::get_rgb ( )

Gets the image data pointer, which represents the RGB data of the image.

Returns
The pointer or data image.
Remarks
This is most often used when doing direct image manipulation. The return value points to an array of characters in RGBRGBRGB... format in the top-to-bottom, left-to-right order, that is the first RGB triplet corresponds to the first pixel of the first row, the second one — to the second pixel of the first row and so on until the end of the first row, with second row following after it and so on.
The size of this data is 3 bytes (RGB) * height() * width().
If the image has no handle, such as an empty image, this method returns nullptr.
Warning
Be careful when using this pointer as there is no control and you can exceed its size and create irreparable problems.
Remarks
To access the position of a specific pixel, it's best to use the xtd::drawing::image::get_pixel and xtd::drawing::image::set_pixel methods.