Claw  1.7.0
Classes | Public Types | Public Member Functions
claw::graphic::image Class Reference

A class to deal with images. More...

#include <image.hpp>

Inheritance diagram for claw::graphic::image:
claw::graphic::bitmap claw::graphic::gif claw::graphic::gif::frame claw::graphic::jpeg claw::graphic::pcx claw::graphic::png claw::graphic::targa claw::graphic::xbm

List of all members.

Classes

class  base_iterator
 Base class for iterators on an image. More...
class  scanline
 One line in the image. More...

Public Types

typedef rgba_pixel pixel_type
typedef base_iterator< image,
pixel_type
iterator
typedef base_iterator< const
image, const pixel_type
const_iterator

Public Member Functions

 image ()
 Constructor. Creates an image without datas.
 image (unsigned int w, unsigned int h)
 Constructor. Creates an empty image.
 image (std::istream &f)
 Constructor. Reads an image from an input stream.
void swap (image &that)
 Swap the content of two images.
unsigned int width () const
 Gets image's width.
unsigned int height () const
 Gets image's height.
scanlineoperator[] (unsigned int i)
 Gets a line of the image.
const scanlineoperator[] (unsigned int i) const
 Gets a line of the image.
iterator begin ()
 Get an iterator pointing on the first pixel.
iterator end ()
 Get an iterator pointing just past the last pixel.
const_iterator begin () const
 Get an iterator pointing on the first pixel.
const_iterator end () const
 Get an iterator pointing just past the last pixel.
void merge (const image &that)
 Merge an image on the current image.
void merge (const image &that, const math::coordinate_2d< int > &pos)
 Merge an image on the current image.
void partial_copy (const image &that, const math::coordinate_2d< int > &pos)
 Copy an image on the current image.
void flip ()
 Set the image upside down.
void fill (const math::rectangle< int > r, const pixel_type &c)
 Fill an area of the image with a given color.
void set_size (unsigned int w, unsigned int h)
 Set a new size to the image.
void load (std::istream &f)
 Read the image from a stream.

Detailed Description

A class to deal with images.

Author:
Julien Jorge

Definition at line 49 of file image.hpp.


Constructor & Destructor Documentation

Constructor. Creates an image without datas.

Postcondition:
width() == height() == 0

Definition at line 106 of file image.cpp.

claw::graphic::image::image ( unsigned int  w,
unsigned int  h 
)

Constructor. Creates an empty image.

Parameters:
wImage's width.
hImage's height.
Precondition:
w > 0 and h > 0

Definition at line 128 of file image.cpp.

References set_size().

claw::graphic::image::image ( std::istream &  f)

Constructor. Reads an image from an input stream.

Parameters:
fThe stream to read from.

Definition at line 116 of file image.cpp.

References load().


Member Function Documentation

void claw::graphic::image::fill ( const math::rectangle< int >  r,
const pixel_type c 
)

Fill an area of the image with a given color.

Parameters:
rThe area to fill.
cThe color to fill with.

Definition at line 313 of file image.cpp.

References claw::graphic::rgba_pixel::components, height(), claw::math::rectangle< T >::intersection(), claw::math::rectangle< T >::intersects(), and width().

void claw::graphic::image::load ( std::istream &  f)

Read the image from a stream.

Parameters:
fThe stream to read from.

Definition at line 380 of file image.cpp.

Referenced by image(), and claw::graphic::gif::reader::reader().

void claw::graphic::image::merge ( const image that)

Merge an image on the current image.

Parameters:
thatThe image to merge.

Definition at line 205 of file image.cpp.

void claw::graphic::image::merge ( const image that,
const math::coordinate_2d< int > &  pos 
)
void claw::graphic::image::partial_copy ( const image that,
const math::coordinate_2d< int > &  pos 
)
void claw::graphic::image::set_size ( unsigned int  w,
unsigned int  h 
)

Set a new size to the image.

Remarks:
Image's data won't be lost. If a dimension is set larger than its current value, extra pixels won't be initialized.
Precondition:
(w!=0) && (h!=0)

Definition at line 362 of file image.cpp.

References height().

Referenced by image().

Swap the content of two images.

Parameters:
thatThe image to swap with.

Definition at line 138 of file image.cpp.


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