cpe::image Class Reference

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

Collaboration diagram for cpe::image:
Collaboration graph
[legend]

List of all members.

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 coloroperator() (const int &px, const int &py) const
 get pixel (px,py)
coloroperator() (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< colorinternal_data
 internal data storage as std::vector of unsigned char

Detailed Description

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


Constructor & Destructor Documentation

cpe::image::image (  ) 

empty constructor

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

create picture of size Nx x Ny

Parameters:
unsigned int Nx: picture width
unsigned int Ny: picture height

References internal_data, internal_Nx, and internal_Ny.


Member Function Documentation

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

Returns:
true if (kx,ky) is within the picture, false otherwise

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

Parameters:
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

get the picture width in pixel

References internal_Nx.

Referenced by main().

const unsigned int & cpe::image::Ny (  )  const

get the picture height in pixel

References internal_Ny.

Referenced by main().

color & cpe::image::operator() ( const int &  px,
const int &  py 
)

get pixel (px,py)

References check_position(), internal_data, internal_Nx, and internal_Ny.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void cpe::image::read_ppm ( const std::string &  filename  ) 

read a ppm picture format (ascii)

Parameters:
std::string filename: path of the file to read

References internal_data, internal_Nx, and internal_Ny.

Referenced by main().


Member Data Documentation

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


The documentation for this class was generated from the following files:
Generated on Fri Apr 1 14:59:46 2011 by  doxygen 1.6.3