Public Member Functions | |
image () | |
empty constructor | |
image (unsigned int Nx, unsigned int Ny) | |
direct allocation of empty image (black image) | |
image (unsigned int Nx, unsigned int Ny, const std::vector< color > data) | |
direct set of image with the raw data | |
void | resize (unsigned int Nx, unsigned int Ny) |
resize a new black image to the given size | |
unsigned int | Nx () const |
get width | |
unsigned int | Ny () const |
get height | |
void | fill (const color &c) |
Fill the full image with the given color. | |
void | fill_bloc (unsigned int kx, unsigned int ky, unsigned int size_bloc, const color &c) |
Fill a square bloc of data with the given color. | |
const color & | get (const unsigned int kx, const unsigned ky) const |
get the color of the given indices | |
void | set (const unsigned int kx, const unsigned ky, const color &c) |
set the color at the given indice | |
const color & | operator() (const unsigned int kx, const unsigned int ky) const |
get the color of the given indices | |
color & | operator() (const unsigned int kx, const unsigned int ky) |
get/set the color of the given indices | |
void | set_raw_data (const std::vector< octet > &raw_data) |
Directly set the raw data as a vector of concatenated (r,g,b) values. | |
std::vector< octet > | to_raw_data_rgba () const |
Export the data into a vector of concatenated rgba values. | |
std::vector< octet > | to_raw_data_rgb () const |
Export the data into a vector of concatenated rgb values. | |
Static Public Member Functions | |
static void | copy_bloc (unsigned int kx_source, unsigned int ky_source, const image &image_source, unsigned int kx_destination, unsigned int ky_destination, image *image_destination, unsigned int size_bloc) |
copy the bloc of the source image to the destination image at the given indices | |
Private Attributes | |
unsigned int | size_Nx |
internal storage of width | |
unsigned int | size_Ny |
internal storage of height | |
std::vector< color > | data |
internal storage of data | |
Storage class for an image Store image as a vector of color
cpe::image::image | ( | ) |
empty constructor
cpe::image::image | ( | unsigned int | Nx, |
unsigned int | Ny | ||
) |
cpe::image::image | ( | unsigned int | Nx, |
unsigned int | Ny, | ||
const std::vector< color > | data | ||
) |
void cpe::image::fill | ( | const color & | c | ) |
void cpe::image::fill_bloc | ( | unsigned int | kx, |
unsigned int | ky, | ||
unsigned int | size_bloc, | ||
const color & | c | ||
) |
const color & cpe::image::get | ( | const unsigned int | kx, |
const unsigned | ky | ||
) | const |
unsigned int cpe::image::Nx | ( | ) | const |
get width
References size_Nx.
Referenced by copy_bloc(), main(), cpe::io_png::write(), and cpe::io_jpeg::write().
unsigned int cpe::image::Ny | ( | ) | const |
get height
References size_Ny.
Referenced by copy_bloc(), main(), cpe::io_png::write(), and cpe::io_jpeg::write().
const color & cpe::image::operator() | ( | const unsigned int | kx, |
const unsigned int | ky | ||
) | const |
get the color of the given indices
color & cpe::image::operator() | ( | const unsigned int | kx, |
const unsigned int | ky | ||
) |
void cpe::image::resize | ( | unsigned int | Nx, |
unsigned int | Ny | ||
) |
void cpe::image::set | ( | const unsigned int | kx, |
const unsigned | ky, | ||
const color & | c | ||
) |
set the color at the given indice
References data, size_Nx, and size_Ny.
Referenced by copy_bloc().
void cpe::image::set_raw_data | ( | const std::vector< octet > & | raw_data | ) |
Directly set the raw data as a vector of concatenated (r,g,b) values.
References data, size_Nx, and size_Ny.
Referenced by cpe::io_png::read().
std::vector< octet > cpe::image::to_raw_data_rgb | ( | ) | const |
Export the data into a vector of concatenated rgb values.
References data, size_Nx, and size_Ny.
Referenced by cpe::io_jpeg::write().
std::vector< octet > cpe::image::to_raw_data_rgba | ( | ) | const |
Export the data into a vector of concatenated rgba values.
References data, size_Nx, and size_Ny.
Referenced by cpe::io_png::write().
|
private |
internal storage of data
Format: (r0,b0,g0,r1,b1,g1,...,rn,gn,bn)
Referenced by fill(), fill_bloc(), get(), image(), operator()(), resize(), set(), set_raw_data(), to_raw_data_rgb(), and to_raw_data_rgba().
|
private |
internal storage of width
Referenced by fill(), fill_bloc(), get(), image(), Nx(), operator()(), set(), set_raw_data(), to_raw_data_rgb(), and to_raw_data_rgba().
|
private |
internal storage of height
Referenced by fill(), fill_bloc(), get(), image(), Ny(), operator()(), set(), set_raw_data(), to_raw_data_rgb(), and to_raw_data_rgba().