class BitmapWriter

Utility class for generating BMP images.

Public

Methods

staticRawPixelsToBmp

static void RawPixelsToBmp(const u8 *input, u8 *output, u32 width, u32 height, u32 bytesPerPixel)

Generates bytes representing the BMP image format, from a set of raw RGB or RGBA pixels.

input
The input set of bytes in RGB or RGBA format. Starting byte represents the top left pixel of the image and following pixels need to be set going from left to right, row after row.
output
Preallocated buffer where the BMP bytes will be stored. Use GetBmpSize() to retrieve the size needed for this buffer.
width
The width of the image in pixels.
height
The height of the image in pixels.
bytesPerPixel
Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.

staticGetBmpSize

static u32 GetBmpSize(u32 width, u32 height, u32 bytesPerPixel)

Returns the size of the BMP output buffer that needs to be allocated before calling RawPixelsToBmp().

width
The width of the image in pixels.
height
The height of the image in pixels.
bytesPerPixel
Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.

Returns: Size of the BMP output buffer needed to write a BMP of the specified size & bpp.