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
|
<!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: pldibsect.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>pldibsect.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: pldibsect_8h-source.html,v 1.2 2004/09/15 15:26:29 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_DIBSECT</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#define INCL_DIBSECT</span>
00013 <span class="preprocessor"></span>
00014 <span class="preprocessor">#ifndef INCL_WINBMP</span>
00015 <span class="preprocessor"></span><span class="preprocessor">#include "plwinbmp.h"</span>
00016 <span class="preprocessor">#endif</span>
00017 <span class="preprocessor"></span><span class="comment"></span>
00018 <span class="comment">//! This is a windows DIBSection wrapped in a PLBmp-derived class.</span>
00019 <span class="comment">//! It can be used just like a PLWinBmp can be used. In addition,</span>
00020 <span class="comment">//! PLDIBSection can give access to the bitmap as a GDI bitmap handle.</span>
00021 <span class="comment">//! This bitmap handle can be selected into a device context. All</span>
00022 <span class="comment">//! normal GDI drawing functions can be used to write on the bitmap</span>
00023 <span class="comment">//! in this way.</span>
00024 <span class="comment">//!</span>
00025 <span class="comment">//! Internally, PLDIBSections are stored with header and bits in two</span>
00026 <span class="comment">//! separate buffers.</span>
<a name="l00027"></a><a class="code" href="classPLDIBSection.html">00027</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classPLDIBSection.html">PLDIBSection</a> : <span class="keyword">public</span> <a class="code" href="classPLWinBmp.html">PLWinBmp</a>
00028 {
00029
00030 <span class="keyword">public</span>:<span class="comment"></span>
00031 <span class="comment"> //! Creates an empty bitmap.</span>
00032 <span class="comment"></span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a>
00033 ();
00034 <span class="comment"></span>
00035 <span class="comment"> //! Destroys the bitmap.</span>
00036 <span class="comment"></span> <span class="keyword">virtual</span> ~<a class="code" href="classPLDIBSection.html">PLDIBSection</a>
00037 ();
00038 <span class="comment"></span>
00039 <span class="comment"> //! Copy constructor</span>
00040 <span class="comment"></span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a>
00041 ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &Orig
00042 );
00043 <span class="comment"></span>
00044 <span class="comment"> //! Copy constructor</span>
00045 <span class="comment"></span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a>
00046 ( <span class="keyword">const</span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> &Orig
00047 );
00048 <span class="comment"></span>
00049 <span class="comment"> //! Assignment operator.</span>
00050 <span class="comment"></span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> &<span class="keyword">operator</span>=
00051 ( <a class="code" href="classPLBmpBase.html">PLBmpBase</a> <span class="keyword">const</span> &Orig
00052 );
00053 <span class="comment"></span>
00054 <span class="comment"> //! Assignment operator.</span>
00055 <span class="comment"></span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> &<span class="keyword">operator</span>=
00056 ( <a class="code" href="classPLDIBSection.html">PLDIBSection</a> <span class="keyword">const</span> &Orig
00057 );
00058
00059 <span class="preprocessor">#ifdef _DEBUG</span>
00060 <span class="preprocessor"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> AssertValid
00061 () <span class="keyword">const</span>; <span class="comment">// Tests internal object state</span>
00062 <span class="preprocessor">#endif</span>
00063 <span class="preprocessor"></span><span class="comment"></span>
00064 <span class="comment"> //! Calling this function causes the windows DIBSection to be detached</span>
00065 <span class="comment"> //! from the PLDIBSection object. The bitmap data are not deleted in</span>
00066 <span class="comment"> //! this function. This means that the bitmap handle and</span>
00067 <span class="comment"> //! the bitmap memory (bits and BMI) must be deleted by some other object.</span>
00068 <span class="comment"> //! The PLDIBSection object is in the same state as after a constructor</span>
00069 <span class="comment"> //! call after this function is called.</span>
00070 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#a6">Detach</a>
00071 ();
00072
00073 <span class="comment">// PLDIBSection output</span>
00074 <span class="comment"></span>
00075 <span class="comment"> //! Draws the bitmap on the given device context using</span>
00076 <span class="comment"> //! BitBlt.</span>
00077 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#a7">Draw</a>
00078 ( HDC hDC,
00079 <span class="keywordtype">int</span> x,
00080 <span class="keywordtype">int</span> y,
00081 DWORD rop = SRCCOPY
00082 );
00083 <span class="comment"></span>
00084 <span class="comment"> //! Draws a portion of the bitmap on the given device context</span>
00085 <span class="comment"></span> <span class="keyword">virtual</span> BOOL <a class="code" href="classPLDIBSection.html#a8">DrawExtract</a>
00086 ( HDC hDC,
00087 POINT pntDest,
00088 RECT rcSrc
00089 );
00090
00091 <span class="comment">// PLDIBSection member access</span>
00092 <span class="comment"></span>
00093 <span class="comment"> //! Returns a GDI handle to the bitmap. This handle can be selected</span>
00094 <span class="comment"> //! into a DC and used in normal GDI operations.</span>
00095 <span class="comment"> //! Under Windows NT, GDI operations can be queued. This means that</span>
00096 <span class="comment"> //! a program running under NT must call GdiFlush() before the</span>
00097 <span class="comment"> //! DIBSection can be used again after GetHandle() has been called.</span>
00098 <span class="comment"> //! See the documentation for GdiFlush() for details.</span>
00099 <span class="comment"></span> HBITMAP <a class="code" href="classPLDIBSection.html#a9">GetHandle</a>
00100 ();
00101
00102
00103 <span class="keyword">protected</span>:
00104
00105 <span class="comment">// Protected callbacks</span>
00106 <span class="comment"></span>
00107 <span class="comment"> //! Create a new empty DIB. Bits are uninitialized.</span>
00108 <span class="comment"> //! Assumes that no memory is allocated before the call.</span>
00109 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#b0">internalCreate</a>
00110 ( LONG Width,
00111 LONG Height,
00112 <span class="keyword">const</span> PLPixelFormat& pf
00113 );
00114
00115 <span class="comment">// Creates a PLDIBSection from an existing bitmap pointer.</span>
00116 <span class="comment">// Assumes that no memory is allocated before the call.</span>
00117 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#b0">internalCreate</a>
00118 ( BITMAPINFOHEADER* pBMI
00119 );
00120 <span class="comment"></span>
00121 <span class="comment"> //! Deletes memory allocated by member variables.</span>
00122 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#b2">freeMembers</a>
00123 ();
00124 <span class="comment"></span>
00125 <span class="comment"> //! Creates a copy of the current bitmap in a global memory block</span>
00126 <span class="comment"> //! and returns a handle to this block.</span>
00127 <span class="comment"></span> <span class="keyword">virtual</span> HANDLE <a class="code" href="classPLDIBSection.html#b3">createCopyHandle</a>
00128 ();
00129 <span class="comment"></span>
00130 <span class="comment"> //! Set color table pointer & pointer to bits based on m_pBMI.</span>
00131 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLDIBSection.html#b4">initPointers</a>
00132 ();
00133
00134
00135 <span class="keyword">private</span>:
00136 <span class="comment">// Local functions</span>
00137
00138 <span class="comment">// Member variables.</span>
00139 HBITMAP m_hBitmap;
00140
00141 <span class="keywordtype">bool</span> m_bOwnsBitmap;
00142 };
00143
00144 <span class="comment">// Note that _both_ these copy constructors are needed. If only the </span>
00145 <span class="comment">// second one is there, the compiler generates a default copy </span>
00146 <span class="comment">// constructor anyway :-(.</span>
00147 <span class="keyword">inline</span> <a class="code" href="classPLDIBSection.html#a0">PLDIBSection::PLDIBSection</a>
<a name="l00148"></a><a class="code" href="classPLDIBSection.html#a3">00148</a> ( <span class="keyword">const</span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> &Orig
00149 )
00150 {
00151 <span class="comment">// Delete everything the base class allocated.</span>
00152 free(m_pBMI);
00153 m_pBMI = NULL;
00154
00155 <span class="keyword">delete</span> [] m_pLineArray;
00156 m_pLineArray = NULL;
00157
00158 internalCopy (Orig);
00159 }
00160
00161 <span class="keyword">inline</span> <a class="code" href="classPLDIBSection.html#a0">PLDIBSection::PLDIBSection</a>
<a name="l00162"></a><a class="code" href="classPLDIBSection.html#a2">00162</a> ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &Orig
00163 )
00164 {
00165 <span class="comment">// Delete everything the base class allocated.</span>
00166 free(m_pBMI);
00167 m_pBMI = NULL;
00168
00169 <span class="keyword">delete</span> [] m_pLineArray;
00170 m_pLineArray = NULL;
00171
00172 internalCopy (Orig);
00173 }
00174
00175
00176 <span class="keyword">inline</span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> & PLDIBSection::operator=
<a name="l00177"></a><a class="code" href="classPLDIBSection.html#a4">00177</a> ( <a class="code" href="classPLBmpBase.html">PLBmpBase</a> <span class="keyword">const</span> &Orig
00178 )
00179 {
00180 <a class="code" href="classPLBmp.html#a2">PLBmp::operator=</a>(Orig);
00181 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00182 }
00183
00184 <span class="keyword">inline</span> <a class="code" href="classPLDIBSection.html">PLDIBSection</a> & PLDIBSection::operator=
<a name="l00185"></a><a class="code" href="classPLDIBSection.html#a5">00185</a> ( <a class="code" href="classPLDIBSection.html">PLDIBSection</a> <span class="keyword">const</span> &Orig
00186 )
00187 {
00188 <a class="code" href="classPLBmp.html#a2">PLBmp::operator=</a>(Orig);
00189 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00190 }
00191
00192
00193 <span class="preprocessor">#endif</span>
00194 <span class="preprocessor"></span><span class="comment">/*</span>
00195 <span class="comment">/--------------------------------------------------------------------</span>
00196 <span class="comment">|</span>
00197 <span class="comment">| $Log: pldibsect_8h-source.html,v $
00197 <span class="comment">| Revision 1.2 2004/09/15 15:26:29 uzadow
00197 <span class="comment">| Linux compatibility changes, doc update.
00197 <span class="comment">|</span>
00198 <span class="comment">| Revision 1.5 2004/09/09 16:52:50 artcom</span>
00199 <span class="comment">| refactored PixelFormat</span>
00200 <span class="comment">|</span>
00201 <span class="comment">| Revision 1.4 2004/06/15 14:17:25 uzadow</span>
00202 <span class="comment">| First working version of PLSubBmp.</span>
00203 <span class="comment">|</span>
00204 <span class="comment">| Revision 1.3 2002/08/04 20:08:01 uzadow</span>
00205 <span class="comment">| Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.</span>
00206 <span class="comment">|</span>
00207 <span class="comment">| Revision 1.2 2002/03/31 13:36:42 uzadow</span>
00208 <span class="comment">| Updated copyright.</span>
00209 <span class="comment">|</span>
00210 <span class="comment">| Revision 1.1 2001/09/16 19:03:23 uzadow</span>
00211 <span class="comment">| Added global name prefix PL, changed most filenames.</span>
00212 <span class="comment">|</span>
00213 <span class="comment">| Revision 1.12 2001/01/21 14:28:22 uzadow</span>
00214 <span class="comment">| Changed array cleanup from delete to delete[].</span>
00215 <span class="comment">|</span>
00216 <span class="comment">| Revision 1.11 2000/12/09 12:16:26 uzadow</span>
00217 <span class="comment">| Fixed several memory leaks.</span>
00218 <span class="comment">|</span>
00219 <span class="comment">| Revision 1.10 2000/11/02 21:28:47 uzadow</span>
00220 <span class="comment">| Fixed copy constructors.</span>
00221 <span class="comment">|</span>
00222 <span class="comment">| Revision 1.9 2000/07/19 12:23:15 Ulrich von Zadow</span>
00223 <span class="comment">| Changed HANDLE to HBITMAP.</span>
00224 <span class="comment">|</span>
00225 <span class="comment">| Revision 1.8 2000/07/07 13:20:03 Ulrich von Zadow</span>
00226 <span class="comment">| Comments</span>
00227 <span class="comment">|</span>
00228 <span class="comment">| Revision 1.7 2000/01/17 23:37:12 Ulrich von Zadow</span>
00229 <span class="comment">| Corrected bug in assignment operator.</span>
00230 <span class="comment">|</span>
00231 <span class="comment">| Revision 1.6 2000/01/16 20:43:17 anonymous</span>
00232 <span class="comment">| Removed MFC dependencies</span>
00233 <span class="comment">|</span>
00234 <span class="comment">|</span>
00235 <span class="comment">\--------------------------------------------------------------------</span>
00236 <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>
|