00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plddrawbmp.h,v 1.3 2002/08/04 20:08:01 uzadow Exp $ 00005 | Bitmap class using a directdraw surface. 00006 | 00007 | Copyright (c) 1996-2002 Ulrich von Zadow 00008 | 00009 \-------------------------------------------------------------------- 00010 */ 00011 00012 #ifndef INCL_DDRAWBMP 00013 #define INCL_DDRAWBMP 00014 00015 #include "plbitmap.h" 00016 00017 #include <ddraw.h> 00018 00019 //! 00020 class PLDDrawBmp : public PLBmp 00021 { 00022 00023 public: 00024 //! Creates an empty bitmap. 00025 PLDDrawBmp 00026 ( IDirectDraw * pDDraw 00027 ); 00028 00029 //! Destroys the bitmap. 00030 virtual ~PLDDrawBmp 00031 (); 00032 00033 #ifdef _DEBUG 00034 virtual void AssertValid 00035 () const; // Tests internal object state 00036 #endif 00037 00038 // PLDDrawBmp information 00039 00040 //! Returns the amount of memory used by the object. 00041 virtual long GetMemUsed 00042 (); 00043 00044 //! Returns number of bytes used per line. 00045 long GetBytesPerLine 00046 (); 00047 00048 //! Returns the size of the bitmap in pixels 00049 SIZE GetSize 00050 (); 00051 00052 //! Draws the bitmap. 00053 // virtual void Blt 00054 // (); 00055 00056 //! Locks the DirectDraw surface and fills the line array. GetLineArray() 00057 //! returns NULL if the surface isn't locked. 00058 virtual void Lock 00059 ( bool bReadable, 00060 bool bWriteable 00061 ); 00062 00063 //! Unlocks the DirectDraw surface. 00064 virtual void Unlock 00065 (); 00066 00067 //! Gets a pointer to the directdraw surface used. 00068 IDirectDrawSurface * GetSurface 00069 (); 00070 00071 protected: 00072 00073 // Protected callbacks 00074 00075 //! Create a new empty DIB. Bits are uninitialized. 00076 //! Assumes that no memory is allocated before the call. 00077 virtual void internalCreate 00078 ( LONG Width, 00079 LONG Height, 00080 WORD BitsPerPixel, 00081 bool bAlphaChannel, 00082 bool bIsGreyscale 00083 ); 00084 00085 //! Deletes memory allocated by member variables. 00086 virtual void freeMembers 00087 (); 00088 00089 //! Initializes internal table of line addresses. 00090 virtual void initLineArray 00091 (); 00092 00093 // Set color table pointer & pointer to bits 00094 virtual void initPointers 00095 (); 00096 00097 private: 00098 00099 // Member variables. 00100 IDirectDrawSurface * m_pSurface; 00101 DDSURFACEDESC * m_pDDSurfaceDesc; 00102 IDirectDraw * m_pDDraw; 00103 }; 00104 00105 #endif 00106 /* 00107 /-------------------------------------------------------------------- 00108 | 00109 | $Log: plddrawbmp.h,v $ 00110 | Revision 1.3 2002/08/04 20:08:01 uzadow 00111 | Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support. 00112 | 00113 | Revision 1.2 2002/03/31 13:36:42 uzadow 00114 | Updated copyright. 00115 | 00116 | Revision 1.1 2001/09/16 19:03:23 uzadow 00117 | Added global name prefix PL, changed most filenames. 00118 | 00119 | Revision 1.1 2000/08/13 12:11:43 Administrator 00120 | Added experimental DirectDraw-Support 00121 | 00122 | 00123 \-------------------------------------------------------------------- 00124 */