1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>paintlib: plbitmap.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Compound Members</a></div>
<h1>plbitmap.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment">/--------------------------------------------------------------------</span>
00003 <span class="comment">|</span>
00004 <span class="comment">| $Id: plbitmap_8h-source.html,v 1.4 2004/09/15 15:26:26 uzadow Exp $</span>
00005 <span class="comment">|</span>
00006 <span class="comment">| Copyright (c) 1996-2002 Ulrich von Zadow</span>
00007 <span class="comment">|</span>
00008 <span class="comment">\--------------------------------------------------------------------</span>
00009 <span class="comment">*/</span>
00010
00011 <span class="preprocessor">#ifndef INCL_PLBITMAP</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#define INCL_PLBITMAP</span>
00013 <span class="preprocessor"></span>
00014 <span class="preprocessor">#include "plbmpbase.h"</span>
00015 <span class="preprocessor">#include "plpoint.h"</span>
00016 <span class="preprocessor">#include "pldebug.h"</span>
00017 <span class="preprocessor">#include "plpixel32.h"</span>
00018 <span class="preprocessor">#include "plpixel24.h"</span>
00019 <span class="preprocessor">#include "plpixel16.h"</span>
00020
00021 <span class="keyword">class </span><a class="code" href="classPLFilter.html">PLFilter</a>;
00022 <span class="comment"></span>
00023 <span class="comment">//! Device- and OS-independent bitmap class. Manipulates uncompressed</span>
00024 <span class="comment">//! bitmaps of all color depths.</span>
00025 <span class="comment">//!</span>
00026 <span class="comment">//! This class is an abstract base class. It exists to define a</span>
00027 <span class="comment">//! format-independent interface for bitmap manipulation and to</span>
00028 <span class="comment">//! provide common routines. Derived classes must support at least</span>
00029 <span class="comment">//! the color depths 1, 8 and 32 bpp. PLBmp defines a public interface</span>
00030 <span class="comment">//! for general use and a protected interface for use by derived</span>
00031 <span class="comment">//! classes.</span>
00032 <span class="comment">//!</span>
00033 <span class="comment">//! For 32 bpp, alpha channel information is stored in one byte</span>
00034 <span class="comment">//! (PL_RGBA_ALPHA) of each 4-byte pixel. To allow for optimizations</span>
00035 <span class="comment">//! when no alpha channel is present, a flag is set whenever the</span>
00036 <span class="comment">//! alpha information is valid. The complete alpha channel of a</span>
00037 <span class="comment">//! bitmap can be replaced by a different one by calling</span>
00038 <span class="comment">//! SetAlphaChannel(). A 0 in an alpha channel entry is completely</span>
00039 <span class="comment">//! transparent; a 255 is completely opaque.</span>
<a name="l00040"></a><a class="code" href="classPLBmp.html">00040</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classPLBmp.html">PLBmp</a> : <span class="keyword">public</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a>
00041 {
00042
00043 <span class="keyword">public</span>:
00044 <span class="comment"></span>
00045 <span class="comment"> //! Empty constructor. Constructors in derived classes create a</span>
00046 <span class="comment"> //! small empty bitmap to ensure that the object is always in a</span>
00047 <span class="comment"> //! sane state.</span>
00048 <span class="comment"></span> <a class="code" href="classPLBmp.html">PLBmp</a>
00049 ();
00050 <span class="comment"></span>
00051 <span class="comment"> //! Empty destructor.</span>
00052 <span class="comment"></span> <span class="keyword">virtual</span> ~<a class="code" href="classPLBmp.html">PLBmp</a>
00053 ();
00054 <span class="comment"></span>
00055 <span class="comment"> //! Assignment operator. Note that assignment between different derived</span>
00056 <span class="comment"> //! classes is possible and results in a format conversion.</span>
00057 <span class="comment"></span> <a class="code" href="classPLBmp.html">PLBmp</a> &<span class="keyword">operator</span>=
00058 ( <a class="code" href="classPLBmpBase.html">PLBmpBase</a> <span class="keyword">const</span> &Orig
00059 );
00060
00061 <a class="code" href="classPLBmp.html">PLBmp</a> &<span class="keyword">operator</span>=
00062 ( <a class="code" href="classPLBmp.html">PLBmp</a> <span class="keyword">const</span> &Orig
00063 );
00064
00065 <span class="comment">// PLBmp creation</span>
00066 <span class="comment"></span>
00067 <span class="comment"> //! Creates a new empty bitmap. Memory for the bits is allocated</span>
00068 <span class="comment"> //! but not initialized. Previous contents of the bitmap object are</span>
00069 <span class="comment"> //! discarded. If bAlphaChannel is true, the bitmap is assumed to</span>
00070 <span class="comment"> //! contain a valid alpha channel. If pBits is non-null, it contains</span>
00071 <span class="comment"> //! pixel data in the format expected by the bitmap and Stride is the</span>
00072 <span class="comment"> //! distance in bytes from one source line to the next. In this case, </span>
00073 <span class="comment"> //! the data in pBits is copied into the internal buffer of the PLBmp.</span>
00074 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#a4">Create</a>
00075 ( PLLONG Width,
00076 PLLONG Height,
00077 <span class="keyword">const</span> PLPixelFormat& pf,
00078 PLBYTE * pBits = 0,
00079 <span class="keywordtype">int</span> Stride = 0,
00080 <span class="keyword">const</span> <a class="code" href="classPLPoint.html">PLPoint</a>& Resolution = <a class="code" href="classPLPoint.html">PLPoint</a> (0,0)
00081 );
00082 <span class="comment"></span>
00083 <span class="comment"> //! Creates a new empty bitmap. Info contains the metadata (width, height, </span>
00084 <span class="comment"> //! etc.) to be used in creation.</span>
00085 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#a4">Create</a>
00086 ( <span class="keyword">const</span> <a class="code" href="classPLBmpInfo.html">PLBmpInfo</a>& Info
00087 );
00088 <span class="comment"></span>
00089 <span class="comment"> //! Creates a copy of rSrcBmp, converting color depth if nessesary.</span>
00090 <span class="comment"> //! Supports 1, 8, 16, 24 and 32 BPP. Alpha channel information is preserved if</span>
00091 <span class="comment"> //! supported by the target bit depth. Conversion to 8 bpp is possible only</span>
00092 <span class="comment"> //! from 1 and 32 bpp.</span>
00093 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#a6">CreateCopy</a>
00094 ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> & rSrcBmp,
00095 <span class="keyword">const</span> PLPixelFormat& pfWanted = PLPixelFormat::DONTCARE
00096 );
00097 <span class="comment"></span>
00098 <span class="comment"> //! Creates a copy of rSrcBmp, applying rFilter on the way. Depending</span>
00099 <span class="comment"> //! on the filter called, this is often much faster than CreateCopy()</span>
00100 <span class="comment"> //! followed by ApplyFilter().</span>
00101 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#a7">CreateFilteredCopy</a> (<a class="code" href="classPLBmpBase.html">PLBmpBase</a> & rSrcBmp, <span class="keyword">const</span> <a class="code" href="classPLFilter.html">PLFilter</a> & rFilter);
00102
00103 <span class="comment">// PLBmp information</span>
00104 <span class="comment"></span>
00105 <span class="comment"> //! Returns memory used by a bitmap</span>
00106 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classPLBmp.html#a8">GetMemUsed</a>
00107 () = 0;
00108 <span class="comment"></span>
00109 <span class="comment"> //! Returns number of bytes used per line. Note that this is not the </span>
00110 <span class="comment"> //! stride of the bitmap.</span>
00111 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classPLBmp.html#a9">GetBytesPerLine</a>
00112 () = 0;
00113
00114 <span class="comment">// PLBmp manipulation</span>
00115 <span class="comment"></span>
00116 <span class="comment"> //! Applies a filter to the bitmap.</span>
00117 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#a10">ApplyFilter</a>
00118 ( <span class="keyword">const</span> <a class="code" href="classPLFilter.html">PLFilter</a>& Filter
00119 );
00120
00121
00122 <span class="keyword">protected</span>:<span class="comment"></span>
00123 <span class="comment"> //! Can be called from internalCreate() to initialize object state.</span>
00124 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#b0">initLocals</a>
00125 ( PLLONG Width,
00126 PLLONG Height,
00127 <span class="keyword">const</span> PLPixelFormat& pf
00128 );
00129 <span class="comment"></span>
00130 <span class="comment"> //! Create a new bitmap with uninitialized bits. (Assume no memory</span>
00131 <span class="comment"> //! is allocated yet.)</span>
00132 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#b1">internalCreate</a>
00133 ( PLLONG Width,
00134 PLLONG Height,
00135 <span class="keyword">const</span> PLPixelFormat& pf
00136 ) = 0;
00137 <span class="comment"></span>
00138 <span class="comment"> //! Initialize internal table of line addresses.</span>
00139 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#b2">initLineArray</a>
00140 () = 0;
00141 <span class="comment"></span>
00142 <span class="comment"> //! Delete memory allocated by member variables.</span>
00143 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#b3">freeMembers</a>
00144 () = 0;
00145 <span class="comment"></span>
00146 <span class="comment"> //! Creates a new PLBmp as copy of rSrcBmp. Assumes there is no memory</span>
00147 <span class="comment"> //! allocated yet.</span>
00148 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classPLBmp.html#b4">internalCopy</a>
00149 ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> & rSrcBmp
00150 );
00151
00152 };
00153
00154 <span class="keyword">inline</span> <a class="code" href="classPLBmp.html">PLBmp</a> & PLBmp::operator=
<a name="l00155"></a><a class="code" href="classPLBmp.html#a2">00155</a> ( <a class="code" href="classPLBmpBase.html">PLBmpBase</a> <span class="keyword">const</span> &Orig
00156 )
00157 {
00158 <span class="keywordflow">if</span> (<span class="keyword">this</span> != &Orig)
00159 CreateCopy(Orig);
00160 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00161 }
00162
00163 <span class="keyword">inline</span> <a class="code" href="classPLBmp.html">PLBmp</a> & PLBmp::operator=
00164 ( <a class="code" href="classPLBmp.html">PLBmp</a> <span class="keyword">const</span> &Orig
00165 )
00166 {
00167 <span class="keywordflow">if</span> (<span class="keyword">this</span> != &Orig)
00168 CreateCopy(Orig);
00169 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00170 }
00171
00172 <span class="preprocessor">#endif</span>
00173 <span class="preprocessor"></span><span class="comment">/*</span>
00174 <span class="comment">/--------------------------------------------------------------------</span>
00175 <span class="comment">|</span>
00176 <span class="comment">| $Log: plbitmap_8h-source.html,v $
00176 <span class="comment">| Revision 1.4 2004/09/15 15:26:26 uzadow
00176 <span class="comment">| Linux compatibility changes, doc update.
00176 <span class="comment">|</span>
00177 <span class="comment">| Revision 1.22 2004/09/11 10:30:40 uzadow</span>
00178 <span class="comment">| Linux build fixes, automake dependency fixes.</span>
00179 <span class="comment">|</span>
00180 <span class="comment">| Revision 1.21 2004/09/09 16:52:49 artcom</span>
00181 <span class="comment">| refactored PixelFormat</span>
00182 <span class="comment">|</span>
00183 <span class="comment">| Revision 1.20 2004/06/20 16:59:34 uzadow</span>
00184 <span class="comment">| Added PLBmpBase::CopyPixels() and PLInPlaceFilter</span>
00185 <span class="comment">|</span>
00186 <span class="comment">| Revision 1.19 2004/06/19 17:04:22 uzadow</span>
00187 <span class="comment">| Removed Lock(), Unlock(), PLDDrawBmp</span>
00188 <span class="comment">|</span>
00189 <span class="comment">| Revision 1.18 2004/06/19 16:49:07 uzadow</span>
00190 <span class="comment">| Changed GetImage so it works with PLBmpBase</span>
00191 <span class="comment">|</span>
00192 <span class="comment">| Revision 1.17 2004/06/15 14:17:11 uzadow</span>
00193 <span class="comment">| First working version of PLSubBmp.</span>
00194 <span class="comment">|</span>
00195 <span class="comment">| Revision 1.16 2004/06/15 11:18:17 uzadow</span>
00196 <span class="comment">| First working version of PLBmpBase.</span>
00197 <span class="comment">|</span>
00198 <span class="comment">| Revision 1.15 2004/06/15 10:26:05 uzadow</span>
00199 <span class="comment">| Initial nonfunctioning version of plbmpbase.</span>
00200 <span class="comment">|</span>
00201 <span class="comment">| Revision 1.14 2004/06/10 16:05:28 artcom</span>
00202 <span class="comment">| Doc update</span>
00203 <span class="comment">|</span>
00204 <span class="comment">| Revision 1.13 2004/06/09 21:34:53 uzadow</span>
00205 <span class="comment">| Added 16 bpp support to plbitmap, planybmp and pldirectfbbmp</span>
00206 <span class="comment">|</span>
00207 <span class="comment">| Revision 1.12 2004/06/06 12:56:38 uzadow</span>
00208 <span class="comment">| Doxygenified documentation.</span>
00209 <span class="comment">|</span>
00210 <span class="comment">| Revision 1.11 2003/11/05 15:17:23 artcom</span>
00211 <span class="comment">| Added ability to specify initial data in PLBitmap::Create()</span>
00212 <span class="comment">|</span>
00213 <span class="comment">| Revision 1.10 2003/07/29 21:27:41 uzadow</span>
00214 <span class="comment">| Fixed PLDirectFBBmp::GetBytesPerLine(), im2* Makefiles</span>
00215 <span class="comment">|</span>
00216 <span class="comment">| Revision 1.9 2003/02/15 21:26:58 uzadow</span>
00217 <span class="comment">| Added win32 version of url data source.</span>
00218 <span class="comment">|</span>
00219 <span class="comment">| Revision 1.8 2002/08/04 20:08:01 uzadow</span>
00220 <span class="comment">| Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.</span>
00221 <span class="comment">|</span>
00222 <span class="comment">| Revision 1.7 2002/03/31 13:36:41 uzadow</span>
00223 <span class="comment">| Updated copyright.</span>
00224 <span class="comment">|</span>
00225 <span class="comment">| Revision 1.6 2001/10/21 17:12:39 uzadow</span>
00226 <span class="comment">| Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel.</span>
00227 <span class="comment">|</span>
00228 <span class="comment">| Revision 1.5 2001/10/16 17:12:26 uzadow</span>
00229 <span class="comment">| Added support for resolution information (Luca Piergentili)</span>
00230 <span class="comment">|</span>
00231 <span class="comment">| Revision 1.4 2001/10/06 22:37:08 uzadow</span>
00232 <span class="comment">| Linux compatibility.</span>
00233 <span class="comment">|</span>
00234 <span class="comment">| Revision 1.3 2001/10/06 22:03:26 uzadow</span>
00235 <span class="comment">| Added PL prefix to basic data types.</span>
00236 <span class="comment">|</span>
00237 <span class="comment">| Revision 1.2 2001/09/28 19:50:56 uzadow</span>
00238 <span class="comment">| Added some 24 bpp stuff & other minor features.</span>
00239 <span class="comment">|</span>
00240 <span class="comment">| Revision 1.1 2001/09/16 19:03:22 uzadow</span>
00241 <span class="comment">| Added global name prefix PL, changed most filenames.</span>
00242 <span class="comment">|</span>
00243 <span class="comment">| Revision 1.26 2001/09/15 14:30:20 uzadow</span>
00244 <span class="comment">| Fixed PLPixel32 initialization bug.</span>
00245 <span class="comment">|</span>
00246 <span class="comment">| Revision 1.25 2001/09/13 20:47:36 uzadow</span>
00247 <span class="comment">| Removed commented-out lines.</span>
00248 <span class="comment">|</span>
00249 <span class="comment">| Revision 1.24 2001/01/15 15:05:31 uzadow</span>
00250 <span class="comment">| Added PLBmp::ApplyFilter() and PLBmp::CreateFilteredCopy()</span>
00251 <span class="comment">|</span>
00252 <span class="comment">| Revision 1.23 2000/12/18 22:42:52 uzadow</span>
00253 <span class="comment">| Replaced RGBAPIXEL with PLPixel32.</span>
00254 <span class="comment">|</span>
00255 <span class="comment">| Revision 1.22 2000/11/21 20:18:03 uzadow</span>
00256 <span class="comment">| Added operator ==</span>
00257 <span class="comment">|</span>
00258 <span class="comment">| Revision 1.21 2000/11/07 15:40:46 jmbuena</span>
00259 <span class="comment">| Changes related to paintlibdefs.h and pixeldefs.h</span>
00260 <span class="comment">|</span>
00261 <span class="comment">| Revision 1.20 2000/11/02 21:28:47 uzadow</span>
00262 <span class="comment">| Fixed copy constructors.</span>
00263 <span class="comment">|</span>
00264 <span class="comment">| Revision 1.19 2000/10/24 16:46:34 uzadow</span>
00265 <span class="comment">| Fixed build problems</span>
00266 <span class="comment">|</span>
00267 <span class="comment">| Revision 1.18 2000/10/23 17:45:03 jmbuena</span>
00268 <span class="comment">| Linux compatibility changes</span>
00269 <span class="comment">|</span>
00270 <span class="comment">| Revision 1.17 2000/09/26 14:28:47 Administrator</span>
00271 <span class="comment">| Added Threshold filter</span>
00272 <span class="comment">|</span>
00273 <span class="comment">| Revision 1.16 2000/09/26 12:14:51 Administrator</span>
00274 <span class="comment">| Refactored quantization.</span>
00275 <span class="comment">|</span>
00276 <span class="comment">| Revision 1.15 2000/08/13 12:11:43 Administrator</span>
00277 <span class="comment">| Added experimental DirectDraw-Support</span>
00278 <span class="comment">|</span>
00279 <span class="comment">| Revision 1.14 2000/07/11 17:11:00 Ulrich von Zadow</span>
00280 <span class="comment">| Added support for RGBA pixel ordering (Jose Miguel Buenaposada Biencinto).</span>
00281 <span class="comment">|</span>
00282 <span class="comment">| Revision 1.13 2000/03/31 12:20:05 Ulrich von Zadow</span>
00283 <span class="comment">| Video invert filter (beta)</span>
00284 <span class="comment">|</span>
00285 <span class="comment">| Revision 1.12 2000/03/31 11:53:30 Ulrich von Zadow</span>
00286 <span class="comment">| Added quantization support.</span>
00287 <span class="comment">|</span>
00288 <span class="comment">| Revision 1.11 2000/01/16 20:43:12 anonymous</span>
00289 <span class="comment">| Removed MFC dependencies</span>
00290 <span class="comment">|</span>
00291 <span class="comment">| Revision 1.10 1999/12/10 01:27:26 Ulrich von Zadow</span>
00292 <span class="comment">| Added assignment operator and copy constructor to</span>
00293 <span class="comment">| bitmap classes.</span>
00294 <span class="comment">|</span>
00295 <span class="comment">| Revision 1.9 1999/12/09 16:35:22 Ulrich von Zadow</span>
00296 <span class="comment">| no message</span>
00297 <span class="comment">|</span>
00298 <span class="comment">| Revision 1.8 1999/12/08 15:39:45 Ulrich von Zadow</span>
00299 <span class="comment">| Unix compatibility changes</span>
00300 <span class="comment">|</span>
00301 <span class="comment">| Revision 1.7 1999/12/02 17:07:34 Ulrich von Zadow</span>
00302 <span class="comment">| Changes by bdelmee.</span>
00303 <span class="comment">|</span>
00304 <span class="comment">| Revision 1.6 1999/10/22 21:25:51 Ulrich von Zadow</span>
00305 <span class="comment">| Removed buggy octree quantization</span>
00306 <span class="comment">|</span>
00307 <span class="comment">\--------------------------------------------------------------------</span>
00308 <span class="comment">*/</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Sep 13 16:16:40 2004 for paintlib by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.2 </small></address>
</body>
</html>
|