Geometrize  1.0
C++ library for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
bitmap.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <vector>
5 
6 #include "rgba.h"
7 
8 namespace geometrize
9 {
10 
15 class Bitmap
16 {
17 public:
24  Bitmap(std::uint32_t width, std::uint32_t height, geometrize::rgba color);
25 
32  Bitmap(std::uint32_t width, std::uint32_t height, const std::vector<std::uint8_t>& data);
33 
34  ~Bitmap() = default;
35  Bitmap& operator=(const geometrize::Bitmap&) = default;
36  Bitmap(const geometrize::Bitmap&) = default;
37 
41  std::uint32_t getWidth() const;
42 
46  std::uint32_t getHeight() const;
47 
52  std::vector<std::uint8_t> copyData() const;
53 
58  const std::vector<std::uint8_t>& getDataRef() const;
59 
66  geometrize::rgba getPixel(std::uint32_t x, std::uint32_t y) const;
67 
74  void setPixel(std::uint32_t x, std::uint32_t y, geometrize::rgba color);
75 
80  void fill(geometrize::rgba color);
81 
82 private:
83  std::uint32_t m_width;
84  std::uint32_t m_height;
85  std::vector<std::uint8_t> m_data;
86 };
87 
88 }
std::uint32_t getWidth() const
getWidth Gets the width of the bitmap.
Definition: bitmap.cpp:20
std::vector< std::uint8_t > m_data
The bitmap data.
Definition: bitmap.h:85
const std::vector< std::uint8_t > & getDataRef() const
getDataRef Gets a reference to the raw bitmap data.
Definition: bitmap.cpp:35
Bitmap(std::uint32_t width, std::uint32_t height, geometrize::rgba color)
Bitmap Creates a new bitmap.
Definition: bitmap.cpp:10
std::vector< std::uint8_t > copyData() const
copyData Gets a copy of the raw bitmap data.
Definition: bitmap.cpp:30
void setPixel(std::uint32_t x, std::uint32_t y, geometrize::rgba color)
setPixel Sets a pixel color value.
Definition: bitmap.cpp:46
std::uint32_t m_width
The width of the bitmap.
Definition: bitmap.h:83
geometrize::rgba getPixel(std::uint32_t x, std::uint32_t y) const
getPixel Gets a pixel color value.
Definition: bitmap.cpp:40
Bitmap & operator=(const geometrize::Bitmap &)=default
void fill(geometrize::rgba color)
fill Fills the bitmap with the given color.
Definition: bitmap.cpp:55
std::uint32_t m_height
The height of the bitmap.
Definition: bitmap.h:84
The Bitmap class is a helper class for working with bitmap data.
Definition: bitmap.h:15
The rgba struct is a helper for manipulating RGBA8888 color data.
Definition: rgba.h:12
std::uint32_t getHeight() const
getHeight Gets the height of the bitmap.
Definition: bitmap.cpp:25