Claw  1.7.3
xbm.cpp
Go to the documentation of this file.
1 /*
2  CLAW - a C++ Library Absolutely Wonderful
3 
4  CLAW is a free library without any particular aim but being useful to
5  anyone.
6 
7  Copyright (C) 2005-2011 Julien Jorge
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23  contact: julien.jorge@gamned.org
24 */
30 #include <claw/xbm.hpp>
31 
32 /*----------------------------------------------------------------------------*/
39 claw::graphic::xbm::xbm( unsigned int w, unsigned int h )
40  : image(w, h), m_hot(NULL)
41 {
42 
43 } // xbm::xbm() [constructor]
44 
45 /*----------------------------------------------------------------------------*/
51  : image(that), m_hot(NULL)
52 {
53 
54 } // xbm::xbm() [copy constructor]
55 
56 /*----------------------------------------------------------------------------*/
61 claw::graphic::xbm::xbm( std::istream& f )
62  : m_hot(NULL)
63 {
64  reader(*this, f);
65 } // xbm::xbm() [constructor, from file]
66 
67 /*----------------------------------------------------------------------------*/
72 {
73  if (m_hot != NULL)
74  delete m_hot;
75 } // xbm::~xbm()
76 
77 /*----------------------------------------------------------------------------*/
82 void claw::graphic::xbm::save( std::ostream& f ) const
83 {
84  writer( *this, f, writer::options( m_name, m_hot ) );
85 } // xbm::save()
86 
87 /*----------------------------------------------------------------------------*/
92 void claw::graphic::xbm::set_name( const std::string& name )
93 {
94  m_name = name;
95 } // xbm::set_name()
96 
97 /*----------------------------------------------------------------------------*/
103 {
104  if (m_hot != NULL)
105  delete m_hot;
106 
107  m_hot = new claw::math::coordinate_2d<int>(hot);
108 } // xbm::set_hot()
109 
claw::graphic::xbm::writer
This class write an image in a xbm file.
Definition: xbm.hpp:94
claw::graphic::xbm::save
void save(std::ostream &os) const
Save the image.
Definition: xbm.cpp:82
claw::math::coordinate_2d< int >
claw::graphic::xbm::set_hot
void set_hot(const claw::math::coordinate_2d< int > &hot)
Set the hot spot of the image.
Definition: xbm.cpp:102
claw::graphic::xbm::~xbm
~xbm()
Destructor.
Definition: xbm.cpp:71
claw::graphic::xbm::writer::options
Parameters of the writing algorithm.
Definition: xbm.hpp:100
claw::graphic::xbm::xbm
xbm(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
Definition: xbm.cpp:39
claw::graphic::xbm::set_name
void set_name(const std::string &name)
Set the name of the image.
Definition: xbm.cpp:92
claw::graphic::xbm::reader
This class read data from a xbm file and store it in an image.
Definition: xbm.hpp:53
claw::graphic::image
A class to deal with images.
Definition: image.hpp:49
xbm.hpp
A class for xbm pictures.