55#include < fstream> // std::ofstream std::ifstream
66#include < vector> // std::vector
77#include < memory> // std::unique_ptr
8- #include < algorithm> // std::fill
8+ #include < algorithm> // std::fill
99#include < cstdint> // std::int*_t
1010#include < cstddef> // std::size_t
1111#include < string> // std::string
1212#include < cstring> // std::memcmp
13- #include < exception> // std::exception
13+ #include < exception> // std::exception
1414
1515namespace bmp
1616{
@@ -21,23 +21,23 @@ namespace bmp
2121 struct BitmapHeader
2222 {
2323 /* Bitmap file header structure */
24- std::uint16_t magic; /* Magic number for file always BM which is 0x4D42 */
25- std::uint32_t file_size; /* Size of file */
26- std::uint16_t reserved1; /* Reserved */
27- std::uint16_t reserved2; /* Reserved */
28- std::uint32_t offset_bits; /* Offset to bitmap data */
24+ std::uint16_t magic; /* Magic number for file always BM which is 0x4D42 */
25+ std::uint32_t file_size; /* Size of file */
26+ std::uint16_t reserved1; /* Reserved */
27+ std::uint16_t reserved2; /* Reserved */
28+ std::uint32_t offset_bits; /* Offset to bitmap data */
2929 /* Bitmap file info structure */
30- std::uint32_t size; /* Size of info header */
31- std::int32_t width; /* Width of image */
30+ std::uint32_t size; /* Size of info header */
31+ std::int32_t width; /* Width of image */
3232 std::int32_t height; /* Height of image */
3333 std::uint16_t planes; /* Number of color planes */
34- std::uint16_t bits_per_pixel; /* Number of bits per pixel */
34+ std::uint16_t bits_per_pixel; /* Number of bits per pixel */
3535 std::uint32_t compression; /* Type of compression to use */
3636 std::uint32_t size_image; /* Size of image data */
37- std::int32_t xpels_per_meter; /* X pixels per meter */
38- std::int32_t ypels_per_meter; /* Y pixels per meter */
37+ std::int32_t xpels_per_meter; /* X pixels per meter */
38+ std::int32_t ypels_per_meter; /* Y pixels per meter */
3939 std::uint32_t clr_used; /* Number of colors used */
40- std::uint32_t clr_important; /* Number of important colors */
40+ std::uint32_t clr_important; /* Number of important colors */
4141 };
4242 static_assert (sizeof (BitmapHeader) == 54 , " Bitmap header size must be 54 bytes" );
4343
@@ -339,8 +339,7 @@ namespace bmp
339339 */
340340 constexpr std::uint8_t toUint8 (const double x) noexcept
341341 {
342- return x >= 1.0 ? 255 : x <= 0.0 ? 0
343- : static_cast <std::uint8_t >(x * 255.0 + 0.5 );
342+ return x >= 1.0 ? 255 : x <= 0.0 ? 0 : static_cast <std::uint8_t >(x * 255.0 + 0.5 );
344343 }
345344
346345 private:
0 commit comments