claw::graphic::xbm Class Reference

A class for xbm pictures. More...

`#include <xbm.hpp>`

Inheritance diagram for claw::graphic::xbm:

## Classes

class | reader
| This class read data from a xbm file and store it in an image. More...
class | writer
| This class write an image in a xbm file. More...

## Public Member Functions

| xbm (unsigned int w, unsigned int h)
| Constructor. Creates an empty image. More...
| xbm (const image &that)
| Copy constructor. More...
| xbm (std::istream &f)
| Constructor. Load an image from a xbm file. More...
| ~xbm ()
| Destructor.
void | save (std::ostream &os) const
| Save the image. More...
void | set_name (const std::string &name)
| Set the name of the image. More...
void | set_hot (const claw::math::coordinate_2d< int > &hot)
| Set the hot spot of the image. More...
Public Member Functions inherited from claw::graphic::image
| image ()
| Constructor. Creates an image without datas. More...
| image (unsigned int w, unsigned int h)
| Constructor. Creates an empty image. More...
| image (std::istream &f)
| Constructor. Reads an image from an input stream. More...
void | swap (image &that)
| Swap the content of two images. More...
unsigned int | width () const
| Gets image's width.
unsigned int | height () const
| Gets image's height.
scanline & | operator[] (unsigned int i)
| Gets a line of the image.
const scanline & | operator[] (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. More...
void | merge (const image &that, const math::coordinate_2d< int > &pos)
| Merge an image on the current image. More...
void | partial_copy (const image &that, const math::coordinate_2d< int > &pos)
| Copy an image on the current image. More...
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. More...
void | set_size (unsigned int w, unsigned int h)
| Set a new size to the image. More...
void | load (std::istream &f)
| Read the image from a stream. More...

## Additional Inherited Members

Public Types inherited from claw::graphic::image
typedef rgba_pixel | pixel_type
| The type representing the colors of the pixels in the image.
typedef base_iterator< image, pixel_type > | iterator
| The type of the iterator on the pixels of the image. More...
typedef base_iterator< const image, const pixel_type > | const_iterator
| The type of the iterator to access constant pixels. More...

## Detailed Description

A class for xbm pictures.

Author
  Julien Jorge

Definition at line 45 of file xbm.hpp.

## Constructor & Destructor Documentation

## xbm() [1/3]

claw::graphic::xbm::xbm | ( | unsigned int | w,
|  | unsigned int | h
| ) |  |

Constructor. Creates an empty image.

Parameters

  w | Image's width.
  h | Image's height.

Precondition
  w > 0 and h > 0

Definition at line 39 of file xbm.cpp.

## xbm() [2/3]

claw::graphic::xbm::xbm | ( | const image & | that | ) |

Copy constructor.

Parameters

  that | Image to copy from.

Definition at line 50 of file xbm.cpp.

## xbm() [3/3]

claw::graphic::xbm::xbm | ( | std::istream & | f | ) |

Constructor. Load an image from a xbm file.

Parameters

  f | Xbm file.

Definition at line 61 of file xbm.cpp.

## Member Function Documentation

## save()

void claw::graphic::xbm::save | ( | std::ostream & | f | ) | const

Save the image.

Parameters

  f | The file in which we write.

Definition at line 82 of file xbm.cpp.

## set_hot()

void claw::graphic::xbm::set_hot | ( | const claw::math::coordinate_2d< int > & | hot | ) |

Set the hot spot of the image.

Parameters

  hot | The hot spot of the image;

Definition at line 102 of file xbm.cpp.

Referenced by claw::graphic::xbm::reader::reader().

## set_name()

void claw::graphic::xbm::set_name | ( | const std::string & | name | ) |

Set the name of the image.

Parameters

  name | The name of the image;

Definition at line 92 of file xbm.cpp.

Referenced by claw::graphic::xbm::reader::reader().

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

- xbm.hpp
- code/xbm.cpp