home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / IKLOWNS / INCLUDE / CGDIB.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  2KB  |  70 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        cgdib.h
  4. |
  5. |  Description: 
  6. |       contains class definitions for handling DIBs
  7. |       
  8. |-----------------------------------------------------------------------------
  9. |
  10. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  11. |
  12. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  13. |
  14. \*===========================================================================*/
  15.  
  16. #ifndef CGDIB_H
  17. #define CGDIB_H
  18.  
  19. #include <windows.h>
  20.  
  21. // CGameDIB is class for handling DIBs in Manhattan games
  22. class CGameDIB
  23. {
  24. public:
  25.     CGameDIB();         // create empty, invalid object (used by derived classes)
  26.     CGameDIB( char* pFileName );    // constructor - create image from file
  27.  
  28.     // construct a new DIB section in memory of given size, palette
  29.     CGameDIB( int width, int height, HPALETTE hPal = NULL );
  30.  
  31.     virtual ~CGameDIB();                      // destructor
  32.  
  33.     virtual LPBITMAPINFO GetBitmapInfo(){return mpBitmapInfo;}
  34.     virtual LPBYTE GetBits(){return mpBits;}
  35.  
  36.     virtual HPALETTE CreatePalette();
  37.     virtual HBITMAP GetHBitmap(){return mhBitmap;}
  38.  
  39.     virtual LPBYTE GetPixelAddress(int x, int y);
  40.     virtual COLORREF GetPixelColor(int x, int y);
  41.  
  42.     virtual UINT GetColorTable(UINT, UINT, RGBQUAD*);
  43.  
  44.     virtual int GetWidth();
  45.     virtual int GetHeight();
  46.  
  47.     virtual int BytesPerScanline()
  48.     {
  49.         return (GetWidth() + 3) & ~3;
  50.     }
  51.  
  52.     virtual const char* GetNamePtr()
  53.     {
  54.         return (const char*) mpFileName;
  55.     }
  56.  
  57. protected:
  58.  
  59.     BOOL mImageValid;       // flag whether image is valid
  60.  
  61.     LPBITMAPINFO mpBitmapInfo;
  62.     LPBYTE mpBits;
  63.     HBITMAP mhBitmap;       // handle to our DIB section
  64.     char* mpFileName;
  65.  
  66.     void OpenDIB(char* pFileName);
  67. };
  68.  
  69. #endif // CGDIB_H
  70.