-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagg_dda_line.h.html
315 lines (263 loc) · 27.1 KB
/
agg_dda_line.h.html
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
<HTML><HEAD><TITLE>Anti-Grain Geometry - </TITLE>
<META http-equiv="Content-Type" content="text/html"/>
<LINK rel="stylesheet" type="text/css" href="../../agg.styles.css"/>
</HEAD>
<TABLE width="640px" border="0" cellspacing="0" cellpadding="0"><TR><TD><PRE><SPAN class="rem">//----------------------------------------------------------------------------</SPAN>
<SPAN class="rem">// Anti-Grain Geometry (AGG) - Version 2.5</SPAN>
<SPAN class="rem">// A high quality rendering engine for C++</SPAN>
<SPAN class="rem">// Copyright (C) 2002-2006 Maxim Shemanarev</SPAN>
<SPAN class="rem">// Contact: [email protected]</SPAN>
<SPAN class="rem">// [email protected]</SPAN>
<SPAN class="rem">// http://antigrain.com</SPAN>
<SPAN class="rem">// </SPAN>
<SPAN class="rem">// AGG is free software; you can redistribute it and/or</SPAN>
<SPAN class="rem">// modify it under the terms of the GNU General Public License</SPAN>
<SPAN class="rem">// as published by the Free Software Foundation; either version 2</SPAN>
<SPAN class="rem">// of the License, or (at your option) any later version.</SPAN>
<SPAN class="rem">// </SPAN>
<SPAN class="rem">// AGG is distributed in the hope that it will be useful,</SPAN>
<SPAN class="rem">// but WITHOUT ANY WARRANTY; without even the implied warranty of</SPAN>
<SPAN class="rem">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</SPAN>
<SPAN class="rem">// GNU General Public License for more details.</SPAN>
<SPAN class="rem">// </SPAN>
<SPAN class="rem">// You should have received a copy of the GNU General Public License</SPAN>
<SPAN class="rem">// along with AGG; if not, write to the Free Software</SPAN>
<SPAN class="rem">// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, </SPAN>
<SPAN class="rem">// MA 02110-1301, USA.</SPAN>
<SPAN class="rem">//----------------------------------------------------------------------------</SPAN>
<SPAN class="kw2">#ifndef</SPAN> AGG_DDA_LINE_INCLUDED
<SPAN class="kw2">#define</SPAN> AGG_DDA_LINE_INCLUDED
<SPAN class="kw2">#include</SPAN> <SPAN class="op"><</SPAN>stdlib<SPAN class="op">.</SPAN>h<SPAN class="op">></SPAN>
<SPAN class="kw2">#include</SPAN> <SPAN class="str">"<A href="agg_basics.h.html">agg_basics.h</A>"</SPAN>
<SPAN class="kw1">namespace</SPAN> agg
<SPAN class="op">{</SPAN>
<SPAN class="rem">//===================================================<A name="dda_line_interpolator"><B></B></A><A href="agg_dda_line.h.html#dda_line_interpolator">dda_line_interpolator</A></SPAN>
<SPAN class="kw1">template</SPAN><SPAN class="op"><</SPAN><SPAN class="kw1">int</SPAN> FractionShift<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> YShift<SPAN class="op">=</SPAN><SPAN class="num">0</SPAN><SPAN class="op">></SPAN> <SPAN class="kw1">class</SPAN> <A href="agg_dda_line.h.html#dda_line_interpolator">dda_line_interpolator</A>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">public</SPAN>:
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<A href="agg_dda_line.h.html#dda_line_interpolator">dda_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="op">{</SPAN><SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<A href="agg_dda_line.h.html#dda_line_interpolator">dda_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> y1<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> y2<SPAN class="op">,</SPAN> <SPAN class="kw1">unsigned</SPAN> count<SPAN class="op">)</SPAN> :
m_y<SPAN class="op">(</SPAN>y1<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_inc<SPAN class="op">(</SPAN><SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">-</SPAN> y1<SPAN class="op">)</SPAN> <SPAN class="op"><<</SPAN> FractionShift<SPAN class="op">)</SPAN> <SPAN class="op">/</SPAN> <SPAN class="kw1">int</SPAN><SPAN class="op">(</SPAN>count<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_dy<SPAN class="op">(</SPAN><SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN> <SPAN class="op">++</SPAN> <SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_dy <SPAN class="op">+=</SPAN> m_inc<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN> <SPAN class="op">--</SPAN> <SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_dy <SPAN class="op">-=</SPAN> m_inc<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN> <SPAN class="op">+=</SPAN> <SPAN class="op">(</SPAN><SPAN class="kw1">unsigned</SPAN> n<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_dy <SPAN class="op">+=</SPAN> m_inc <SPAN class="op">*</SPAN> n<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN> <SPAN class="op">-=</SPAN> <SPAN class="op">(</SPAN><SPAN class="kw1">unsigned</SPAN> n<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_dy <SPAN class="op">-=</SPAN> m_inc <SPAN class="op">*</SPAN> n<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">int</SPAN> y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_y <SPAN class="op">+</SPAN> <SPAN class="op">(</SPAN>m_dy <SPAN class="op">>></SPAN> <SPAN class="op">(</SPAN>FractionShift<SPAN class="op">-</SPAN>YShift<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> dy<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_dy<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">private</SPAN>:
<SPAN class="kw1">int</SPAN> m_y<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_inc<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_dy<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN><SPAN class="op">;</SPAN>
<SPAN class="rem">//=================================================<A name="dda2_line_interpolator"><B></B></A><A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A></SPAN>
<SPAN class="kw1">class</SPAN> <A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">public</SPAN>:
<SPAN class="kw1">typedef</SPAN> <SPAN class="kw1">int</SPAN> save_data_type<SPAN class="op">;</SPAN>
<SPAN class="kw1">enum</SPAN> save_size_e <SPAN class="op">{</SPAN> save_size <SPAN class="op">=</SPAN> <SPAN class="num">2</SPAN> <SPAN class="op">}</SPAN><SPAN class="op">;</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="op">{</SPAN><SPAN class="op">}</SPAN>
<SPAN class="rem">//-------------------------------------------- Forward-adjusted line</SPAN>
<A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> y1<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> y2<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> count<SPAN class="op">)</SPAN> :
m_cnt<SPAN class="op">(</SPAN>count <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN> ? <SPAN class="num">1</SPAN> : count<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_lft<SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">-</SPAN> y1<SPAN class="op">)</SPAN> <SPAN class="op">/</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_rem<SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">-</SPAN> y1<SPAN class="op">)</SPAN> <SPAN class="op">%</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_mod<SPAN class="op">(</SPAN>m_rem<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_y<SPAN class="op">(</SPAN>y1<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">if</SPAN><SPAN class="op">(</SPAN>m_mod <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_rem <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_lft<SPAN class="op">--</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
m_mod <SPAN class="op">-=</SPAN> count<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//-------------------------------------------- Backward-adjusted line</SPAN>
<A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> y1<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> y2<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> count<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN><SPAN class="op">)</SPAN> :
m_cnt<SPAN class="op">(</SPAN>count <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN> ? <SPAN class="num">1</SPAN> : count<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_lft<SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">-</SPAN> y1<SPAN class="op">)</SPAN> <SPAN class="op">/</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_rem<SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">-</SPAN> y1<SPAN class="op">)</SPAN> <SPAN class="op">%</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_mod<SPAN class="op">(</SPAN>m_rem<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_y<SPAN class="op">(</SPAN>y1<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">if</SPAN><SPAN class="op">(</SPAN>m_mod <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_rem <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_lft<SPAN class="op">--</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//-------------------------------------------- Backward-adjusted line</SPAN>
<A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A><SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> y<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> count<SPAN class="op">)</SPAN> :
m_cnt<SPAN class="op">(</SPAN>count <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN> ? <SPAN class="num">1</SPAN> : count<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_lft<SPAN class="op">(</SPAN>y <SPAN class="op">/</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_rem<SPAN class="op">(</SPAN>y <SPAN class="op">%</SPAN> m_cnt<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_mod<SPAN class="op">(</SPAN>m_rem<SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_y<SPAN class="op">(</SPAN><SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">if</SPAN><SPAN class="op">(</SPAN>m_mod <SPAN class="op"><=</SPAN> <SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_rem <SPAN class="op">+=</SPAN> count<SPAN class="op">;</SPAN>
m_lft<SPAN class="op">--</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> save<SPAN class="op">(</SPAN>save_data_type<SPAN class="op">*</SPAN> data<SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN>
<SPAN class="op">{</SPAN>
data<SPAN class="op">[</SPAN><SPAN class="num">0</SPAN><SPAN class="op">]</SPAN> <SPAN class="op">=</SPAN> m_mod<SPAN class="op">;</SPAN>
data<SPAN class="op">[</SPAN><SPAN class="num">1</SPAN><SPAN class="op">]</SPAN> <SPAN class="op">=</SPAN> m_y<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> load<SPAN class="op">(</SPAN><SPAN class="kw1">const</SPAN> save_data_type<SPAN class="op">*</SPAN> data<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">=</SPAN> data<SPAN class="op">[</SPAN><SPAN class="num">0</SPAN><SPAN class="op">]</SPAN><SPAN class="op">;</SPAN>
m_y <SPAN class="op">=</SPAN> data<SPAN class="op">[</SPAN><SPAN class="num">1</SPAN><SPAN class="op">]</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN><SPAN class="op">++</SPAN><SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> m_rem<SPAN class="op">;</SPAN>
m_y <SPAN class="op">+=</SPAN> m_lft<SPAN class="op">;</SPAN>
<SPAN class="kw1">if</SPAN><SPAN class="op">(</SPAN>m_mod <SPAN class="op">></SPAN> <SPAN class="num">0</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">-=</SPAN> m_cnt<SPAN class="op">;</SPAN>
m_y<SPAN class="op">++</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> <SPAN class="kw1">operator</SPAN><SPAN class="op">--</SPAN><SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">if</SPAN><SPAN class="op">(</SPAN>m_mod <SPAN class="op"><=</SPAN> m_rem<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> m_cnt<SPAN class="op">;</SPAN>
m_y<SPAN class="op">--</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
m_mod <SPAN class="op">-=</SPAN> m_rem<SPAN class="op">;</SPAN>
m_y <SPAN class="op">-=</SPAN> m_lft<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> adjust_forward<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">-=</SPAN> m_cnt<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> adjust_backward<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
m_mod <SPAN class="op">+=</SPAN> m_cnt<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">int</SPAN> mod<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_mod<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> rem<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_rem<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> lft<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_lft<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">int</SPAN> y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_y<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">private</SPAN>:
<SPAN class="kw1">int</SPAN> m_cnt<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_lft<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_rem<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_mod<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_y<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN><SPAN class="op">;</SPAN>
<SPAN class="rem">//---------------------------------------------<A name="line_bresenham_interpolator"><B></B></A><A href="agg_dda_line.h.html#line_bresenham_interpolator">line_bresenham_interpolator</A></SPAN>
<SPAN class="kw1">class</SPAN> <A href="agg_dda_line.h.html#line_bresenham_interpolator">line_bresenham_interpolator</A>
<SPAN class="op">{</SPAN>
<SPAN class="kw1">public</SPAN>:
<SPAN class="kw1">enum</SPAN> subpixel_scale_e
<SPAN class="op">{</SPAN>
subpixel_shift <SPAN class="op">=</SPAN> <SPAN class="num">8</SPAN><SPAN class="op">,</SPAN>
subpixel_scale <SPAN class="op">=</SPAN> <SPAN class="num">1</SPAN> <SPAN class="op"><<</SPAN> subpixel_shift<SPAN class="op">,</SPAN>
subpixel_mask <SPAN class="op">=</SPAN> subpixel_scale <SPAN class="op">-</SPAN> <SPAN class="num">1</SPAN>
<SPAN class="op">}</SPAN><SPAN class="op">;</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">static</SPAN> <SPAN class="kw1">int</SPAN> line_lr<SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> v<SPAN class="op">)</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> v <SPAN class="op">>></SPAN> subpixel_shift<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<A href="agg_dda_line.h.html#line_bresenham_interpolator">line_bresenham_interpolator</A><SPAN class="op">(</SPAN><SPAN class="kw1">int</SPAN> x1<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> y1<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> x2<SPAN class="op">,</SPAN> <SPAN class="kw1">int</SPAN> y2<SPAN class="op">)</SPAN> :
m_x1_lr<SPAN class="op">(</SPAN>line_lr<SPAN class="op">(</SPAN>x1<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_y1_lr<SPAN class="op">(</SPAN>line_lr<SPAN class="op">(</SPAN>y1<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_x2_lr<SPAN class="op">(</SPAN>line_lr<SPAN class="op">(</SPAN>x2<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_y2_lr<SPAN class="op">(</SPAN>line_lr<SPAN class="op">(</SPAN>y2<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_ver<SPAN class="op">(</SPAN>abs<SPAN class="op">(</SPAN>m_x2_lr <SPAN class="op">-</SPAN> m_x1_lr<SPAN class="op">)</SPAN> <SPAN class="op"><</SPAN> abs<SPAN class="op">(</SPAN>m_y2_lr <SPAN class="op">-</SPAN> m_y1_lr<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_len<SPAN class="op">(</SPAN>m_ver ? abs<SPAN class="op">(</SPAN>m_y2_lr <SPAN class="op">-</SPAN> m_y1_lr<SPAN class="op">)</SPAN> :
abs<SPAN class="op">(</SPAN>m_x2_lr <SPAN class="op">-</SPAN> m_x1_lr<SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_inc<SPAN class="op">(</SPAN>m_ver ? <SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>y2 <SPAN class="op">></SPAN> y1<SPAN class="op">)</SPAN> ? <SPAN class="num">1</SPAN> : <SPAN class="op">-</SPAN><SPAN class="num">1</SPAN><SPAN class="op">)</SPAN> : <SPAN class="op">(</SPAN><SPAN class="op">(</SPAN>x2 <SPAN class="op">></SPAN> x1<SPAN class="op">)</SPAN> ? <SPAN class="num">1</SPAN> : <SPAN class="op">-</SPAN><SPAN class="num">1</SPAN><SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">,</SPAN>
m_interpolator<SPAN class="op">(</SPAN>m_ver ? x1 : y1<SPAN class="op">,</SPAN>
m_ver ? x2 : y2<SPAN class="op">,</SPAN>
m_len<SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">bool</SPAN> is_ver<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_ver<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">unsigned</SPAN> len<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_len<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> inc<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_inc<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> hstep<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="op">++</SPAN>m_interpolator<SPAN class="op">;</SPAN>
m_x1_lr <SPAN class="op">+=</SPAN> m_inc<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">void</SPAN> vstep<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN>
<SPAN class="op">{</SPAN>
<SPAN class="op">++</SPAN>m_interpolator<SPAN class="op">;</SPAN>
m_y1_lr <SPAN class="op">+=</SPAN> m_inc<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="rem">//--------------------------------------------------------------------</SPAN>
<SPAN class="kw1">int</SPAN> x1<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_x1_lr<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> y1<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_y1_lr<SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> x2<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> line_lr<SPAN class="op">(</SPAN>m_interpolator<SPAN class="op">.</SPAN>y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> y2<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> line_lr<SPAN class="op">(</SPAN>m_interpolator<SPAN class="op">.</SPAN>y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN><SPAN class="op">)</SPAN><SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> x2_hr<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_interpolator<SPAN class="op">.</SPAN>y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN><SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">int</SPAN> y2_hr<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN> <SPAN class="kw1">const</SPAN> <SPAN class="op">{</SPAN> <SPAN class="kw1">return</SPAN> m_interpolator<SPAN class="op">.</SPAN>y<SPAN class="op">(</SPAN><SPAN class="op">)</SPAN><SPAN class="op">;</SPAN> <SPAN class="op">}</SPAN>
<SPAN class="kw1">private</SPAN>:
<SPAN class="kw1">int</SPAN> m_x1_lr<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_y1_lr<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_x2_lr<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_y2_lr<SPAN class="op">;</SPAN>
<SPAN class="kw1">bool</SPAN> m_ver<SPAN class="op">;</SPAN>
<SPAN class="kw1">unsigned</SPAN> m_len<SPAN class="op">;</SPAN>
<SPAN class="kw1">int</SPAN> m_inc<SPAN class="op">;</SPAN>
<A href="agg_dda_line.h.html#dda2_line_interpolator">dda2_line_interpolator</A> m_interpolator<SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN><SPAN class="op">;</SPAN>
<SPAN class="op">}</SPAN>
<SPAN class="kw2">#endif</SPAN>
</PRE></TD></TR></TABLE><FONT style="margin-left:1em"><I></I></FONT><TABLE width="640px" bgcolor="#583927" height="1px" border="0" cellspacing="0" cellpadding="0" style="margin:0px;"><TR><TD></TD></TR></TABLE>
<TABLE width="640px" border="0" cellspacing="0" cellpadding="0">
<TR><TD><CENTER><SPAN class="authors">
Copyright <SPAN class="larger">©</SPAN> 2002-2006
<A href="../../mcseem/index.html"><B>Maxim Shemanarev</B></A>
</SPAN></CENTER></TD></TR>
<TR><TD><CENTER><SPAN class="authors">
Web Design and Programming
<A href="../../mcseem/index.html"><B>Maxim Shemanarev</B></A>
</SPAN></CENTER></TD></TR>
</TABLE>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
</HTML>