/////////////////////////////////////////////////////////////////////////////
// DibCls.h
/////////////////////////////////////////////////////////////////////////////
// Copyright 1995 - 1998 Microsoft Corporation. All Rights Reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
/////////////////////////////////////////////////////////////////////////////
//
// contains the prototypes for the CDibFIle and CDibSection classes
//
#ifndef __DIBCLASSES_H
#define __DIBCLASSES_H
//
//class CDibFile
//
class CDibFile
{
public:
CDibFile();
~CDibFile();
HRESULTGetFileHeader(IStream *);
HRESULTGetInfoHeader(IStream *);
DWORDHeaderSize(){ return(m_headerSize); }
DWORDCalcImageSize();
operator BITMAPINFO * (){ return(m_bmi.p); }
operator BITMAPINFOHEADER * (){ return(&m_bmi.p->bmiHeader); }
private:
DWORDm_headerSize;
union
{
BITMAPINFO *p;
unsigned char *bytes;
} m_bmi;
};
class CDibSection
{
public:
CDibSection();
~CDibSection();
HRESULT Create( CDibFile& );
HRESULTSetup( HDC basedOnThisDC);
HRESULT ReadFrom( IStream * strm, DWORD amount );
HRESULTPaintTo( HDC hdc, int x = 0, int y = 0 );
HRESULTGetSize( SIZEL &sz);
DWORDImageSize() { return(m_imageSize); }
voidImageSize(DWORD dw) { m_imageSize = dw; }
operator HANDLE() { return m_handle; }
unsigned char * Base() { return(m_bitsBase); }
private:
unsigned char *m_bitsBase;
unsigned char *m_current;
HDCm_memDC;
HBITMAPm_handle;
HBITMAPm_oldBitmap;
LONGm_h;
LONGm_w;
DWORDm_imageSize;
};
#endif __DIBCLASSES_H