00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: planybmp_8h-source.html,v 1.4 2004/09/15 15:26:26 uzadow Exp $ 00005 | 00006 | Copyright (c) 1996-2002 Ulrich von Zadow 00007 | 00008 \-------------------------------------------------------------------- 00009 */ 00010 00011 #ifndef INCL_PLANYBMP 00012 #define INCL_PLANYBMP 00013 00014 #ifndef INCL_PLBITMAP 00015 #include "plbitmap.h" 00016 #endif 00017 00018 //! Manipulates uncompressed device- and platform-independent bitmaps. 00019 //! Supported data formats are 1, 8, 16, 24 and 32 bpp. The data is stored 00020 //! sequentially without padding in the bitmap. The class implements exactly 00021 //! the interface defined by PLBmp without additions. 00022 class PLAnyBmp : public PLBmp 00023 { 00024 00025 public: 00026 //! Creates an empty bitmap. 00027 PLAnyBmp 00028 (); 00029 00030 //! Destroys the bitmap. 00031 virtual ~PLAnyBmp 00032 (); 00033 00034 //! Copy constructor 00035 PLAnyBmp 00036 ( const PLBmpBase &Orig 00037 ); 00038 00039 //! Copy constructor 00040 PLAnyBmp 00041 ( const PLAnyBmp &Orig 00042 ); 00043 00044 //! Assignment operator. 00045 PLAnyBmp &operator= 00046 ( const PLBmpBase &Orig 00047 ); 00048 00049 //! Assignment operator. 00050 PLAnyBmp &operator= 00051 ( const PLAnyBmp &Orig 00052 ); 00053 00054 // PLAnyBmp information 00055 00056 //! Returns the amount of memory used by the object. 00057 long GetMemUsed 00058 (); 00059 00060 //! Returns number of bytes used per line. 00061 long GetBytesPerLine 00062 (); 00063 00064 //! Returns a raw pointer to the bitmap bits. 00065 PLBYTE * GetPixels 00066 () 00067 { return m_pBits; } 00068 00069 //! Returns a raw pointer to the bitmap bits. 00070 const PLBYTE * GetPixels 00071 () const 00072 { return m_pBits; } 00073 00074 // Static functions 00075 00076 //! Returns memory needed by a bitmap with the specified attributes. 00077 static long GetMemNeeded 00078 ( PLLONG width, 00079 PLLONG height, 00080 PLWORD BitsPerPixel 00081 ); 00082 00083 //! Returns memory needed by bitmap bits. 00084 static long GetBitsMemNeeded 00085 ( PLLONG width, 00086 PLLONG height, 00087 PLWORD BitsPerPixel 00088 ); 00089 00090 00091 protected: 00092 // Local functions 00093 00094 // Create a new bitmap with uninitialized bits. Assumes no memory 00095 // is allocated yet. 00096 virtual void internalCreate 00097 ( PLLONG Width, 00098 PLLONG Height, 00099 const PLPixelFormat& pf 00100 ); 00101 00102 // Deletes memory allocated by member variables. 00103 virtual void freeMembers 00104 (); 00105 00106 // Initializes internal table of line addresses. 00107 virtual void initLineArray 00108 (); 00109 00110 PLBYTE * m_pBits; // Pointer to the bits. 00111 }; 00112 00113 // Note that _both_ these copy constructors are needed. If only the 00114 // second one is there, MSVC 6.0 generates a default copy 00115 // constructor anyway :-(. 00116 inline PLAnyBmp::PLAnyBmp 00117 ( const PLAnyBmp &Orig 00118 ) 00119 : PLBmp () 00120 { 00121 internalCopy (Orig); 00122 } 00123 00124 inline PLAnyBmp::PLAnyBmp 00125 ( const PLBmpBase &Orig 00126 ) 00127 : PLBmp () 00128 { 00129 internalCopy (Orig); 00130 } 00131 00132 inline PLAnyBmp & PLAnyBmp::operator= 00133 ( const PLBmpBase &Orig 00134 ) 00135 { 00136 PLBmp::operator=(Orig); 00137 return *this; 00138 } 00139 00140 inline PLAnyBmp & PLAnyBmp::operator= 00141 ( const PLAnyBmp &Orig 00142 ) 00143 { 00144 PLBmp::operator=(Orig); 00145 return *this; 00146 } 00147 00148 00149 #endif 00150 /* 00151 /-------------------------------------------------------------------- 00152 | 00153 | $Log: planybmp_8h-source.html,v $ 00153 | Revision 1.4 2004/09/15 15:26:26 uzadow 00153 | Linux compatibility changes, doc update. 00153 | 00154 | Revision 1.10 2004/09/09 16:52:49 artcom 00155 | refactored PixelFormat 00156 | 00157 | Revision 1.9 2004/06/19 15:39:45 uzadow 00158 | Bugfix 00159 | 00160 | Revision 1.8 2004/06/15 14:17:11 uzadow 00161 | First working version of PLSubBmp. 00162 | 00163 | Revision 1.7 2004/06/15 11:18:17 uzadow 00164 | First working version of PLBmpBase. 00165 | 00166 | Revision 1.6 2004/06/06 12:56:38 uzadow 00167 | Doxygenified documentation. 00168 | 00169 | Revision 1.5 2003/02/15 21:26:58 uzadow 00170 | Added win32 version of url data source. 00171 | 00172 | Revision 1.4 2002/08/04 20:08:01 uzadow 00173 | Added PLBmpInfo class, ability to extract metainformation from 00174 | images without loading the whole image and proper greyscale support. 00175 | 00176 | Revision 1.3 2002/02/24 13:00:17 uzadow 00177 | Documentation update; removed buggy PLFilterRotate. 00178 | 00179 | Revision 1.2 2001/10/06 22:03:26 uzadow 00180 | Added PL prefix to basic data types. 00181 | 00182 | Revision 1.1 2001/09/16 19:03:22 uzadow 00183 | Added global name prefix PL, changed most filenames. 00184 | 00185 | Revision 1.10 2001/01/15 15:05:31 uzadow 00186 | Added PLBmp::ApplyFilter() and PLBmp::CreateFilteredCopy() 00187 | 00188 | Revision 1.9 2000/11/02 21:28:47 uzadow 00189 | Fixed copy constructors. 00190 | 00191 | Revision 1.8 2000/08/13 12:11:43 Administrator 00192 | Added experimental DirectDraw-Support 00193 | 00194 | Revision 1.7 2000/01/16 20:43:12 anonymous 00195 | Removed MFC dependencies 00196 | 00197 | Revision 1.6 1999/12/14 12:30:13 Ulrich von Zadow 00198 | Corrected copy constructor and assignment operator. 00199 | 00200 | Revision 1.5 1999/12/10 01:27:26 Ulrich von Zadow 00201 | Added assignment operator and copy constructor to 00202 | bitmap classes. 00203 | 00204 | Revision 1.4 1999/12/02 17:07:34 Ulrich von Zadow 00205 | Changes by bdelmee. 00206 | 00207 \-------------------------------------------------------------------- 00208 */