1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6
7namespace bs
8{
9 /** @addtogroup Debug
10 * @{
11 */
12
13 /** Utility class for generating BMP images. */
14 class BS_UTILITY_EXPORT BitmapWriter
15 {
16 public:
17 /**
18 * Generates bytes representing the BMP image format, from a set of raw RGB or RGBA pixels.
19 *
20 * @param[in] input The input set of bytes in RGB or RGBA format. Starting byte represents the top left pixel of the image
21 * and following pixels need to be set going from left to right, row after row.
22 * @param[out] output Preallocated buffer where the BMP bytes will be stored. Use getBMPSize() to retrieve the size needed for this buffer.
23 * @param[in] width The width of the image in pixels.
24 * @param[in] height The height of the image in pixels.
25 * @param[in] bytesPerPixel Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.
26 */
27 static void rawPixelsToBMP(const UINT8* input, UINT8* output, UINT32 width, UINT32 height, UINT32 bytesPerPixel);
28
29 /**
30 * Returns the size of the BMP output buffer that needs to be allocated before calling rawPixelsToBMP().
31 *
32 * @param[in] width The width of the image in pixels.
33 * @param[in] height The height of the image in pixels.
34 * @param[in] bytesPerPixel Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.
35 *
36 * @return Size of the BMP output buffer needed to write a BMP of the specified size & bpp.
37 */
38 static UINT32 getBMPSize(UINT32 width, UINT32 height, UINT32 bytesPerPixel);
39 };
40
41 /** @} */
42}