BsBitmapWriter.h 1.6 KB

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