Conv32to4 Class Reference

Inheritance diagram for Conv32to4:

DIBConvert List of all members.

Public Member Functions

 Conv32to4 (UINT32, LPLOGPALETTE, UINT32)
 Constructor to Convert 32bpp to 4bpp.
 ~Conv32to4 ()
BOOL Convert (LPBYTE Input, LPBYTE Output, UINT32 Height, BOOL FirstStrip)

Private Attributes

BITMAPINFOHEADER SourceHeader
BITMAPINFOHEADER DestHeader
LPLOGPALETTE DestPalette
UINT32 Dither

Detailed Description

Definition at line 167 of file dibconv.cpp.


Constructor & Destructor Documentation

Conv32to4::Conv32to4 UINT32  Width,
LPLOGPALETTE  Palette,
UINT32  DitherType
 

Constructor to Convert 32bpp to 4bpp.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>?
Date:
29/06/96

Definition at line 641 of file dibconv.cpp.

00642 {
00643     ERROR3IF(Palette==NULL,"Conv32to4 null palette specified");
00644 
00645     SourceHeader.biPlanes = 1;
00646     SourceHeader.biBitCount = 32;
00647     SourceHeader.biWidth = Width;
00648     SourceHeader.biClrUsed = 0;
00649 
00650     DestHeader.biPlanes = 1;
00651     DestHeader.biBitCount = 4;
00652     DestHeader.biWidth = Width;
00653     DestHeader.biClrUsed = 16;
00654 
00655     DestPalette = Palette;
00656 
00657     // Remember which dithering to use
00658     Dither = DitherType;
00659 
00660     // lets use this palette for the conversion
00661     GDrawContext *GDC = GetConvertContext();
00662     GDC->SetConversionPalette(DestPalette);
00663 }

Conv32to4::~Conv32to4  ) 
 

Definition at line 665 of file dibconv.cpp.

00666 {
00667 }


Member Function Documentation

BOOL Conv32to4::Convert LPBYTE  Input,
LPBYTE  Output,
UINT32  Height,
BOOL  FirstStrip
[virtual]
 

Implements DIBConvert.

Definition at line 669 of file dibconv.cpp.

00670 {
00671     SourceHeader.biHeight = Height;
00672 
00673     DestHeader.biHeight = Height;
00674 
00675     DWORD DitherWord = Dither;
00676     TRACEUSER( "Andy?", _T("Convert32to4, Strip = %d, dither = %d\n"), FirstStrip, Dither);
00677 
00678     if (Dither == XARADITHER_SIMPLE || Dither == XARADITHER_ERROR_DIFFUSION)
00679     {
00680         // We are using some form of error diffusion ....
00681 
00682         // Set second byte to 255 if this is the First strip,
00683         // so that the error buffer is cleared
00684         DitherWord |= (( FirstStrip ? 0 : 255 ) << 8);
00685     }
00686 
00687     GDrawContext *GDC = GetConvertContext();
00688     const BOOL res = GDC->ConvertBitmap( &SourceHeader, Input, &DestHeader, Output, DitherWord );
00689 
00690     if (!res)
00691         TRACE( _T("GColour_ConvertBitmap did error %x\n"), GetLastError() );
00692 
00693     return TRUE;
00694 }


Member Data Documentation

BITMAPINFOHEADER Conv32to4::DestHeader [private]
 

Definition at line 177 of file dibconv.cpp.

LPLOGPALETTE Conv32to4::DestPalette [private]
 

Definition at line 178 of file dibconv.cpp.

UINT32 Conv32to4::Dither [private]
 

Definition at line 179 of file dibconv.cpp.

BITMAPINFOHEADER Conv32to4::SourceHeader [private]
 

Definition at line 176 of file dibconv.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 03:53:10 2007 for Camelot by  doxygen 1.4.4