Container for picture data. Data are stored as unsigned char [0,255]. More...
Public Member Functions | |
image_zbuffer () | |
empty constructor More... | |
image_zbuffer (int N) | |
create square picture of size NxN More... | |
image_zbuffer (int Nx, int Ny) | |
create picture of size Nx x Ny More... | |
double | z (const pos2 &index) const |
Accessor on a pixel. More... | |
double & | z (const pos2 &index) |
Accessor on a pixel. More... | |
void | export_z_buffer (const std::string &filename) const |
export depth-buffer into a file More... | |
![]() | |
image () | |
empty constructor More... | |
image (int N) | |
create square picture of size NxN More... | |
image (int Nx, int Ny) | |
create picture of size Nx x Ny More... | |
image (const std::string &filename) | |
import pre-existing picture from file filename More... | |
int | Nx () const |
get the picture width in pixel More... | |
int | Ny () const |
get the picture height in pixel More... | |
void | reshape (int Nx2) |
try to reshape the picture to a new size More... | |
bool | check_position (const pos2 &u) const |
check if a given pixel (kx,ky) is within the size of the picture More... | |
const color & | operator() (const pos2 &index) const |
Accessor on a pixel. More... | |
color & | operator() (const pos2 &index) |
Accessor on a pixel. More... | |
void | fill (const color &c) |
fill the entire picture with a given (r,g,b) color More... | |
void | fill_rectangle (const pos2 &u1, const pos2 &u2, const color &c) |
fill a rectangle ((x1,y1);(x2,y2)) with a given (r,g,b) color More... | |
void | export_file (const std::string &filename) |
write the picture into a file More... | |
Private Attributes | |
z_buffer | internal_z_buffer |
internal data storage as std::vector of unsigned char More... | |
Additional Inherited Members | |
![]() | |
void | assert_position (const pos2 &u) const |
Ensure a position is within the size of the image, otherwise throw exception. More... | |
int | coordinate_to_index (const pos2 &u) const |
transform coordinate u=(kx,ky) to index in vector data More... | |
Container for picture data. Data are stored as unsigned char [0,255].
cpe::image_zbuffer::image_zbuffer | ( | ) |
empty constructor
cpe::image_zbuffer::image_zbuffer | ( | int | N | ) |
create square picture of size NxN
unsigned | int N: size (width & height) of the picture |
cpe::image_zbuffer::image_zbuffer | ( | int | Nx, |
int | Ny | ||
) |
create picture of size Nx x Ny
unsigned | int Nx: picture width |
unsigned | int Ny: picture height |
void cpe::image_zbuffer::export_z_buffer | ( | const std::string & | filename | ) | const |
export depth-buffer into a file
References cpe::export_ppm(), and internal_z_buffer.
double cpe::image_zbuffer::z | ( | const pos2 & | index | ) | const |
Accessor on a pixel.
References cpe::image::assert_position(), and internal_z_buffer.
double & cpe::image_zbuffer::z | ( | const pos2 & | index | ) |
Accessor on a pixel.
References cpe::image::assert_position(), and internal_z_buffer.
|
private |
internal data storage as std::vector of unsigned char
Picture is stored as (color_0 , color_1 , ...) vector size is therefore 3 Nx Ny
Referenced by export_z_buffer(), and z().