xbm.cpp
Go to the documentation of this file.
/*
CLAW - a C++ Library Absolutely Wonderful
CLAW is a free library without any particular aim but being useful to
anyone.
Copyright (C) 2005-2011 Julien Jorge
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
contact: julien.jorge@gamned.org
*/
#include <claw/xbm.hpp>
/*----------------------------------------------------------------------------*/
claw::graphic::xbm::xbm( unsigned int w, unsigned int h )
: image(w, h), m_hot(NULL)
{
} // xbm::xbm() [constructor]
/*----------------------------------------------------------------------------*/
claw::graphic::xbm::xbm( const image& that )
: image(that), m_hot(NULL)
{
} // xbm::xbm() [copy constructor]
/*----------------------------------------------------------------------------*/
claw::graphic::xbm::xbm( std::istream& f )
: m_hot(NULL)
{
reader(*this, f);
} // xbm::xbm() [constructor, from file]
/*----------------------------------------------------------------------------*/
claw::graphic::xbm::~xbm()
{
if (m_hot != NULL)
delete m_hot;
} // xbm::~xbm()
/*----------------------------------------------------------------------------*/
void claw::graphic::xbm::save( std::ostream& f ) const
{
writer( *this, f, writer::options( m_name, m_hot ) );
} // xbm::save()
/*----------------------------------------------------------------------------*/
void claw::graphic::xbm::set_name( const std::string& name )
{
m_name = name;
} // xbm::set_name()
/*----------------------------------------------------------------------------*/
void claw::graphic::xbm::set_hot( const claw::math::coordinate_2d<int>& hot )
{
if (m_hot != NULL)
delete m_hot;
m_hot = new claw::math::coordinate_2d<int>(hot);
} // xbm::set_hot()
claw::graphic::image::image
image()
Constructor. Creates an image without datas.
Definition image.cpp:106
claw::graphic::xbm::reader
This class read data from a xbm file and store it in an image.
Definition xbm.hpp:54
claw::graphic::xbm::writer
This class write an image in a xbm file.
Definition xbm.hpp:95
claw::graphic::xbm::save
void save(std::ostream &os) const
Save the image.
Definition xbm.cpp:82
claw::graphic::xbm::xbm
xbm(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
Definition xbm.cpp:39
claw::graphic::xbm::~xbm
~xbm()
Destructor.
Definition xbm.cpp:71
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::set_name
void set_name(const std::string &name)
Set the name of the image.
Definition xbm.cpp:92
claw::math::coordinate_2d
Coordinates in a two dimensional space.
Definition coordinate_2d.hpp:43
claw::graphic::xbm::writer::options
Parameters of the writing algorithm.
Definition xbm.hpp:101
xbm.hpp
A class for xbm pictures.