forked from rweather/arduinolibs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bitmap_8cpp_source.html
673 lines (671 loc) · 103 KB
/
Bitmap_8cpp_source.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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>ArduinoLibs: Bitmap.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">ArduinoLibs
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_bc0718b08fb2015b8e59c47b2805f60c.html">libraries</a></li><li class="navelem"><a class="el" href="dir_6591a2127a29f6cea3994dcb5b0596d1.html">DMD</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Bitmap.cpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (C) 2012 Southern Storm Software, Pty Ltd.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * copy of this software and associated documentation files (the "Software"),</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * to deal in the Software without restriction, including without limitation</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * The above copyright notice and this permission notice shall be included</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * in all copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include "Bitmap.h"</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <WString.h></span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <string.h></span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <stdlib.h></span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="classBitmap.html#a40526748415c8bbc58a8510d636c20f4"> 88</a></span> <a class="code" href="classBitmap.html#a40526748415c8bbc58a8510d636c20f4" title="Constructs a new in-memory bitmap that is width x height pixels in size.">Bitmap::Bitmap</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height)</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  : _width(width)</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  , _height(height)</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  , _stride((width + 7) / 8)</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  , fb(0)</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  , _font(0)</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  , _textColor(White)</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="comment">// Allocate memory for the framebuffer and clear it (1 = pixel off).</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size = _stride * _height;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  fb = (uint8_t *)malloc(size);</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">if</span> (fb)</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  memset(fb, 0xFF, size);</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> }</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="classBitmap.html#a72d2a301ec1eb1c8d0f3d64823659a8e"> 106</a></span> <a class="code" href="classBitmap.html#a72d2a301ec1eb1c8d0f3d64823659a8e" title="Destroys this bitmap.">Bitmap::~Bitmap</a>()</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> {</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span> (fb)</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  free(fb);</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> }</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> </div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1"> 174</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1" title="Clears the entire bitmap to the specified color.">Bitmap::clear</a>(<a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> {</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size = _stride * _height;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordflow">if</span> (color == <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to "black".">Black</a>)</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  memset(fb, 0xFF, size);</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  memset(fb, 0x00, size);</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> }</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div>
<div class="line"><a name="l00191"></a><span class="lineno"><a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203"> 191</a></span> <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Bitmap::Color</a> <a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203" title="Returns the color of the pixel at (x, y); either Black or White.">Bitmap::pixel</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y)<span class="keyword"> const</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordflow">if</span> (((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)x) >= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_width) ||</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)y) >= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_height))</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to "black".">Black</a>;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  uint8_t *ptr = fb + y * _stride + (x >> 3);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">if</span> (*ptr & ((uint8_t)0x80) >> (x & 0x07))</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to "black".">Black</a>;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a39b6754cfe50a457bbfdb1980fd87eb7" title="Color value corresponding to "white". If the bitmap is displayed on a LED array, then it may have a d...">White</a>;</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span> }</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114"> 208</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">Bitmap::setPixel</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span> {</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">if</span> (((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)x) >= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_width) ||</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)y) >= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_height))</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordflow">return</span>; <span class="comment">// Pixel is off-screen.</span></div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  uint8_t *ptr = fb + y * _stride + (x >> 3);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">if</span> (color)</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  *ptr &= ~(((uint8_t)0x80) >> (x & 0x07));</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  *ptr |= (((uint8_t)0x80) >> (x & 0x07));</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span> }</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div>
<div class="line"><a name="l00225"></a><span class="lineno"><a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767"> 225</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">Bitmap::drawLine</a>(<span class="keywordtype">int</span> x1, <span class="keywordtype">int</span> y1, <span class="keywordtype">int</span> x2, <span class="keywordtype">int</span> y2, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span> {</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="comment">// Midpoint line scan-conversion algorithm from "Computer Graphics:</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="comment">// Principles and Practice", Second Edition, Foley, van Dam, et al.</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keywordtype">int</span> dx = x2 - x1;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordtype">int</span> dy = y2 - y1;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="keywordtype">int</span> xstep, ystep;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordtype">int</span> d, incrE, incrNE;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">if</span> (dx < 0) {</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  xstep = -1;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  dx = -dx;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  xstep = 1;</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  }</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="keywordflow">if</span> (dy < 0) {</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  ystep = -1;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  dy = -dy;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  ystep = 1;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  }</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keywordflow">if</span> (dx >= dy) {</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  d = 2 * dy - dx;</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  incrE = 2 * dy;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  incrNE = 2 * (dy - dx);</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keywordflow">while</span> (x1 != x2) {</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keywordflow">if</span> (d <= 0) {</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  d += incrE;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  d += incrNE;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  y1 += ystep;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  }</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  x1 += xstep;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  }</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  d = 2 * dx - dy;</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  incrE = 2 * dx;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  incrNE = 2 * (dx - dy);</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <span class="keywordflow">while</span> (y1 != y2) {</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keywordflow">if</span> (d <= 0) {</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  d += incrE;</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  d += incrNE;</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  x1 += xstep;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  }</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  y1 += ystep;</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  }</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  }</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span> }</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span> </div>
<div class="line"><a name="l00286"></a><span class="lineno"><a class="code" href="classBitmap.html#aac61e3f7f625db568e37d88b52b3b2fc"> 286</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#aac61e3f7f625db568e37d88b52b3b2fc" title="Draws a rectangle from (x1, y1) to (x2, y2), with the outline in borderColor and the interior filled ...">Bitmap::drawRect</a>(<span class="keywordtype">int</span> x1, <span class="keywordtype">int</span> y1, <span class="keywordtype">int</span> x2, <span class="keywordtype">int</span> y2, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> borderColor, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> fillColor)</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span> {</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  <span class="keywordtype">int</span> temp;</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <span class="keywordflow">if</span> (x1 > x2) {</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  temp = x1;</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  x1 = x2;</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  x2 = temp;</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  }</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <span class="keywordflow">if</span> (y1 > y2) {</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  temp = y1;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  y1 = y2;</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  y2 = temp;</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  }</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">if</span> (fillColor == borderColor) {</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x1, y1, x2 - x1 + 1, y2 - y1 + 1, fillColor);</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(x1, y1, x2, y1, borderColor);</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="keywordflow">if</span> (y1 < y2)</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(x2, y1 + 1, x2, y2, borderColor);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  <span class="keywordflow">if</span> (x1 < x2)</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(x2 - 1, y2, x1, y2, borderColor);</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">if</span> (y1 < (y2 - 1))</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(x1, y2 - 1, x1, y1 + 1, borderColor);</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keywordflow">if</span> (fillColor != <a class="code" href="classBitmap.html#aa89170263dc1f51f6366c1907119715e" title="Special color value that is used with drawRect() and drawCircle() to indicate that the interior of th...">NoFill</a>)</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x1 + 1, y1 + 1, x2 - x1 - 1, y2 - y1 - 1, fillColor);</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  }</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span> }</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span> </div>
<div class="line"><a name="l00334"></a><span class="lineno"><a class="code" href="classBitmap.html#a933763a4f3cba79fbcf97ae6d0a864aa"> 334</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a933763a4f3cba79fbcf97ae6d0a864aa" title="Draws a circle with a specific center (centerX, centerY) and radius, with the outline in borderColor ...">Bitmap::drawCircle</a>(<span class="keywordtype">int</span> centerX, <span class="keywordtype">int</span> centerY, <span class="keywordtype">int</span> radius, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> borderColor, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> fillColor)</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span> {</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="comment">// Midpoint circle scan-conversion algorithm using second-order</span></div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="comment">// differences from "Computer Graphics: Principles and Practice",</span></div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="comment">// Second Edition, Foley, van Dam, et al.</span></div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keywordflow">if</span> (radius < 0)</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  radius = -radius;</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  <span class="keywordtype">int</span> x = 0;</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  <span class="keywordtype">int</span> y = radius;</div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  <span class="keywordtype">int</span> d = 1 - radius;</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordtype">int</span> deltaE = 3;</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  <span class="keywordtype">int</span> deltaSE = 5 - 2 * radius;</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  <span class="keywordflow">while</span> (y > x) {</div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <span class="keywordflow">if</span> (d < 0) {</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  d += deltaE;</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  deltaE += 2;</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  deltaSE += 2;</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  d += deltaSE;</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  deltaE += 2;</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  deltaSE += 4;</div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  --y;</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  }</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  ++x;</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span> }</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span> </div>
<div class="line"><a name="l00388"></a><span class="lineno"><a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72"> 388</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72" title="Draws bitmap at (x, y) in color.">Bitmap::drawBitmap</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keyword">const</span> <a class="code" href="classBitmap.html" title="Represents a monochrome bitmap within main memory.">Bitmap</a> &bitmap, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span> {</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  <span class="keywordtype">int</span> w = bitmap.<a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>();</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="keywordtype">int</span> s = bitmap.<a class="code" href="classBitmap.html#af30df263729385ea2330effe3c80a1bc" title="Returns the number of bytes in each line of the bitmap's data() buffer.">stride</a>();</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  <span class="keywordtype">int</span> h = bitmap.<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>();</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordflow">for</span> (uint8_t by = 0; by < h; ++by) {</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  <span class="keyword">const</span> uint8_t *line = bitmap.<a class="code" href="classBitmap.html#a5eeed27c176eb6e4a2c39ea83444e27d" title="Returns a pointer to the start of the bitmap's data buffer.">data</a>() + by * s;</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  uint8_t mask = 0x80;</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  uint8_t value = *line++;</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keywordflow">for</span> (uint8_t bx = 0; bx < w; ++bx) {</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <span class="keywordflow">if</span> (value & mask)</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, invColor);</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, color);</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  mask >>= 1;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="keywordflow">if</span> (!mask) {</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  mask = 0x80;</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  value = *line++;</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  }</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  }</div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  }</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span> }</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div>
<div class="line"><a name="l00425"></a><span class="lineno"><a class="code" href="classBitmap.html#a5e4f23e8f14e193410b5f071149401e4"> 425</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72" title="Draws bitmap at (x, y) in color.">Bitmap::drawBitmap</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43" title="Type that represents a bitmap within program memory.">Bitmap::ProgMem</a> bitmap, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span> {</div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  uint8_t w = pgm_read_byte(bitmap);</div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  uint8_t s = (w + 7) >> 3;</div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  uint8_t h = pgm_read_byte(bitmap + 1);</div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  <span class="keywordflow">for</span> (uint8_t by = 0; by < h; ++by) {</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>  <span class="keyword">const</span> uint8_t *line = ((<span class="keyword">const</span> uint8_t *)bitmap) + 2 + by * s;</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  uint8_t mask = 0x80;</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  uint8_t value = pgm_read_byte(line);</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  <span class="keywordflow">for</span> (uint8_t bx = 0; bx < w; ++bx) {</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <span class="keywordflow">if</span> (value & mask)</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, color);</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, invColor);</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  mask >>= 1;</div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  <span class="keywordflow">if</span> (!mask) {</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  mask = 0x80;</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  ++line;</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>  value = pgm_read_byte(line);</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  }</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>  }</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>  }</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span> }</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span> </div>
<div class="line"><a name="l00509"></a><span class="lineno"> 509</span> <span class="preprocessor">#define fontIsFixed(font) (pgm_read_byte((font)) == 0 && \</span></div>
<div class="line"><a name="l00510"></a><span class="lineno"> 510</span> <span class="preprocessor"> pgm_read_byte((font) + 1) == 0)</span></div>
<div class="line"><a name="l00511"></a><span class="lineno"> 511</span> <span class="preprocessor"></span><span class="preprocessor">#define fontWidth(font) (pgm_read_byte((font) + 2))</span></div>
<div class="line"><a name="l00512"></a><span class="lineno"> 512</span> <span class="preprocessor"></span><span class="preprocessor">#define fontHeight(font) (pgm_read_byte((font) + 3))</span></div>
<div class="line"><a name="l00513"></a><span class="lineno"> 513</span> <span class="preprocessor"></span><span class="preprocessor">#define fontFirstChar(font) (pgm_read_byte((font) + 4))</span></div>
<div class="line"><a name="l00514"></a><span class="lineno"> 514</span> <span class="preprocessor"></span><span class="preprocessor">#define fontCharCount(font) (pgm_read_byte((font) + 5))</span></div>
<div class="line"><a name="l00515"></a><span class="lineno"> 515</span> <span class="preprocessor"></span></div>
<div class="line"><a name="l00526"></a><span class="lineno"><a class="code" href="classBitmap.html#a3e9bcbfb584d5020bd6f0a313ee275f0"> 526</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a3e9bcbfb584d5020bd6f0a313ee275f0" title="Draws the len characters of str at (x, y).">Bitmap::drawText</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keyword">const</span> <span class="keywordtype">char</span> *str, <span class="keywordtype">int</span> len)</div>
<div class="line"><a name="l00527"></a><span class="lineno"> 527</span> {</div>
<div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  <span class="keywordflow">if</span> (!_font)</div>
<div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);</div>
<div class="line"><a name="l00531"></a><span class="lineno"> 531</span>  <span class="keywordflow">if</span> (len < 0)</div>
<div class="line"><a name="l00532"></a><span class="lineno"> 532</span>  len = strlen(str);</div>
<div class="line"><a name="l00533"></a><span class="lineno"> 533</span>  <span class="keywordflow">while</span> (len-- > 0) {</div>
<div class="line"><a name="l00534"></a><span class="lineno"> 534</span>  x += <a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd" title="Draws a single character ch at (x, y).">drawChar</a>(x, y, *str++);</div>
<div class="line"><a name="l00535"></a><span class="lineno"> 535</span>  <span class="keywordflow">if</span> (len > 0) {</div>
<div class="line"><a name="l00536"></a><span class="lineno"> 536</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, 1, height, !_textColor);</div>
<div class="line"><a name="l00537"></a><span class="lineno"> 537</span>  ++x;</div>
<div class="line"><a name="l00538"></a><span class="lineno"> 538</span>  }</div>
<div class="line"><a name="l00539"></a><span class="lineno"> 539</span>  <span class="keywordflow">if</span> (x >= _width)</div>
<div class="line"><a name="l00540"></a><span class="lineno"> 540</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00541"></a><span class="lineno"> 541</span>  }</div>
<div class="line"><a name="l00542"></a><span class="lineno"> 542</span> }</div>
<div class="line"><a name="l00543"></a><span class="lineno"> 543</span> </div>
<div class="line"><a name="l00555"></a><span class="lineno"><a class="code" href="classBitmap.html#a802f5d6bd19a3727670e61e7a88a0cac"> 555</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a3e9bcbfb584d5020bd6f0a313ee275f0" title="Draws the len characters of str at (x, y).">Bitmap::drawText</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keyword">const</span> String &str, <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> len)</div>
<div class="line"><a name="l00556"></a><span class="lineno"> 556</span> {</div>
<div class="line"><a name="l00557"></a><span class="lineno"> 557</span>  <span class="keywordflow">if</span> (!_font)</div>
<div class="line"><a name="l00558"></a><span class="lineno"> 558</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00559"></a><span class="lineno"> 559</span>  uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);</div>
<div class="line"><a name="l00560"></a><span class="lineno"> 560</span>  <span class="keywordflow">if</span> (len < 0)</div>
<div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  len = str.length() - start;</div>
<div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  <span class="keywordflow">while</span> (len-- > 0) {</div>
<div class="line"><a name="l00563"></a><span class="lineno"> 563</span>  x += <a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd" title="Draws a single character ch at (x, y).">drawChar</a>(x, y, str[start++]);</div>
<div class="line"><a name="l00564"></a><span class="lineno"> 564</span>  <span class="keywordflow">if</span> (len > 0) {</div>
<div class="line"><a name="l00565"></a><span class="lineno"> 565</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, 1, height, !_textColor);</div>
<div class="line"><a name="l00566"></a><span class="lineno"> 566</span>  ++x;</div>
<div class="line"><a name="l00567"></a><span class="lineno"> 567</span>  }</div>
<div class="line"><a name="l00568"></a><span class="lineno"> 568</span>  <span class="keywordflow">if</span> (x >= _width)</div>
<div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  }</div>
<div class="line"><a name="l00571"></a><span class="lineno"> 571</span> }</div>
<div class="line"><a name="l00572"></a><span class="lineno"> 572</span> </div>
<div class="line"><a name="l00585"></a><span class="lineno"><a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd"> 585</a></span> <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd" title="Draws a single character ch at (x, y).">Bitmap::drawChar</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">char</span> ch)</div>
<div class="line"><a name="l00586"></a><span class="lineno"> 586</span> {</div>
<div class="line"><a name="l00587"></a><span class="lineno"> 587</span>  uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);</div>
<div class="line"><a name="l00588"></a><span class="lineno"> 588</span>  <span class="keywordflow">if</span> (ch == <span class="charliteral">' '</span>) {</div>
<div class="line"><a name="l00589"></a><span class="lineno"> 589</span>  <span class="comment">// Font may not have space, or it is zero-width. Calculate</span></div>
<div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="comment">// the real size and fill the space.</span></div>
<div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <span class="keywordtype">int</span> spaceWidth = <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">charWidth</a>(<span class="charliteral">'n'</span>);</div>
<div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, spaceWidth, height, !_textColor);</div>
<div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  <span class="keywordflow">return</span> spaceWidth;</div>
<div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  }</div>
<div class="line"><a name="l00595"></a><span class="lineno"> 595</span>  uint8_t first = fontFirstChar(_font);</div>
<div class="line"><a name="l00596"></a><span class="lineno"> 596</span>  uint8_t count = fontCharCount(_font);</div>
<div class="line"><a name="l00597"></a><span class="lineno"> 597</span>  uint8_t index = (uint8_t)ch;</div>
<div class="line"><a name="l00598"></a><span class="lineno"> 598</span>  <span class="keywordflow">if</span> (index < first || index >= (first + count))</div>
<div class="line"><a name="l00599"></a><span class="lineno"> 599</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  index -= first;</div>
<div class="line"><a name="l00601"></a><span class="lineno"> 601</span>  uint8_t heightBytes = (height + 7) >> 3;;</div>
<div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  uint8_t <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  <span class="keyword">const</span> uint8_t *image;</div>
<div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  <span class="keywordflow">if</span> (fontIsFixed(_font)) {</div>
<div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  <span class="comment">// Fixed-width font.</span></div>
<div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  width = fontWidth(_font);</div>
<div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  image = ((<span class="keyword">const</span> uint8_t *)_font) + 6 + index * heightBytes * <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  <span class="comment">// Variable-width font.</span></div>
<div class="line"><a name="l00610"></a><span class="lineno"> 610</span>  width = pgm_read_byte(_font + 6 + index);</div>
<div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  image = ((<span class="keyword">const</span> uint8_t *)_font) + 6 + count;</div>
<div class="line"><a name="l00612"></a><span class="lineno"> 612</span>  <span class="keywordflow">for</span> (uint8_t temp = 0; temp < index; ++temp) {</div>
<div class="line"><a name="l00613"></a><span class="lineno"> 613</span>  <span class="comment">// Scan through all previous characters to find the starting</span></div>
<div class="line"><a name="l00614"></a><span class="lineno"> 614</span>  <span class="comment">// location for this one.</span></div>
<div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  image += pgm_read_byte(_font + 6 + temp) * heightBytes;</div>
<div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  }</div>
<div class="line"><a name="l00617"></a><span class="lineno"> 617</span>  }</div>
<div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  <span class="keywordflow">if</span> ((x + width) <= 0 || (y + height) <= 0)</div>
<div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; <span class="comment">// Character is off the top or left of the screen.</span></div>
<div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !_textColor;</div>
<div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  <span class="keywordflow">for</span> (uint8_t cx = 0; cx < <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++cx) {</div>
<div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  <span class="keywordflow">for</span> (uint8_t cy = 0; cy < heightBytes; ++cy) {</div>
<div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  uint8_t value = pgm_read_byte(image + cy * width + cx);</div>
<div class="line"><a name="l00624"></a><span class="lineno"> 624</span>  <span class="keywordtype">int</span> posn;</div>
<div class="line"><a name="l00625"></a><span class="lineno"> 625</span>  <span class="keywordflow">if</span> (heightBytes > 1 && cy == (heightBytes - 1))</div>
<div class="line"><a name="l00626"></a><span class="lineno"> 626</span>  posn = height - 8;</div>
<div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00628"></a><span class="lineno"> 628</span>  posn = cy * 8;</div>
<div class="line"><a name="l00629"></a><span class="lineno"> 629</span>  <span class="keywordflow">for</span> (uint8_t bit = 0; bit < 8; ++bit) {</div>
<div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  <span class="keywordflow">if</span> ((posn + bit) >= (cy * 8) && (posn + bit) <= height) {</div>
<div class="line"><a name="l00631"></a><span class="lineno"> 631</span>  <span class="keywordflow">if</span> (value & 0x01)</div>
<div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + cx, y + posn + bit, _textColor);</div>
<div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00634"></a><span class="lineno"> 634</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + cx, y + posn + bit, invColor);</div>
<div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  }</div>
<div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  value >>= 1;</div>
<div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  }</div>
<div class="line"><a name="l00638"></a><span class="lineno"> 638</span>  }</div>
<div class="line"><a name="l00639"></a><span class="lineno"> 639</span>  }</div>
<div class="line"><a name="l00640"></a><span class="lineno"> 640</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00641"></a><span class="lineno"> 641</span> }</div>
<div class="line"><a name="l00642"></a><span class="lineno"> 642</span> </div>
<div class="line"><a name="l00650"></a><span class="lineno"><a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd"> 650</a></span> <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">Bitmap::charWidth</a>(<span class="keywordtype">char</span> ch)<span class="keyword"> const</span></div>
<div class="line"><a name="l00651"></a><span class="lineno"> 651</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  uint8_t index = (uint8_t)ch;</div>
<div class="line"><a name="l00653"></a><span class="lineno"> 653</span>  <span class="keywordflow">if</span> (!_font)</div>
<div class="line"><a name="l00654"></a><span class="lineno"> 654</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  uint8_t first = fontFirstChar(_font);</div>
<div class="line"><a name="l00656"></a><span class="lineno"> 656</span>  uint8_t count = fontCharCount(_font);</div>
<div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  <span class="keywordflow">if</span> (index == <span class="charliteral">' '</span>)</div>
<div class="line"><a name="l00658"></a><span class="lineno"> 658</span>  index = <span class="charliteral">'n'</span>; <span class="comment">// In case the font does not contain space.</span></div>
<div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  <span class="keywordflow">if</span> (index < first || index >= (first + count))</div>
<div class="line"><a name="l00660"></a><span class="lineno"> 660</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00661"></a><span class="lineno"> 661</span>  <span class="keywordflow">if</span> (fontIsFixed(_font))</div>
<div class="line"><a name="l00662"></a><span class="lineno"> 662</span>  <span class="keywordflow">return</span> fontWidth(_font);</div>
<div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00664"></a><span class="lineno"> 664</span>  <span class="keywordflow">return</span> pgm_read_byte(_font + 6 + (index - first));</div>
<div class="line"><a name="l00665"></a><span class="lineno"> 665</span> }</div>
<div class="line"><a name="l00666"></a><span class="lineno"> 666</span> </div>
<div class="line"><a name="l00675"></a><span class="lineno"><a class="code" href="classBitmap.html#a0f7607b1c7867987f4500d490a666e8a"> 675</a></span> <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a0f7607b1c7867987f4500d490a666e8a" title="Returns the width in pixels of the len characters of str in the current font(), including inter-chara...">Bitmap::textWidth</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *str, <span class="keywordtype">int</span> len)<span class="keyword"> const</span></div>
<div class="line"><a name="l00676"></a><span class="lineno"> 676</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00677"></a><span class="lineno"> 677</span>  <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a> = 0;</div>
<div class="line"><a name="l00678"></a><span class="lineno"> 678</span>  <span class="keywordflow">if</span> (len < 0)</div>
<div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  len = strlen(str);</div>
<div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="keywordflow">while</span> (len-- > 0) {</div>
<div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  width += <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">charWidth</a>(*str++);</div>
<div class="line"><a name="l00682"></a><span class="lineno"> 682</span>  <span class="keywordflow">if</span> (len > 0)</div>
<div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  ++<a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  }</div>
<div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00686"></a><span class="lineno"> 686</span> }</div>
<div class="line"><a name="l00687"></a><span class="lineno"> 687</span> </div>
<div class="line"><a name="l00697"></a><span class="lineno"><a class="code" href="classBitmap.html#a8ca70aa0f8f722a228358bffe794e925"> 697</a></span> <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a0f7607b1c7867987f4500d490a666e8a" title="Returns the width in pixels of the len characters of str in the current font(), including inter-chara...">Bitmap::textWidth</a>(<span class="keyword">const</span> String &str, <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> len)<span class="keyword"> const</span></div>
<div class="line"><a name="l00698"></a><span class="lineno"> 698</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00699"></a><span class="lineno"> 699</span>  <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a> = 0;</div>
<div class="line"><a name="l00700"></a><span class="lineno"> 700</span>  <span class="keywordflow">if</span> (len < 0)</div>
<div class="line"><a name="l00701"></a><span class="lineno"> 701</span>  len = str.length() - start;</div>
<div class="line"><a name="l00702"></a><span class="lineno"> 702</span>  <span class="keywordflow">while</span> (len-- > 0) {</div>
<div class="line"><a name="l00703"></a><span class="lineno"> 703</span>  width += <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">charWidth</a>(str[start++]);</div>
<div class="line"><a name="l00704"></a><span class="lineno"> 704</span>  <span class="keywordflow">if</span> (len > 0)</div>
<div class="line"><a name="l00705"></a><span class="lineno"> 705</span>  ++<a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00706"></a><span class="lineno"> 706</span>  }</div>
<div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;</div>
<div class="line"><a name="l00708"></a><span class="lineno"> 708</span> }</div>
<div class="line"><a name="l00709"></a><span class="lineno"> 709</span> </div>
<div class="line"><a name="l00716"></a><span class="lineno"><a class="code" href="classBitmap.html#a628bb694fcfe6eab619a4f1e152d41c4"> 716</a></span> <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a628bb694fcfe6eab619a4f1e152d41c4" title="Returns the height in pixels of the current text drawing font(); or zero if font() is not set...">Bitmap::textHeight</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00717"></a><span class="lineno"> 717</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  <span class="keywordflow">if</span> (_font)</div>
<div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="keywordflow">return</span> fontHeight(_font);</div>
<div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00722"></a><span class="lineno"> 722</span> }</div>
<div class="line"><a name="l00723"></a><span class="lineno"> 723</span> </div>
<div class="line"><a name="l00738"></a><span class="lineno"><a class="code" href="classBitmap.html#ab22fe1f3871934987a670b559f67c67c"> 738</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#ab22fe1f3871934987a670b559f67c67c" title="Copies the width x height pixels starting at top-left corner (x, y) to (destX, destY) in the bitmap d...">Bitmap::copy</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <a class="code" href="classBitmap.html" title="Represents a monochrome bitmap within main memory.">Bitmap</a> *dest, <span class="keywordtype">int</span> destX, <span class="keywordtype">int</span> destY)</div>
<div class="line"><a name="l00739"></a><span class="lineno"> 739</span> {</div>
<div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  <span class="keywordflow">if</span> (dest == <span class="keyword">this</span>) {</div>
<div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  <span class="comment">// Copying to within the same bitmap, so copy in a direction</span></div>
<div class="line"><a name="l00742"></a><span class="lineno"> 742</span>  <span class="comment">// that will prevent problems with overlap.</span></div>
<div class="line"><a name="l00743"></a><span class="lineno"> 743</span>  blit(x, y, x + width - 1, y + height - 1, destX, destY);</div>
<div class="line"><a name="l00744"></a><span class="lineno"> 744</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00745"></a><span class="lineno"> 745</span>  <span class="comment">// Copying to a different bitmap.</span></div>
<div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  <span class="keywordflow">while</span> (height > 0) {</div>
<div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = 0; tempx < <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++tempx)</div>
<div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  dest-><a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(destX + tempx, destY, <a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203" title="Returns the color of the pixel at (x, y); either Black or White.">pixel</a>(x + tempx, y));</div>
<div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  ++y;</div>
<div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  ++destY;</div>
<div class="line"><a name="l00751"></a><span class="lineno"> 751</span>  --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;</div>
<div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  }</div>
<div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  }</div>
<div class="line"><a name="l00754"></a><span class="lineno"> 754</span> }</div>
<div class="line"><a name="l00755"></a><span class="lineno"> 755</span> </div>
<div class="line"><a name="l00762"></a><span class="lineno"><a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2"> 762</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">Bitmap::fill</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00763"></a><span class="lineno"> 763</span> {</div>
<div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  <span class="keywordflow">while</span> (height > 0) {</div>
<div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> temp = 0; temp < <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++temp)</div>
<div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + temp, y, color);</div>
<div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  ++y;</div>
<div class="line"><a name="l00768"></a><span class="lineno"> 768</span>  --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;</div>
<div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  }</div>
<div class="line"><a name="l00770"></a><span class="lineno"> 770</span> }</div>
<div class="line"><a name="l00771"></a><span class="lineno"> 771</span> </div>
<div class="line"><a name="l00785"></a><span class="lineno"><a class="code" href="classBitmap.html#ac661adab340858b541a2fe44e6303f56"> 785</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">Bitmap::fill</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43" title="Type that represents a bitmap within program memory.">Bitmap::ProgMem</a> pattern, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)</div>
<div class="line"><a name="l00786"></a><span class="lineno"> 786</span> {</div>
<div class="line"><a name="l00787"></a><span class="lineno"> 787</span>  uint8_t w = pgm_read_byte(pattern);</div>
<div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  uint8_t s = (w + 7) >> 3;</div>
<div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  uint8_t h = pgm_read_byte(pattern + 1);</div>
<div class="line"><a name="l00790"></a><span class="lineno"> 790</span>  <span class="keywordflow">if</span> (!w || !h)</div>
<div class="line"><a name="l00791"></a><span class="lineno"> 791</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;</div>
<div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = 0; tempy < <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>; ++tempy) {</div>
<div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  <span class="keyword">const</span> uint8_t *startLine = ((<span class="keyword">const</span> uint8_t *)pattern) + 2 + (tempy % h) * s;</div>
<div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  <span class="keyword">const</span> uint8_t *line = startLine;</div>
<div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  uint8_t mask = 0x80;</div>
<div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  uint8_t value = pgm_read_byte(line++);</div>
<div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  <span class="keywordtype">int</span> bit = 0;</div>
<div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = 0; tempx < <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++tempx) {</div>
<div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  <span class="keywordflow">if</span> (value & mask)</div>
<div class="line"><a name="l00801"></a><span class="lineno"> 801</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y + tempy, color);</div>
<div class="line"><a name="l00802"></a><span class="lineno"> 802</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00803"></a><span class="lineno"> 803</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y + tempy, invColor);</div>
<div class="line"><a name="l00804"></a><span class="lineno"> 804</span>  <span class="keywordflow">if</span> (++bit >= w) {</div>
<div class="line"><a name="l00805"></a><span class="lineno"> 805</span>  mask = 0x80;</div>
<div class="line"><a name="l00806"></a><span class="lineno"> 806</span>  line = startLine;</div>
<div class="line"><a name="l00807"></a><span class="lineno"> 807</span>  value = pgm_read_byte(line++);</div>
<div class="line"><a name="l00808"></a><span class="lineno"> 808</span>  bit = 0;</div>
<div class="line"><a name="l00809"></a><span class="lineno"> 809</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00810"></a><span class="lineno"> 810</span>  mask >>= 1;</div>
<div class="line"><a name="l00811"></a><span class="lineno"> 811</span>  <span class="keywordflow">if</span> (!mask) {</div>
<div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  mask = 0x80;</div>
<div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  value = pgm_read_byte(line++);</div>
<div class="line"><a name="l00814"></a><span class="lineno"> 814</span>  }</div>
<div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  }</div>
<div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  }</div>
<div class="line"><a name="l00817"></a><span class="lineno"> 817</span>  }</div>
<div class="line"><a name="l00818"></a><span class="lineno"> 818</span> }</div>
<div class="line"><a name="l00819"></a><span class="lineno"> 819</span> </div>
<div class="line"><a name="l00841"></a><span class="lineno"><a class="code" href="classBitmap.html#af79ad4432297ff453fddc55625fec485"> 841</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#ae08eb6f9086f9923d8dc83a469ae4c4a" title="Scrolls the entire contents of the bitmap by dx and dy.">Bitmap::scroll</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">int</span> dx, <span class="keywordtype">int</span> dy, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> fillColor)</div>
<div class="line"><a name="l00842"></a><span class="lineno"> 842</span> {</div>
<div class="line"><a name="l00843"></a><span class="lineno"> 843</span>  <span class="comment">// Bail out if no scrolling at all.</span></div>
<div class="line"><a name="l00844"></a><span class="lineno"> 844</span>  <span class="keywordflow">if</span> (!dx && !dy)</div>
<div class="line"><a name="l00845"></a><span class="lineno"> 845</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00846"></a><span class="lineno"> 846</span> </div>
<div class="line"><a name="l00847"></a><span class="lineno"> 847</span>  <span class="comment">// Clamp the scroll region to the extents of the bitmap.</span></div>
<div class="line"><a name="l00848"></a><span class="lineno"> 848</span>  <span class="keywordflow">if</span> (x < 0) {</div>
<div class="line"><a name="l00849"></a><span class="lineno"> 849</span>  width += x;</div>
<div class="line"><a name="l00850"></a><span class="lineno"> 850</span>  x = 0;</div>
<div class="line"><a name="l00851"></a><span class="lineno"> 851</span>  }</div>
<div class="line"><a name="l00852"></a><span class="lineno"> 852</span>  <span class="keywordflow">if</span> (y < 0) {</div>
<div class="line"><a name="l00853"></a><span class="lineno"> 853</span>  height += y;</div>
<div class="line"><a name="l00854"></a><span class="lineno"> 854</span>  y = 0;</div>
<div class="line"><a name="l00855"></a><span class="lineno"> 855</span>  }</div>
<div class="line"><a name="l00856"></a><span class="lineno"> 856</span>  <span class="keywordflow">if</span> ((x + width) > _width)</div>
<div class="line"><a name="l00857"></a><span class="lineno"> 857</span>  width = _width - x;</div>
<div class="line"><a name="l00858"></a><span class="lineno"> 858</span>  <span class="keywordflow">if</span> ((y + height) > _height)</div>
<div class="line"><a name="l00859"></a><span class="lineno"> 859</span>  height = _height - y;</div>
<div class="line"><a name="l00860"></a><span class="lineno"> 860</span>  <span class="keywordflow">if</span> (width <= 0 || height <= 0)</div>
<div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00862"></a><span class="lineno"> 862</span> </div>
<div class="line"><a name="l00863"></a><span class="lineno"> 863</span>  <span class="comment">// Scroll the region in the specified direction.</span></div>
<div class="line"><a name="l00864"></a><span class="lineno"> 864</span>  <span class="keywordflow">if</span> (dy < 0) {</div>
<div class="line"><a name="l00865"></a><span class="lineno"> 865</span>  <span class="keywordflow">if</span> (dx < 0)</div>
<div class="line"><a name="l00866"></a><span class="lineno"> 866</span>  blit(x - dx, y - dy, x + width - 1 + dx, y + height - 1 + dy, x, y);</div>
<div class="line"><a name="l00867"></a><span class="lineno"> 867</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00868"></a><span class="lineno"> 868</span>  blit(x, y - dy, x + width - 1 - dx, y + height - 1 + dy, x + dx, y);</div>
<div class="line"><a name="l00869"></a><span class="lineno"> 869</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00870"></a><span class="lineno"> 870</span>  <span class="keywordflow">if</span> (dx < 0)</div>
<div class="line"><a name="l00871"></a><span class="lineno"> 871</span>  blit(x - dx, y, x + width - 1 + dx, y + height - 1 - dy, x, y + dy);</div>
<div class="line"><a name="l00872"></a><span class="lineno"> 872</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00873"></a><span class="lineno"> 873</span>  blit(x, y, x + width - 1 - dx, y + height - 1 - dy, x + dx, y + dy);</div>
<div class="line"><a name="l00874"></a><span class="lineno"> 874</span>  }</div>
<div class="line"><a name="l00875"></a><span class="lineno"> 875</span> </div>
<div class="line"><a name="l00876"></a><span class="lineno"> 876</span>  <span class="comment">// Fill the pixels that were uncovered by the scroll.</span></div>
<div class="line"><a name="l00877"></a><span class="lineno"> 877</span>  <span class="keywordflow">if</span> (dy < 0) {</div>
<div class="line"><a name="l00878"></a><span class="lineno"> 878</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y + height + dy, width, -dy, fillColor);</div>
<div class="line"><a name="l00879"></a><span class="lineno"> 879</span>  <span class="keywordflow">if</span> (dx < 0)</div>
<div class="line"><a name="l00880"></a><span class="lineno"> 880</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x + width + dx, y, -dx, height + dy, fillColor);</div>
<div class="line"><a name="l00881"></a><span class="lineno"> 881</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx > 0)</div>
<div class="line"><a name="l00882"></a><span class="lineno"> 882</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, dx, height + dy, fillColor);</div>
<div class="line"><a name="l00883"></a><span class="lineno"> 883</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dy > 0) {</div>
<div class="line"><a name="l00884"></a><span class="lineno"> 884</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, width, -dy, fillColor);</div>
<div class="line"><a name="l00885"></a><span class="lineno"> 885</span>  <span class="keywordflow">if</span> (dx < 0)</div>
<div class="line"><a name="l00886"></a><span class="lineno"> 886</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x + width + dx, y + dy, -dx, height - dy, fillColor);</div>
<div class="line"><a name="l00887"></a><span class="lineno"> 887</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx > 0)</div>
<div class="line"><a name="l00888"></a><span class="lineno"> 888</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y + dy, dx, height - dy, fillColor);</div>
<div class="line"><a name="l00889"></a><span class="lineno"> 889</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx < 0) {</div>
<div class="line"><a name="l00890"></a><span class="lineno"> 890</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x + width + dx, y, -dx, height, fillColor);</div>
<div class="line"><a name="l00891"></a><span class="lineno"> 891</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx > 0) {</div>
<div class="line"><a name="l00892"></a><span class="lineno"> 892</span>  <a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2" title="Fills the width x height pixels starting at top-left corner (x, y) with color.">fill</a>(x, y, dx, height, fillColor);</div>
<div class="line"><a name="l00893"></a><span class="lineno"> 893</span>  }</div>
<div class="line"><a name="l00894"></a><span class="lineno"> 894</span> }</div>
<div class="line"><a name="l00895"></a><span class="lineno"> 895</span> </div>
<div class="line"><a name="l00902"></a><span class="lineno"><a class="code" href="classBitmap.html#a6d85556bcc9fac91d33f0f6f7a6430dd"> 902</a></span> <span class="keywordtype">void</span> <a class="code" href="classBitmap.html#a6d85556bcc9fac91d33f0f6f7a6430dd" title="Inverts the width x height pixels starting at top-left corner (x, y).">Bitmap::invert</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height)</div>
<div class="line"><a name="l00903"></a><span class="lineno"> 903</span> {</div>
<div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  <span class="keywordflow">while</span> (height > 0) {</div>
<div class="line"><a name="l00905"></a><span class="lineno"> 905</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x + width - 1; tempx >= x; --tempx)</div>
<div class="line"><a name="l00906"></a><span class="lineno"> 906</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(tempx, y, !<a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203" title="Returns the color of the pixel at (x, y); either Black or White.">pixel</a>(tempx, y));</div>
<div class="line"><a name="l00907"></a><span class="lineno"> 907</span>  --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;</div>
<div class="line"><a name="l00908"></a><span class="lineno"> 908</span>  ++y;</div>
<div class="line"><a name="l00909"></a><span class="lineno"> 909</span>  }</div>
<div class="line"><a name="l00910"></a><span class="lineno"> 910</span> }</div>
<div class="line"><a name="l00911"></a><span class="lineno"> 911</span> </div>
<div class="line"><a name="l00912"></a><span class="lineno"> 912</span> <span class="keywordtype">void</span> Bitmap::blit(<span class="keywordtype">int</span> x1, <span class="keywordtype">int</span> y1, <span class="keywordtype">int</span> x2, <span class="keywordtype">int</span> y2, <span class="keywordtype">int</span> x3, <span class="keywordtype">int</span> y3)</div>
<div class="line"><a name="l00913"></a><span class="lineno"> 913</span> {</div>
<div class="line"><a name="l00914"></a><span class="lineno"> 914</span>  <span class="keywordflow">if</span> (y3 < y1 || (y1 == y3 && x3 <= x1)) {</div>
<div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = y1; tempy <= y2; ++tempy) {</div>
<div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <span class="keywordtype">int</span> y = y1 - tempy + y3;</div>
<div class="line"><a name="l00917"></a><span class="lineno"> 917</span>  <span class="keywordtype">int</span> x = x3 - x1;</div>
<div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x1; tempx <= x2; ++tempx)</div>
<div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y, <a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203" title="Returns the color of the pixel at (x, y); either Black or White.">pixel</a>(tempx, tempy));</div>
<div class="line"><a name="l00920"></a><span class="lineno"> 920</span>  }</div>
<div class="line"><a name="l00921"></a><span class="lineno"> 921</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = y2; tempy >= y1; --tempy) {</div>
<div class="line"><a name="l00923"></a><span class="lineno"> 923</span>  <span class="keywordtype">int</span> y = y1 - tempy + y3;</div>
<div class="line"><a name="l00924"></a><span class="lineno"> 924</span>  <span class="keywordtype">int</span> x = x3 - x1;</div>
<div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x2; tempx >= x1; --tempx)</div>
<div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y, <a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203" title="Returns the color of the pixel at (x, y); either Black or White.">pixel</a>(tempx, tempy));</div>
<div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  }</div>
<div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  }</div>
<div class="line"><a name="l00929"></a><span class="lineno"> 929</span> }</div>
<div class="line"><a name="l00930"></a><span class="lineno"> 930</span> </div>
<div class="line"><a name="l00931"></a><span class="lineno"> 931</span> <span class="keywordtype">void</span> Bitmap::drawCirclePoints(<span class="keywordtype">int</span> centerX, <span class="keywordtype">int</span> centerY, <span class="keywordtype">int</span> radius, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, Color borderColor, Color fillColor)</div>
<div class="line"><a name="l00932"></a><span class="lineno"> 932</span> {</div>
<div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  <span class="keywordflow">if</span> (x != y) {</div>
<div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY + y, borderColor);</div>
<div class="line"><a name="l00935"></a><span class="lineno"> 935</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY + x, borderColor);</div>
<div class="line"><a name="l00936"></a><span class="lineno"> 936</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY - x, borderColor);</div>
<div class="line"><a name="l00937"></a><span class="lineno"> 937</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY - y, borderColor);</div>
<div class="line"><a name="l00938"></a><span class="lineno"> 938</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY - y, borderColor);</div>
<div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY - x, borderColor);</div>
<div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY + x, borderColor);</div>
<div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY + y, borderColor);</div>
<div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  <span class="keywordflow">if</span> (fillColor != <a class="code" href="classBitmap.html#aa89170263dc1f51f6366c1907119715e" title="Special color value that is used with drawRect() and drawCircle() to indicate that the interior of th...">NoFill</a>) {</div>
<div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <span class="keywordflow">if</span> (radius > 1) {</div>
<div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - x + 1, centerY + y, centerX + x - 1, centerY + y, fillColor);</div>
<div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - y + 1, centerY + x, centerX + y - 1, centerY + x, fillColor);</div>
<div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - x + 1, centerY - y, centerX + x - 1, centerY - y, fillColor);</div>
<div class="line"><a name="l00947"></a><span class="lineno"> 947</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - y + 1, centerY - x, centerX + y - 1, centerY - x, fillColor);</div>
<div class="line"><a name="l00948"></a><span class="lineno"> 948</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (radius == 1) {</div>
<div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX, centerY, fillColor);</div>
<div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  }</div>
<div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  }</div>
<div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00953"></a><span class="lineno"> 953</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY + y, borderColor);</div>
<div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY - x, borderColor);</div>
<div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY - y, borderColor);</div>
<div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY + x, borderColor);</div>
<div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  <span class="keywordflow">if</span> (fillColor != <a class="code" href="classBitmap.html#aa89170263dc1f51f6366c1907119715e" title="Special color value that is used with drawRect() and drawCircle() to indicate that the interior of th...">NoFill</a>) {</div>
<div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">if</span> (radius > 1) {</div>
<div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - x + 1, centerY + y, centerX + x - 1, centerY + y, fillColor);</div>
<div class="line"><a name="l00960"></a><span class="lineno"> 960</span>  <a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767" title="Draws a line from (x1, y1) to (x2, y2) in color.">drawLine</a>(centerX - x + 1, centerY - y, centerX + x - 1, centerY - y, fillColor);</div>
<div class="line"><a name="l00961"></a><span class="lineno"> 961</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (radius == 1) {</div>
<div class="line"><a name="l00962"></a><span class="lineno"> 962</span>  <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX, centerY, fillColor);</div>
<div class="line"><a name="l00963"></a><span class="lineno"> 963</span>  }</div>
<div class="line"><a name="l00964"></a><span class="lineno"> 964</span>  }</div>
<div class="line"><a name="l00965"></a><span class="lineno"> 965</span>  }</div>
<div class="line"><a name="l00966"></a><span class="lineno"> 966</span> }</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 29 2013 09:30:46 for ArduinoLibs by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>