21 std::vector<Color> m_data;
26 Image( ) : m_data(), m_width(0), m_height(0) {}
27 Image(
const int w,
const int h,
const Color& color=
Black() ) : m_data(w*h, color), m_width(w), m_height(h) {}
40 std::size_t offset= y * m_width + x;
41 assert(offset < m_data.size());
42 return m_data[offset];
48 std::size_t offset= y * m_width + x;
49 assert(offset < m_data.size());
50 return m_data[offset];
56 assert(!m_data.empty());
57 return &m_data.front();
61 int width( )
const {
return m_width; }
63 int height( )
const {
return m_height; }
65 std::size_t
size( )
const {
return m_width * m_height; }
const void * buffer() const
renvoie un pointeur sur le stockage des couleurs des pixels.
bool operator==(const Image &im) const
comparaison avec la sentinelle.
Color Black()
utilitaire. renvoie une couleur noire.
representation d'une couleur (rgba) transparente ou opaque.
Color & operator()(const int x, const int y)
std::size_t size() const
renvoie le nombre de pixels de l'image.
int height() const
renvoie la hauteur de l'image.
representation d'une image.
int width() const
renvoie la largeur de l'image.