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

kino::basic_bitmap< PixelType > Class Template Reference

Encapsulates a bitmap image. More...

#include <kino_plugin_types.h>

Collaboration diagram for kino::basic_bitmap< PixelType >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef PixelType pixel_type
typedef PixelType * iterator
typedef const PixelType * const_iterator
typedef basic_bitmap< pixel_typethis_type

Public Member Functions

 basic_bitmap ()
 Creates an empty bitmap.
 basic_bitmap (const pixel_size_type Width, const pixel_size_type Height)
 Creates a new bitmap with given width and height in pixels.
 basic_bitmap (void *Data, const pixel_size_type Width, const pixel_size_type Height)
 Creates a new bitmap, copying "old fashioned" C-style data.
 basic_bitmap (this_type &RHS)
 Copy constructor for bitmaps of similar type.
template<typename ForeignType>
 basic_bitmap (basic_bitmap< ForeignType > &RHS)
 Copy constructor for bitmaps of dissimilar type.
virtual ~basic_bitmap ()
 Destructor.
pixel_size_type width () const
 Returns the bitmap width in pixels.
pixel_size_type height () const
 Returns the bitmap height in pixels.
const pixel_type *const data () const
 Returns the raw bitmap data array.
pixel_type *const data ()
 Returns the raw bitmap data array.
void clear ()
void reset (const pixel_size_type Width, const pixel_size_type Height)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const

Private Attributes

pixel_size_type m_width
 Stores the bitmap width in pixels.
pixel_size_type m_height
 Stores the bitmap height in pixels.
PixelType * m_data
 Stores the bitmap data as a 1D array of pixels.

Detailed Description

template<typename PixelType>
class kino::basic_bitmap< PixelType >

Encapsulates a bitmap image.

Definition at line 528 of file kino_plugin_types.h.


Member Typedef Documentation

template<typename PixelType>
typedef const PixelType* kino::basic_bitmap< PixelType >::const_iterator
 

Definition at line 533 of file kino_plugin_types.h.

template<typename PixelType>
typedef PixelType* kino::basic_bitmap< PixelType >::iterator
 

Definition at line 532 of file kino_plugin_types.h.

template<typename PixelType>
typedef PixelType kino::basic_bitmap< PixelType >::pixel_type
 

Definition at line 531 of file kino_plugin_types.h.

template<typename PixelType>
typedef basic_bitmap<pixel_type> kino::basic_bitmap< PixelType >::this_type
 

Definition at line 534 of file kino_plugin_types.h.


Constructor & Destructor Documentation

template<typename PixelType>
kino::basic_bitmap< PixelType >::basic_bitmap  )  [inline]
 

Creates an empty bitmap.

Definition at line 537 of file kino_plugin_types.h.

00537                    :
00538         m_width(0),
00539         m_height(0),
00540         m_data(0)
00541     {
00542     }
    

template<typename PixelType>
kino::basic_bitmap< PixelType >::basic_bitmap const pixel_size_type  Width,
const pixel_size_type  Height
[inline]
 

Creates a new bitmap with given width and height in pixels.

Definition at line 545 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00545                                                                             :
00546         m_width(Width),
00547         m_height(Height),
00548         m_data(static_cast<pixel_type*>(std::malloc(m_width * m_height * sizeof(pixel_type))))
00549     {
00550         // Sanity checks ...
00551         assert(m_width);
00552         assert(m_height);
00553         assert(m_data);
00554     }

template<typename PixelType>
kino::basic_bitmap< PixelType >::basic_bitmap void *  Data,
const pixel_size_type  Width,
const pixel_size_type  Height
[inline]
 

Creates a new bitmap, copying "old fashioned" C-style data.

Definition at line 557 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00557                                                                                         :
00558         m_width(Width),
00559         m_height(Height),
00560         m_data(static_cast<pixel_type*>(std::malloc(m_width * m_height * sizeof(pixel_type))))
00561     {
00562         // Sanity checks ...
00563         assert(m_width);
00564         assert(m_height);
00565         assert(m_data);
00566         assert(Data);
00567         
00568         memcpy(m_data, Data, m_width * m_height * sizeof(pixel_type));
00569     }

template<typename PixelType>
kino::basic_bitmap< PixelType >::basic_bitmap this_type RHS  )  [inline]
 

Copy constructor for bitmaps of similar type.

Definition at line 572 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00572                                  :
00573         m_width(RHS.m_width),
00574         m_height(RHS.m_height),
00575         m_data(static_cast<pixel_type*>(std::malloc(m_width * m_height * sizeof(pixel_type))))
00576     {
00577         memcpy(m_data, RHS.m_data, m_width * m_height * sizeof(pixel_type));
00578     }

template<typename PixelType>
template<typename ForeignType>
kino::basic_bitmap< PixelType >::basic_bitmap basic_bitmap< ForeignType > &  RHS  )  [inline]
 

Copy constructor for bitmaps of dissimilar type.

Definition at line 581 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::data(), kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00581                                                  :
00582         m_width(RHS.width()),
00583         m_height(RHS.height()),
00584         m_data(static_cast<pixel_type*>(std::malloc(m_width * m_height * sizeof(pixel_type))))
00585     {
00586         std::copy(RHS.data(), RHS.data() + m_width * m_height, m_data);
00587     }

template<typename PixelType>
virtual kino::basic_bitmap< PixelType >::~basic_bitmap  )  [inline, virtual]
 

Destructor.

Definition at line 590 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::clear().

00591     {
00592         clear();
00593     }


Member Function Documentation

template<typename PixelType>
const_iterator kino::basic_bitmap< PixelType >::begin  )  const [inline]
 

Definition at line 650 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data.

00651     {
00652         return m_data;
00653     }

template<typename PixelType>
iterator kino::basic_bitmap< PixelType >::begin  )  [inline]
 

Definition at line 645 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data.

00646     {
00647         return m_data;
00648     }

template<typename PixelType>
void kino::basic_bitmap< PixelType >::clear  )  [inline]
 

Definition at line 619 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

Referenced by kino::basic_bitmap< PixelType >::reset(), and kino::basic_bitmap< PixelType >::~basic_bitmap().

00620     {
00621         if(m_data)
00622             std::free(m_data);
00623         
00624         m_width = 0;
00625         m_height = 0;
00626         m_data = 0;
00627     }

template<typename PixelType>
pixel_type* const kino::basic_bitmap< PixelType >::data  )  [inline]
 

Returns the raw bitmap data array.

Definition at line 614 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data.

00615     {
00616         return m_data;
00617     }

template<typename PixelType>
const pixel_type* const kino::basic_bitmap< PixelType >::data  )  const [inline]
 

Returns the raw bitmap data array.

Definition at line 608 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data.

Referenced by kino::basic_bitmap< PixelType >::basic_bitmap(), and kino::basic_bitmap< PixelType >::reset().

00609     {
00610         return m_data;
00611     }

template<typename PixelType>
const_iterator kino::basic_bitmap< PixelType >::end  )  const [inline]
 

Definition at line 660 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00661     {
00662         return m_data + (m_width * m_height);
00663     }

template<typename PixelType>
iterator kino::basic_bitmap< PixelType >::end  )  [inline]
 

Definition at line 655 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00656     {
00657         return m_data + (m_width * m_height);
00658     }

template<typename PixelType>
pixel_size_type kino::basic_bitmap< PixelType >::height  )  const [inline]
 

Returns the bitmap height in pixels.

Definition at line 602 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_height.

00603     {
00604         return m_height;
00605     }

template<typename PixelType>
void kino::basic_bitmap< PixelType >::reset const pixel_size_type  Width,
const pixel_size_type  Height
[inline]
 

Definition at line 629 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::clear(), kino::basic_bitmap< PixelType >::data(), kino::basic_bitmap< PixelType >::m_data, kino::basic_bitmap< PixelType >::m_height, and kino::basic_bitmap< PixelType >::m_width.

00630     {
00631         // Sanity checks ...
00632         assert(Width);
00633         assert(Height);
00634     
00635         pixel_type* const data = static_cast<pixel_type*>(std::malloc(Width * Height * sizeof(pixel_type)));
00636         assert(data);
00637         
00638         clear();
00639         
00640         m_width = Width;
00641         m_height = Height;
00642         m_data = data;
00643     }

template<typename PixelType>
pixel_size_type kino::basic_bitmap< PixelType >::width  )  const [inline]
 

Returns the bitmap width in pixels.

Definition at line 596 of file kino_plugin_types.h.

References kino::basic_bitmap< PixelType >::m_width.

00597     {
00598         return m_width;
00599     }


Member Data Documentation

template<typename PixelType>
PixelType* kino::basic_bitmap< PixelType >::m_data [private]
 

Stores the bitmap data as a 1D array of pixels.

Definition at line 671 of file kino_plugin_types.h.

Referenced by kino::basic_bitmap< PixelType >::basic_bitmap(), kino::basic_bitmap< PixelType >::begin(), kino::basic_bitmap< PixelType >::clear(), kino::basic_bitmap< PixelType >::data(), kino::basic_bitmap< PixelType >::end(), and kino::basic_bitmap< PixelType >::reset().

template<typename PixelType>
pixel_size_type kino::basic_bitmap< PixelType >::m_height [private]
 

Stores the bitmap height in pixels.

Definition at line 669 of file kino_plugin_types.h.

Referenced by kino::basic_bitmap< PixelType >::basic_bitmap(), kino::basic_bitmap< PixelType >::clear(), kino::basic_bitmap< PixelType >::end(), kino::basic_bitmap< PixelType >::height(), and kino::basic_bitmap< PixelType >::reset().

template<typename PixelType>
pixel_size_type kino::basic_bitmap< PixelType >::m_width [private]
 

Stores the bitmap width in pixels.

Definition at line 667 of file kino_plugin_types.h.

Referenced by kino::basic_bitmap< PixelType >::basic_bitmap(), kino::basic_bitmap< PixelType >::clear(), kino::basic_bitmap< PixelType >::end(), kino::basic_bitmap< PixelType >::reset(), and kino::basic_bitmap< PixelType >::width().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:13:29 2007 for Kino by  doxygen 1.4.2