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 67 of file pcx_reader.cpp.

00068   : m_header(h)
00069 {
00070 
00071 } // 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 81 of file pcx_reader.cpp.

References CLAW_PRECOND.

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


Member Data Documentation

const header& claw::graphic::pcx::reader::converter_16::m_header [private]

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

Definition at line 234 of file pcx.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Nov 9 05:07:11 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.4.7