home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / dlldemo.pak / BITMAP.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  1KB  |  43 lines

  1. // Borland C++ - (C) Copyright 1991, 1992 by Borland International
  2.  
  3. #ifndef __BITMAP_H
  4. #define __BITMAP_H
  5.  
  6. #include <windows.h>
  7.  
  8. // Interface to simple library of classes to use for Windows GDI.
  9.  
  10. class _EXPORT Bitmap
  11. {
  12.     private:
  13.         HANDLE hBitmap;
  14.         int GetBitmap( BITMAP FAR * lpbm )
  15.         {
  16.             return GetObject( hBitmap, sizeof( BITMAP ), (LPSTR) lpbm );
  17.         }
  18.     public:
  19.   Bitmap( HINSTANCE hInstance, char FAR * lpszBitmapName )
  20.         {
  21.             hBitmap = LoadBitmap( hInstance, lpszBitmapName );
  22.         }
  23.         ~Bitmap( void )
  24.         {
  25.             DeleteObject( hBitmap );
  26.         }
  27.         void FAR _export Display( HDC hDC, int xStart, int yStart );
  28.         // Get the size of the bitmap in logical coordinates.
  29.         POINT GetSize( HDC hDC )
  30.         {
  31.             BITMAP bm;
  32.             POINT ptSize;
  33.  
  34.             GetBitmap( &bm );
  35.             ptSize.x = bm.bmWidth;
  36.             ptSize.y = bm.bmHeight;
  37.             DPtoLP( hDC, &ptSize, 1 );
  38.             return ptSize;
  39.         }
  40. };
  41.  
  42. #endif  // __BITMAP_H
  43.