Conv32to1 Class Reference

Inheritance diagram for Conv32to1:

DIBConvert List of all members.

Public Member Functions

 Conv32to1 (UINT32, LPLOGPALETTE, UINT32)
 Constructor to Convert 32bpp to 1bpp.
 ~Conv32to1 ()
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 183 of file dibconv.cpp.


Constructor & Destructor Documentation

Conv32to1::Conv32to1 UINT32  Width,
LPLOGPALETTE  Palette,
UINT32  DitherType
 

Constructor to Convert 32bpp to 1bpp.

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

Definition at line 706 of file dibconv.cpp.

00707 {
00708     ERROR3IF(Palette==NULL,"Conv32to1 null palette specified");
00709 
00710     SourceHeader.biPlanes = 1;
00711     SourceHeader.biBitCount = 32;
00712     SourceHeader.biWidth = Width;
00713     SourceHeader.biClrUsed = 0;
00714 
00715     DestHeader.biPlanes = 1;
00716     DestHeader.biBitCount = 1;
00717     DestHeader.biWidth = Width;
00718     DestHeader.biClrUsed = 2;
00719 
00720     DestPalette = Palette;
00721 
00722     TRACEUSER("Andy?", wxT("Creating Convert32to1, Pal@%x, Entries=%d\n"), DestPalette, DestPalette->palNumEntries);
00723     TRACEUSER("Andy?", wxT("Pal[0] = %dR,%dG,%dB\n"),   DestPalette->palPalEntry[0].peRed,
00724                                                 DestPalette->palPalEntry[0].peGreen,
00725                                                 DestPalette->palPalEntry[0].peBlue);
00726     TRACEUSER("Andy?", wxT("Pal[1] = %dR,%dG,%dB\n"),   DestPalette->palPalEntry[1].peRed,
00727                                                 DestPalette->palPalEntry[1].peGreen,
00728                                                 DestPalette->palPalEntry[1].peBlue);
00729 
00730     // Remember which dithering to use
00731     Dither = DitherType;
00732 
00733     // lets use this palette for the conversion
00734     GDrawContext *GDC = GetConvertContext();
00735     GDC->SetConversionPalette(DestPalette);
00736 }

Conv32to1::~Conv32to1  ) 
 

Definition at line 738 of file dibconv.cpp.

00739 {
00740 }


Member Function Documentation

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

Implements DIBConvert.

Definition at line 742 of file dibconv.cpp.

00743 {
00744     SourceHeader.biHeight = Height;
00745     DestHeader.biHeight = Height;
00746 
00747     DWORD DitherWord = Dither;
00748     TRACEUSER( "Andy?", _T("Convert32to1, Strip = %d, dither = %d\n"), FirstStrip, Dither);
00749 
00750     if (Dither == XARADITHER_SIMPLE || Dither == XARADITHER_ERROR_DIFFUSION)
00751     {
00752         // We are using some form of error diffusion ....
00753 
00754         // Set second byte to 255 if this is the First strip,
00755         // so that the error buffer is cleared
00756         DitherWord |= (( FirstStrip ? 0 : 255 ) << 8);
00757     }
00758 
00759     GDrawContext *GDC = GetConvertContext();
00760     const BOOL res = GDC->ConvertBitmap( &SourceHeader, Input, &DestHeader, Output, DitherWord );
00761     if (!res)
00762         TRACE( _T("GColour_ConvertBitmap did error %x\n"), GetLastError() );
00763 
00764     return TRUE;
00765 }


Member Data Documentation

BITMAPINFOHEADER Conv32to1::DestHeader [private]
 

Definition at line 193 of file dibconv.cpp.

LPLOGPALETTE Conv32to1::DestPalette [private]
 

Definition at line 194 of file dibconv.cpp.

UINT32 Conv32to1::Dither [private]
 

Definition at line 195 of file dibconv.cpp.

BITMAPINFOHEADER Conv32to1::SourceHeader [private]
 

Definition at line 192 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