Public Member Functions | Private Attributes

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

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

List of all members.

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.

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.


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.

  : m_header(h)
{

} // 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.

{
  CLAW_PRECOND( scanline.size() == 4 );

  unsigned int x=0;

  for ( unsigned int code=0; x!=img.width(); ++code )
    {
      u_int_8 c0 = scanline[0][code];
      u_int_8 c1 = scanline[1][code];
      u_int_8 c2 = scanline[2][code];
      u_int_8 c3 = scanline[3][code];

      for( unsigned int i=0; (i!=8) && (x!=img.width()); ++x, ++i )
        {
          unsigned int index =
            ( (c3 & 0x80) >> 4 )
            | ( (c2 & 0x80) >> 5 )
            | ( (c1 & 0x80) >> 6 )
            | ( (c0 & 0x80) >> 7 );

          img[y][x] = m_header.color_map[index];

          c0 <<= 1;
          c1 <<= 1;
          c2 <<= 1;
          c3 <<= 1;
        }
    }
} // 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.


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