cpe::image Class Reference
+ Collaboration diagram for cpe::image:

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 colorget (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 coloroperator() (const unsigned int kx, const unsigned int ky) const
 get the color of the given indices
 
coloroperator() (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< octetto_raw_data_rgba () const
 Export the data into a vector of concatenated rgba values.
 
std::vector< octetto_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< colordata
 internal storage of data
 

Detailed Description

Storage class for an image Store image as a vector of color

Constructor & Destructor Documentation

cpe::image::image ( )

empty constructor

cpe::image::image ( unsigned int  Nx,
unsigned int  Ny 
)

direct allocation of empty image (black image)

References resize(), size_Nx, and size_Ny.

+ Here is the call graph for this function:

cpe::image::image ( unsigned int  Nx,
unsigned int  Ny,
const std::vector< color data 
)

direct set of image with the raw data

Precondition
size of data must be Nx*Ny

References data.

Member Function Documentation

void cpe::image::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 
)
static

copy the bloc of the source image to the destination image at the given indices

Precondition
the indices must be within the size of the images

References Nx(), Ny(), and set().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cpe::image::fill ( const color c)

Fill the full image with the given color.

References data, size_Nx, and size_Ny.

Referenced by main().

+ Here is the caller graph for this function:

void cpe::image::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.

Precondition
All indices spaned the bloc must belong to the image

References data, size_Nx, and size_Ny.

Referenced by main().

+ Here is the caller graph for this function:

const color & cpe::image::get ( const unsigned int  kx,
const unsigned  ky 
) const

get the color of the given indices

Precondition
(kx,ky) must be within the size of the image

References data, size_Nx, and size_Ny.

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

const color & cpe::image::operator() ( const unsigned int  kx,
const unsigned int  ky 
) const

get the color of the given indices

Precondition
(kx,ky) must be within the size of the image
color & cpe::image::operator() ( const unsigned int  kx,
const unsigned int  ky 
)

get/set the color of the given indices

Precondition
(kx,ky) must be within the size of the image

References data, size_Nx, and size_Ny.

void cpe::image::resize ( unsigned int  Nx,
unsigned int  Ny 
)

resize a new black image to the given size

References data.

Referenced by image().

+ Here is the caller graph for this function:

void cpe::image::set ( const unsigned int  kx,
const unsigned  ky,
const color c 
)

set the color at the given indice

Precondition
(kx,ky) must be within the size of the image

References data, size_Nx, and size_Ny.

Referenced by copy_bloc().

+ Here is the caller graph for this function:

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.

Precondition
The size of the raw data must be 3*Nx*Ny

References data, size_Nx, and size_Ny.

Referenced by cpe::io_png::read().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<color> cpe::image::data
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().

unsigned int cpe::image::size_Nx
private
unsigned int cpe::image::size_Ny
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().


The documentation for this class was generated from the following files: