File: plsdlbmp_8h-source.html

package info (click to toggle)
paintlib 2.6.2-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,900 kB
  • ctags: 3,875
  • sloc: cpp: 25,209; sh: 10,600; ansic: 1,891; makefile: 119
file content (197 lines) | stat: -rw-r--r-- 12,220 bytes parent folder | download | duplicates (2)
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
<!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: plsdlbmp.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&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a></div>
<h1>plsdlbmp.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: plsdlbmp_8h-source.html,v 1.3 2004/07/28 15:15:29 uzadow Exp $</span>
00005 <span class="comment">|</span>
00006 <span class="comment">|      Copyright (c) 1996-2003 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_PLSDLBMP</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#define INCL_PLSDLBMP</span>
00013 <span class="preprocessor"></span>
00014 <span class="preprocessor">#ifndef INCL_PLBITMAP</span>
00015 <span class="preprocessor"></span><span class="preprocessor">#include "plbitmap.h"</span>
00016 <span class="preprocessor">#endif</span>
00017 <span class="preprocessor"></span>
00018 <span class="preprocessor">#include &lt;SDL/SDL.h&gt;</span>
00019 <span class="comment"></span>
00020 <span class="comment">//! Manipulates uncompressed bitmaps stored as SDL surfaces.</span>
00021 <span class="comment">//! 32 bpp only. </span>
<a name="l00022"></a><a class="code" href="classPLSDLBmp.html">00022</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> : <span class="keyword">public</span> <a class="code" href="classPLBmp.html">PLBmp</a>
00023 {
00024 
00025 <span class="keyword">public</span>:<span class="comment"></span>
00026 <span class="comment">  //! Creates an empty bitmap.</span>
00027 <span class="comment"></span>  <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a>
00028     ( <span class="keywordtype">int</span> SurfFlags = SDL_SWSURFACE
00029     );
00030 <span class="comment"></span>
00031 <span class="comment">  //! Destroys the bitmap.</span>
00032 <span class="comment"></span>  <span class="keyword">virtual</span> ~<a class="code" href="classPLSDLBmp.html">PLSDLBmp</a>
00033     ();
00034 <span class="comment"></span>
00035 <span class="comment">  //! Copy constructor</span>
00036 <span class="comment"></span>  <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a>
00037     ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &amp;Orig
00038     );
00039 <span class="comment"></span>
00040 <span class="comment">  //! Copy constructor</span>
00041 <span class="comment"></span>  <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a>
00042     ( <span class="keyword">const</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;Orig
00043     );
00044 <span class="comment"></span>
00045 <span class="comment">  //! Attach to an existing SDL surface. After the attach, the </span>
00046 <span class="comment">  //! bitmap object besomes the owner of the surface. Any previous contents</span>
00047 <span class="comment">  //! are destroyed.</span>
00048 <span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classPLSDLBmp.html#a4">Attach</a>
00049     ( SDL_Surface * pSurface
00050     );
00051 
00052 <span class="preprocessor">#ifdef _DEBUG</span>
00053 <span class="preprocessor"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> AssertValid
00054     () <span class="keyword">const</span>;    <span class="comment">// Tests internal object state</span>
00055 <span class="preprocessor">#endif</span>
00056 <span class="preprocessor"></span><span class="comment"></span>
00057 <span class="comment">  //! Assignment operator.</span>
00058 <span class="comment"></span>  <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;<span class="keyword">operator</span>=
00059     ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &amp;Orig
00060     );
00061 <span class="comment"></span>
00062 <span class="comment">  //! Assignment operator.</span>
00063 <span class="comment"></span>  <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;<span class="keyword">operator</span>=
00064     ( <span class="keyword">const</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;Orig
00065     );
00066 
00067   <span class="comment">// PLSDLBmp information</span>
00068 <span class="comment"></span>
00069 <span class="comment">  //! Returns a pointer to the internal SDL surface.</span>
00070 <span class="comment">  //! Using this pointer, you can bring SDL and paintlib data out of sync</span>
00071 <span class="comment">  //! easily. Handle with care.</span>
00072 <span class="comment"></span>  SDL_Surface * <a class="code" href="classPLSDLBmp.html#a7">GetSurface</a>
00073     ();
00074 <span class="comment"></span>
00075 <span class="comment">  //! Returns the amount of memory used by the object.</span>
00076 <span class="comment"></span>  <span class="keywordtype">long</span> <a class="code" href="classPLSDLBmp.html#a8">GetMemUsed</a>
00077     ();
00078 <span class="comment"></span>
00079 <span class="comment">  //! Returns number of bytes used per line.</span>
00080 <span class="comment"></span>  <span class="keywordtype">long</span> <a class="code" href="classPLSDLBmp.html#a9">GetBytesPerLine</a>
00081     ();
00082 
00083   <span class="comment">// Static functions</span>
00084 <span class="comment"></span>
00085 <span class="comment">  //! Returns memory needed by a bitmap with the specified attributes.</span>
00086 <span class="comment"></span>  <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="classPLSDLBmp.html#e0">GetMemNeeded</a>
00087     ( PLLONG width,
00088       PLLONG height,
00089       PLWORD BitsPerPixel
00090     );
00091 <span class="comment"></span>
00092 <span class="comment">  //! Returns memory needed by bitmap bits.</span>
00093 <span class="comment"></span>  <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="classPLSDLBmp.html#e1">GetBitsMemNeeded</a>
00094     ( PLLONG width,
00095       PLLONG height,
00096       PLWORD BitsPerPixel
00097     );
00098 
00099 
00100 <span class="keyword">protected</span>:
00101   <span class="comment">// Local functions</span>
00102 
00103   <span class="comment">// Create a new bitmap with uninitialized bits. Assumes no memory</span>
00104   <span class="comment">// is allocated yet.</span>
00105   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLSDLBmp.html#b0">internalCreate</a>
00106     ( PLLONG Width,
00107       PLLONG Height,
00108       PLWORD BitsPerPixel,
00109       <span class="keywordtype">bool</span> bAlphaChannel,
00110       <span class="keywordtype">bool</span> bIsGreyscale
00111     );
00112 
00113   <span class="comment">// Deletes memory allocated by member variables.</span>
00114   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLSDLBmp.html#b1">freeMembers</a>
00115     ();
00116 
00117   <span class="comment">// Initializes internal table of line addresses.</span>
00118   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPLSDLBmp.html#b2">initLineArray</a>
00119     ();
00120 
00121 <span class="keyword">private</span>:  
00122   SDL_Surface * m_pSurface;        <span class="comment">// Pointer to the bits.</span>
00123   <span class="keywordtype">int</span> m_SurfFlags;
00124 };
00125 
00126 <span class="comment">// Note that _both_ these copy constructors are needed. If only the</span>
00127 <span class="comment">// second one is there, MSVC generates a default copy</span>
00128 <span class="comment">// constructor anyway :-(.</span>
00129 <span class="keyword">inline</span> <a class="code" href="classPLSDLBmp.html#a0">PLSDLBmp::PLSDLBmp</a>
<a name="l00130"></a><a class="code" href="classPLSDLBmp.html#a3">00130</a>     ( <span class="keyword">const</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;Orig
00131     )
00132     : <a class="code" href="classPLBmp.html">PLBmp</a> ()
00133 {
00134   m_SurfFlags = Orig.m_SurfFlags;
00135   internalCopy (Orig);
00136 }
00137 
00138 <span class="keyword">inline</span> <a class="code" href="classPLSDLBmp.html#a0">PLSDLBmp::PLSDLBmp</a>
<a name="l00139"></a><a class="code" href="classPLSDLBmp.html#a2">00139</a>     ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &amp;Orig
00140     )
00141     : <a class="code" href="classPLBmp.html">PLBmp</a> ()
00142 {
00143   m_SurfFlags = SDL_SWSURFACE;
00144   internalCopy (Orig);
00145 }
00146 
00147 <span class="keyword">inline</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp; PLSDLBmp::operator=
<a name="l00148"></a><a class="code" href="classPLSDLBmp.html#a5">00148</a>     ( <span class="keyword">const</span> <a class="code" href="classPLBmpBase.html">PLBmpBase</a> &amp;Orig
00149     )
00150 {
00151   <a class="code" href="classPLBmp.html#a2">PLBmp::operator=</a>(Orig);
00152   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00153 }
00154 
00155 <span class="keyword">inline</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp; PLSDLBmp::operator=
<a name="l00156"></a><a class="code" href="classPLSDLBmp.html#a6">00156</a>     ( <span class="keyword">const</span> <a class="code" href="classPLSDLBmp.html">PLSDLBmp</a> &amp;Orig
00157     )
00158 {
00159   m_SurfFlags = Orig.<a class="code" href="classPLSDLBmp.html#r1">m_SurfFlags</a>;
00160   <a class="code" href="classPLBmp.html#a2">PLBmp::operator=</a>(Orig);
00161   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00162 }
00163 
00164 
00165 <span class="preprocessor">#endif</span>
00166 <span class="preprocessor"></span><span class="comment">/*</span>
00167 <span class="comment">/--------------------------------------------------------------------</span>
00168 <span class="comment">|</span>
00169 <span class="comment">|      $Log: plsdlbmp_8h-source.html,v $
00169 <span class="comment">|      Revision 1.3  2004/07/28 15:15:29  uzadow
00169 <span class="comment">|      Added missing documentation files.
00169 <span class="comment">|</span>
00170 <span class="comment">|      Revision 1.3  2004/06/15 14:32:22  uzadow</span>
00171 <span class="comment">|      Linux build fix.</span>
00172 <span class="comment">|</span>
00173 <span class="comment">|      Revision 1.2  2003/03/08 15:15:51  uzadow</span>
00174 <span class="comment">|      Added PLSDLBmp::Attach().</span>
00175 <span class="comment">|</span>
00176 <span class="comment">|      Revision 1.1  2003/03/08 14:32:08  uzadow</span>
00177 <span class="comment">|      Added support for bitmaps in SDL surface format.</span>
00178 <span class="comment">|</span>
00179 <span class="comment">|</span>
00180 <span class="comment">\--------------------------------------------------------------------</span>
00181 <span class="comment">*/</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Jul 28 17:13:36 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>