claw::graphic::xbm Class Reference

A class for xbm pictures. More...

#include <xbm.hpp>

Inheritance diagram for claw::graphic::xbm:
claw::graphic::image

List of all members.

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.
 xbm (const image &that)
 Copy constructor.
 xbm (std::istream &f)
 Constructor. Load an image from a xbm file.
 ~xbm ()
 Destructor.
void save (std::ostream &os) const
 Save the image.
void set_name (const std::string &name)
 Set the name of the image.
void set_hot (const claw::math::coordinate_2d< int > &hot)
 Set the hot spot of the image.

Private Attributes

std::string m_name
 The name of the image structure in the file.
claw::math::coordinate_2d< int > * m_hot
 The position of the hot spot in the image.

Detailed Description

A class for xbm pictures.

Author:
Julien Jorge

Definition at line 45 of file xbm.hpp.


Constructor & Destructor Documentation

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.

00040   : image(w, h), m_hot(NULL)
00041 {
00042 
00043 } // xbm::xbm() [constructor]

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

Copy constructor.

Parameters:
that Image to copy from.

Definition at line 50 of file xbm.cpp.

00051   : image(that), m_hot(NULL)
00052 {
00053 
00054 } // xbm::xbm() [copy constructor]

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.

00062   : m_hot(NULL)
00063 {
00064   reader(*this, f);
00065 } // xbm::xbm() [constructor, from file]

claw::graphic::xbm::~xbm (  ) 

Destructor.

Definition at line 71 of file xbm.cpp.

References m_hot.

00072 {
00073   if (m_hot != NULL)
00074     delete m_hot;
00075 } // xbm::~xbm()


Member Function Documentation

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.

References m_hot, and m_name.

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

00083 {
00084   writer( *this, f, writer::options( m_name, m_hot ) );
00085 } // xbm::save()

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.

References m_hot.

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

00103 {
00104   if (m_hot != NULL)
00105     delete m_hot;
00106 
00107   m_hot = new claw::math::coordinate_2d<int>(hot);
00108 } // xbm::set_hot()

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.

References m_name.

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

00093 {
00094   m_name = name;
00095 } // xbm::set_name()


Member Data Documentation

The position of the hot spot in the image.

Definition at line 149 of file xbm.hpp.

Referenced by save(), set_hot(), and ~xbm().

std::string claw::graphic::xbm::m_name [private]

The name of the image structure in the file.

Definition at line 146 of file xbm.hpp.

Referenced by save(), and set_name().


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

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1