00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: planybmp.h,v 1.5 2003/02/15 21:26:58 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, 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 PLBmp &Orig 00037 ); 00038 00039 //! Copy constructor 00040 PLAnyBmp 00041 ( const PLAnyBmp &Orig 00042 ); 00043 00044 //! Assignment operator. 00045 PLAnyBmp &operator= 00046 ( const PLBmp &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 PLWORD BitsPerPixel, 00100 bool bAlphaChannel, 00101 bool bIsGreyscale 00102 ); 00103 00104 // Deletes memory allocated by member variables. 00105 virtual void freeMembers 00106 (); 00107 00108 // Initializes internal table of line addresses. 00109 virtual void initLineArray 00110 (); 00111 00112 PLBYTE * m_pBits; // Pointer to the bits. 00113 }; 00114 00115 // Note that _both_ these copy constructors are needed. If only the 00116 // second one is there, MSVC 6.0 generates a default copy 00117 // constructor anyway :-(. 00118 inline PLAnyBmp::PLAnyBmp 00119 ( const PLAnyBmp &Orig 00120 ) 00121 : PLBmp () 00122 { 00123 internalCopy (Orig); 00124 } 00125 00126 inline PLAnyBmp::PLAnyBmp 00127 ( const PLBmp &Orig 00128 ) 00129 : PLBmp () 00130 { 00131 internalCopy (Orig); 00132 } 00133 00134 inline PLAnyBmp & PLAnyBmp::operator= 00135 ( const PLBmp &Orig 00136 ) 00137 { 00138 PLBmp::operator=(Orig); 00139 return *this; 00140 } 00141 00142 inline PLAnyBmp & PLAnyBmp::operator= 00143 ( const PLAnyBmp &Orig 00144 ) 00145 { 00146 PLBmp::operator=(Orig); 00147 return *this; 00148 } 00149 00150 00151 #endif 00152 /* 00153 /-------------------------------------------------------------------- 00154 | 00155 | $Log: planybmp.h,v $ 00156 | Revision 1.5 2003/02/15 21:26:58 uzadow 00157 | Added win32 version of url data source. 00158 | 00159 | Revision 1.4 2002/08/04 20:08:01 uzadow 00160 | Added PLBmpInfo class, ability to extract metainformation from 00161 | images without loading the whole image and proper greyscale support. 00162 | 00163 | Revision 1.3 2002/02/24 13:00:17 uzadow 00164 | Documentation update; removed buggy PLFilterRotate. 00165 | 00166 | Revision 1.2 2001/10/06 22:03:26 uzadow 00167 | Added PL prefix to basic data types. 00168 | 00169 | Revision 1.1 2001/09/16 19:03:22 uzadow 00170 | Added global name prefix PL, changed most filenames. 00171 | 00172 | Revision 1.10 2001/01/15 15:05:31 uzadow 00173 | Added PLBmp::ApplyFilter() and PLBmp::CreateFilteredCopy() 00174 | 00175 | Revision 1.9 2000/11/02 21:28:47 uzadow 00176 | Fixed copy constructors. 00177 | 00178 | Revision 1.8 2000/08/13 12:11:43 Administrator 00179 | Added experimental DirectDraw-Support 00180 | 00181 | Revision 1.7 2000/01/16 20:43:12 anonymous 00182 | Removed MFC dependencies 00183 | 00184 | Revision 1.6 1999/12/14 12:30:13 Ulrich von Zadow 00185 | Corrected copy constructor and assignment operator. 00186 | 00187 | Revision 1.5 1999/12/10 01:27:26 Ulrich von Zadow 00188 | Added assignment operator and copy constructor to 00189 | bitmap classes. 00190 | 00191 | Revision 1.4 1999/12/02 17:07:34 Ulrich von Zadow 00192 | Changes by bdelmee. 00193 | 00194 \-------------------------------------------------------------------- 00195 */