Container for picture data. Data are stored as unsigned char [0,255]. More...

Public Member Functions | |
| image () | |
| empty constructor | |
| image (const unsigned int &Nx, const unsigned int &Ny) | |
| create picture of size Nx x Ny | |
| const unsigned int & | Nx () const |
| get the picture width in pixel | |
| const unsigned int & | Ny () const |
| get the picture height in pixel | |
| const color & | operator() (const int &px, const int &py) const |
| get pixel (px,py) | |
| color & | operator() (const int &px, const int &py) |
| get pixel (px,py) | |
| void | read_ppm (const std::string &filename) |
| read a ppm picture format (ascii) | |
| void | export_ppm (const std::string &filename) |
| Export the picture into ppm format (ascii). | |
Private Member Functions | |
| bool | check_position (const int &px, const int &py) const |
| check if a given pixel (kx,ky) is within the size of the picture | |
Private Attributes | |
| unsigned int | internal_Nx |
| storage of picture width | |
| unsigned int | internal_Ny |
| storage of picture height | |
| std::vector< color > | internal_data |
| internal data storage as std::vector of unsigned char | |
Container for picture data. Data are stored as unsigned char [0,255].
| cpe::image::image | ( | ) |
empty constructor
| cpe::image::image | ( | const unsigned int & | Nx, | |
| const unsigned int & | Ny | |||
| ) |
create picture of size Nx x Ny
| unsigned | int Nx: picture width | |
| unsigned | int Ny: picture height |
References internal_data, internal_Nx, and internal_Ny.
| bool cpe::image::check_position | ( | const int & | px, | |
| const int & | py | |||
| ) | const [private] |
check if a given pixel (kx,ky) is within the size of the picture
References internal_Nx, and internal_Ny.
Referenced by operator()().
| void cpe::image::export_ppm | ( | const std::string & | filename | ) |
Export the picture into ppm format (ascii).
| std::string | filename: file to store the picture |
References internal_data, internal_Nx, and internal_Ny.
Referenced by main().
| const unsigned int & cpe::image::Nx | ( | ) | const |
| const unsigned int & cpe::image::Ny | ( | ) | const |
| color & cpe::image::operator() | ( | const int & | px, | |
| const int & | py | |||
| ) |
get pixel (px,py)
References check_position(), internal_data, internal_Nx, and internal_Ny.

| const color & cpe::image::operator() | ( | const int & | px, | |
| const int & | py | |||
| ) | const |
get pixel (px,py)
References check_position(), internal_data, internal_Nx, and internal_Ny.

| void cpe::image::read_ppm | ( | const std::string & | filename | ) |
read a ppm picture format (ascii)
| std::string | filename: path of the file to read |
References internal_data, internal_Nx, and internal_Ny.
Referenced by main().
std::vector<color> cpe::image::internal_data [private] |
internal data storage as std::vector of unsigned char
Picture is stored as (r0,b0,g0,a0 , r1,b1,g1,a1 , ...) vector size is therefore 4 Nx Ny
Referenced by export_ppm(), image(), operator()(), and read_ppm().
unsigned int cpe::image::internal_Nx [private] |
storage of picture width
Referenced by check_position(), export_ppm(), image(), Nx(), operator()(), and read_ppm().
unsigned int cpe::image::internal_Ny [private] |
storage of picture height
Referenced by check_position(), export_ppm(), image(), Ny(), operator()(), and read_ppm().
1.6.3