Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Bmp Class Reference

a windows bitmap (might be loaded and saved). More...

#include <Bmp.h>

Collaboration diagram for Bmp:

Collaboration graph
[legend]
List of all members.

Public Methods

 Bmp (const std::string &filename)
 read a bitmap from file. More...

 Bmp (size_t xsize_, size_t ysize_)
 construct an empty bitmap. More...

 Bmp (const Bmp &other)
Bmp & operator= (const Bmp &other)
virtual ~Bmp ()
UINT32 Xsize () const
 get width of bitmap. More...

UINT32 Ysize () const
 get height of bitmap. More...

Pixel getPixel (UINT32 xpos, UINT32 ypos)
 get access to one pixel of the bitmap. More...

const Pixel getPixel (UINT32 xpos, UINT32 ypos) const
void setPixel (UINT32 xpos, UINT32 ypos, unsigned char red, unsigned char green, unsigned char blue)
 set the value of a pixel in the Bmp. More...

void saveAs (const std::string &filename) const
 save the bitmap to file. More...

const std::string & originalFilename () const
 returns the filename the Bmp was loaded from. More...

void left (Pixel &curr, size_t dist=1)
 move a Pixel leftwards. More...

void right (Pixel &curr, size_t dist=1)
 move a Pixel rightwards. More...

void up (Pixel &curr, size_t dist=1)
 move a Pixel upwards. More...

void down (Pixel &curr, size_t dist=1)
 move a Pixel downwards. More...


Private Methods

unsigned char * pixelPointer (UINT32 xpos, UINT32 ypos)
void getPositions (const Pixel &pixel, UINT32 &xpos_result, UINT32 &ypos_result) const

Static Private Methods

void throw_wrong_pix_pos ()

Private Attributes

std::string loaded_from_file
UINT32 xsize
UINT32 ysize
unsigned char * data
size_t offset_per_line

Detailed Description

a windows bitmap (might be loaded and saved).

Definition at line 160 of file Bmp.h.


Constructor & Destructor Documentation

Bmp const std::string &    filename
 

read a bitmap from file.

Parameters:
filename  guess what

Definition at line 114 of file Bmp.cpp.

Bmp size_t    xsize_,
size_t    ysize_
 

construct an empty bitmap.

Parameters:
xsize_  width of bitmap
ysize_  height of bitmap
Note:
All pixels are set to color (0, 0, 0)

Definition at line 60 of file Bmp.cpp.

Bmp const Bmp &    other
 

Definition at line 77 of file Bmp.cpp.

virtual ~Bmp   [inline, virtual]
 

Definition at line 203 of file Bmp.h.


Member Function Documentation

void throw_wrong_pix_pos   [static, private]
 

Definition at line 335 of file Bmp.cpp.

Referenced by Bmp::getPositions(), and Bmp::pixelPointer().

unsigned char* pixelPointer UINT32    xpos,
UINT32    ypos
[inline, private]
 

Definition at line 172 of file Bmp.h.

Referenced by Bmp::getPixel(), and Bmp::setPixel().

void getPositions const Pixel   pixel,
UINT32   xpos_result,
UINT32   ypos_result
const [inline, private]
 

Definition at line 177 of file Bmp.h.

Referenced by Bmp::down(), Bmp::left(), Bmp::right(), and Bmp::up().

Bmp & operator= const Bmp &    other
 

Definition at line 93 of file Bmp.cpp.

UINT32 Xsize   const [inline]
 

get width of bitmap.

Definition at line 206 of file Bmp.h.

Referenced by rs::halfBmp(), and Bmp::saveAs().

UINT32 Ysize   const [inline]
 

get height of bitmap.

Definition at line 209 of file Bmp.h.

Referenced by rs::halfBmp(), and Bmp::saveAs().

Pixel getPixel UINT32    xpos,
UINT32    ypos
[inline]
 

get access to one pixel of the bitmap.

Parameters:
xpos  horizontal offset in the bitmap (from left to right)
ypos  vertical offset in the bitmap (from top to bottom)
Returns:
the Pixel

Definition at line 216 of file Bmp.h.

Referenced by Bmp::down(), rs::halfBmp(), Bmp::left(), Bmp::right(), and Bmp::up().

const Pixel getPixel UINT32    xpos,
UINT32    ypos
const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 219 of file Bmp.h.

void setPixel UINT32    xpos,
UINT32    ypos,
unsigned char    red,
unsigned char    green,
unsigned char    blue
[inline]
 

set the value of a pixel in the Bmp.

Parameters:
xpos  horizontal position
ypos  vertical position
red  value for red channel
green  value for green channel
blue  value for blue channel

Definition at line 228 of file Bmp.h.

Referenced by rs::halfBmp().

void saveAs const std::string &    filename const
 

save the bitmap to file.

Parameters:
filename  name of file to save

Definition at line 266 of file Bmp.cpp.

const std::string& originalFilename   const [inline]
 

returns the filename the Bmp was loaded from.

Returns:
filename (or "" if Bmp wasn't loaded)

Definition at line 244 of file Bmp.h.

void left Pixel   curr,
size_t    dist = 1
[inline]
 

move a Pixel leftwards.

Definition at line 247 of file Bmp.h.

void right Pixel   curr,
size_t    dist = 1
[inline]
 

move a Pixel rightwards.

Definition at line 254 of file Bmp.h.

void up Pixel   curr,
size_t    dist = 1
[inline]
 

move a Pixel upwards.

Definition at line 261 of file Bmp.h.

void down Pixel   curr,
size_t    dist = 1
[inline]
 

move a Pixel downwards.

Definition at line 268 of file Bmp.h.


Member Data Documentation

std::string loaded_from_file [private]
 

Definition at line 162 of file Bmp.h.

Referenced by Bmp::Bmp(), Bmp::operator=(), and Bmp::originalFilename().

UINT32 xsize [private]
 

Definition at line 164 of file Bmp.h.

Referenced by Bmp::Bmp(), Bmp::getPositions(), Bmp::operator=(), Bmp::pixelPointer(), and Bmp::Xsize().

UINT32 ysize [private]
 

Definition at line 165 of file Bmp.h.

Referenced by Bmp::Bmp(), Bmp::getPositions(), Bmp::operator=(), Bmp::pixelPointer(), Bmp::saveAs(), and Bmp::Ysize().

unsigned char* data [private]
 

Definition at line 167 of file Bmp.h.

Referenced by Bmp::Bmp(), Bmp::getPositions(), Bmp::operator=(), Bmp::pixelPointer(), Bmp::saveAs(), and Bmp::~Bmp().

size_t offset_per_line [private]
 

Definition at line 168 of file Bmp.h.

Referenced by Bmp::Bmp(), Bmp::getPositions(), Bmp::operator=(), Bmp::pixelPointer(), and Bmp::saveAs().


The documentation for this class was generated from the following files:
Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen