5 #include <ngl/Colour.h>
28 m_file.open(_image_name, std::ios::out | std::ios::binary);
31 for(
unsigned int i = 0; i <
m_pixels.size(); ++i)
34 (
unsigned char) (
m_pixels.at(i).g * 255) <<
35 (
unsigned char) (
m_pixels.at(i).b * 255);
void writeFile(const char *_image_name)
Iterates over the pixel vector and writes into a file using basic output stream methods.
std::ofstream m_file
File output stream, in charge of writing the pixels into a file.
All the operations regarding to file output and file input belong to this class. It abstracts the ide...
~Film()
Destructor for the Film.
void setDimensions(int _w, int _h)
Sets the dimensions of the Film.
std::vector< Pixel > m_pixels
Vector of pixels. The index of the pixel corresponds to this equation: i = height * y + x...
int m_width
Width of the Film's image.
void writePixel(ngl::Colour _colour)
Will create a pixel and push it to the pixel vector.
int m_height
Height of the Film's image.
Pixel data structure that will be used to hold the image units.