Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

WinBmpEx.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: WinBmpEx.h,v 1.3 2001/09/16 19:03:23 uzadow Exp $
00005 |            PaintLib windows DrawDib bitmap class implementation
00006 |
00007 |      See Paul DiLascia's excellent january and march ´97 MSJ
00008 |      articles. This version optionally draws using the 'video for
00009 |      windows' DrawDib API. This is supposedly faster, and offers
00010 |      dithering, too.
00011 |
00012 |      Copyright (c) 1998-2000 Bernard Delmée
00013 |
00014 \--------------------------------------------------------------------
00015 */
00016 
00017 #ifndef INCL_DRAWDIB
00018 #define INCL_DRAWDIB
00019 
00020 #if _MSC_VER >= 1000
00021 #pragma once
00022 #endif // _MSC_VER >= 1000
00023 
00024 
00025 #include "pldibsect.h"
00026 
00027 class PLWinBmpEx: public PLDIBSection
00028 {
00029 public:
00030     PLWinBmpEx();
00031     virtual ~PLWinBmpEx();
00032 
00033     //! Extended Draw function; can use DrawDib or not.
00034     //! Using any stretch-mode (but the default) forces GDI usage
00035     BOOL DrawEx(HDC dc, const RECT* rcDst=NULL, const RECT* rcSrc=NULL,
00036                 HPALETTE hPal=NULL, bool bForeground=true,
00037                 int StretchMode=-1, DWORD rop=SRCCOPY);
00038     
00039     //! Draws the bitmap with top left corner at specified location.
00040     virtual void Draw( HDC dc, int x, int y, DWORD rop = -1 );
00041 
00042     //! Draws the bitmap on the given device context.
00043     //! Scales the bitmap by Factor.
00044     virtual void StretchDraw (HDC hDC, int x, int y, 
00045         double Factor, DWORD rop = -1);
00046 
00047     //! Draws the bitmap on the given device context.
00048     //! Scales the bitmap so w is the width and h the height.
00049     virtual void StretchDraw (HDC hDC, int x, int y, 
00050         int w, int h, DWORD rop = -1);
00051     
00052     //! Draws a portion of the bitmap on the given device context
00053     virtual BOOL DrawExtract( HDC hDC, POINT pntDest, RECT rcSrc );
00054 
00055     //! Call this whenever recycling the bitmap
00056     void BuildLogPalette();
00057 
00058     //! Retrieve windows logical palette.
00059     HPALETTE GetLogPalette();
00060 
00061 private:
00062     HPALETTE m_pal;    // logical palette
00063 
00064     HPALETTE CreatePalette();
00065 
00066 // if we ever wanted to build without pulling in vfw 
00067 #ifndef _WITHOUT_VFW_
00068     HDRAWDIB m_hdd;    // for DrawDib API
00069 #endif
00070 };
00071 
00072 #endif // INCL_DRAWDIB
00073 
00074 /*
00075 /--------------------------------------------------------------------
00076 |
00077 |      $Log: WinBmpEx.h,v $
00078 |      Revision 1.3  2001/09/16 19:03:23  uzadow
00079 |      Added global name prefix PL, changed most filenames.
00080 |
00081 |      Revision 1.2  2000/03/30 21:47:41  Ulrich von Zadow
00082 |      Added zoom-in mode, PLWinBmpEx, conditional use of DrawDIB
00083 |      and some other nice stuff by Bernard Delmée.
00084 |
00085 |
00086 |
00087 \--------------------------------------------------------------------
00088 */

Generated on Sun Jun 6 13:42:22 2004 for paintlib by doxygen 1.3.2