claw::graphic::pcx::reader::converter_16 Class Reference

List of all members.


Detailed Description

Function object that converts a scanline of a 4bpp color mapped pcx into 32 bpp pixels.

Definition at line 224 of file pcx.hpp.


Public Member Functions

 converter_16 (const header &h)
 Constructor.
void operator() (const std::vector< color_plane_type > &scanline, image &img, unsigned int y) const
 Converts a scan line of a 4 bpp color mapped pcx into 32 bpp pixels.

Private Attributes

const headerm_header
 The header of the file. It contains the color palette.

Constructor & Destructor Documentation

claw::graphic::pcx::reader::converter_16::converter_16 ( const header h  ) 

Constructor.

Parameters:
h The header of the pcx file (contains the color palette).

Definition at line 70 of file pcx_reader.cpp.

00071   : m_header(h)
00072 {
00073 
00074 } // pcx::reader::converter_16::converter_16()


Member Function Documentation

void claw::graphic::pcx::reader::converter_16::operator() ( const std::vector< color_plane_type > &  scanline,
image img,
unsigned int  y 
) const

Converts a scan line of a 4 bpp color mapped pcx into 32 bpp pixels.

Parameters:
scanline the scan line to convert.
img The image in which we write the results.
y The line of img concerned by the pixels.

Definition at line 84 of file pcx_reader.cpp.

References CLAW_PRECOND, claw::graphic::pcx::header::color_map, and m_header.

00086 {
00087   CLAW_PRECOND( scanline.size() == 4 );
00088 
00089   unsigned int x=0;
00090 
00091   for ( unsigned int code=0; x!=img.width(); ++code )
00092     {
00093       u_int_8 c0 = scanline[0][code];
00094       u_int_8 c1 = scanline[1][code];
00095       u_int_8 c2 = scanline[2][code];
00096       u_int_8 c3 = scanline[3][code];
00097 
00098       for( unsigned int i=0; (i!=8) && (x!=img.width()); ++x, ++i )
00099         {
00100           unsigned int index =
00101             ( (c3 & 0x80) >> 4 )
00102             | ( (c2 & 0x80) >> 5 )
00103             | ( (c1 & 0x80) >> 6 )
00104             | ( (c0 & 0x80) >> 7 );
00105 
00106           img[y][x] = m_header.color_map[index];
00107 
00108           c0 <<= 1;
00109           c1 <<= 1;
00110           c2 <<= 1;
00111           c3 <<= 1;
00112         }
00113     }
00114 } // pcx::reader::converter_16::operator()()


Member Data Documentation

The header of the file. It contains the color palette.

Definition at line 234 of file pcx.hpp.

Referenced by operator()().


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

Generated on Thu Jun 26 09:35:06 2008 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.5.6