Just to give some extra info on Data in BGRABitmap.
There are 3 things to consider: the line order, padding and pixel format.
Line order can be bottom to top or top to bottom depending on the system. So it is ok to loop over all pixels to change them as long as it doesn't matter what is the vertical position. Otherwise, you need to use Scanline for each line or to apply the correct delta, either adding or subtracting RowSize bytes or Width for a PBGRAPixel type.
About padding, it can happen with OpenGL bitmaps. The TBGLBitmap can be padded in order to have a size that is compatible with OpenGL. So in this case, RowSize will be a correct delta in bytes, but Width won't be. You need to use AllocatedWidth instead to get the delta in pixels. You could as well loop though all the Data by using AllocatedWidth*Height pixels, though that would be doing unnecessary processing for the padding pixels.
About pixel format, TBGABitmap is always 8-bit BGRA or RGBA. But you can use another format by using another class. Currently those are defined:
- TLinearRGBABitmap contains 32-bit float linear RGBA (16 bytes total per pixel)
- TExpandedBitmap contains word linear RGBA (8 bytes total per pixel)
- TGrayscaleMask contains 1-byte linear gray
- TXYZABitmap contains 32-bit float XYZA (16 bytes total per pixel)
- TWordXYZABitmap contains word XYZA (8 bytes total per pixel)
I guess one could define a 24-bit RGB format. You can look at existing formats to see how it is done to create one if you're interested. If you have any question, feel free to ask.