1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
arduinolibs/Bitmap_8cpp_source.html
Rhys Weatherley bf683c08fb Update docs
2012-05-30 15:44:53 +10:00

659 lines
70 KiB
HTML

<!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"/>
<title>ArduinoLibs: Bitmap.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<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>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;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 id="searchli">
<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&#160;List</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Bitmap.cpp</div> </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2012 Southern Storm Software, Pty Ltd.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span>
<a name="l00005"></a>00005 <span class="comment"> * copy of this software and associated documentation files (the &quot;Software&quot;),</span>
<a name="l00006"></a>00006 <span class="comment"> * to deal in the Software without restriction, including without limitation</span>
<a name="l00007"></a>00007 <span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span>
<a name="l00008"></a>00008 <span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span>
<a name="l00009"></a>00009 <span class="comment"> * Software is furnished to do so, subject to the following conditions:</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * The above copyright notice and this permission notice shall be included</span>
<a name="l00012"></a>00012 <span class="comment"> * in all copies or substantial portions of the Software.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS</span>
<a name="l00015"></a>00015 <span class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
<a name="l00016"></a>00016 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span>
<a name="l00017"></a>00017 <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
<a name="l00018"></a>00018 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
<a name="l00019"></a>00019 <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
<a name="l00020"></a>00020 <span class="comment"> * DEALINGS IN THE SOFTWARE.</span>
<a name="l00021"></a>00021 <span class="comment"> */</span>
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;Bitmap.h&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;WString.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00027"></a>00027
<a name="l00078"></a><a class="code" href="classBitmap.html#a40526748415c8bbc58a8510d636c20f4">00078</a> <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)
<a name="l00079"></a>00079 : _width(width)
<a name="l00080"></a>00080 , _height(height)
<a name="l00081"></a>00081 , _stride((width + 7) / 8)
<a name="l00082"></a>00082 , fb(0)
<a name="l00083"></a>00083 , _font(0)
<a name="l00084"></a>00084 , _textColor(White)
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086 <span class="comment">// Allocate memory for the framebuffer and clear it (1 = pixel off).</span>
<a name="l00087"></a>00087 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size = _stride * _height;
<a name="l00088"></a>00088 fb = (uint8_t *)malloc(size);
<a name="l00089"></a>00089 <span class="keywordflow">if</span> (fb)
<a name="l00090"></a>00090 memset(fb, 0xFF, size);
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092
<a name="l00096"></a><a class="code" href="classBitmap.html#a72d2a301ec1eb1c8d0f3d64823659a8e">00096</a> <a class="code" href="classBitmap.html#a72d2a301ec1eb1c8d0f3d64823659a8e" title="Destroys this bitmap.">Bitmap::~Bitmap</a>()
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098 <span class="keywordflow">if</span> (fb)
<a name="l00099"></a>00099 free(fb);
<a name="l00100"></a>00100 }
<a name="l00101"></a>00101
<a name="l00164"></a><a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1">00164</a> <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)
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size = _stride * _height;
<a name="l00167"></a>00167 <span class="keywordflow">if</span> (color == <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to &quot;black&quot;.">Black</a>)
<a name="l00168"></a>00168 memset(fb, 0xFF, size);
<a name="l00169"></a>00169 <span class="keywordflow">else</span>
<a name="l00170"></a>00170 memset(fb, 0x00, size);
<a name="l00171"></a>00171 }
<a name="l00172"></a>00172
<a name="l00181"></a><a class="code" href="classBitmap.html#a35aa38b377d509d6c4f061a0b988d203">00181</a> <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>
<a name="l00182"></a>00182 <span class="keyword"></span>{
<a name="l00183"></a>00183 <span class="keywordflow">if</span> (((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)x) &gt;= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_width) ||
<a name="l00184"></a>00184 ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)y) &gt;= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_height))
<a name="l00185"></a>00185 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to &quot;black&quot;.">Black</a>;
<a name="l00186"></a>00186 uint8_t *ptr = fb + y * _stride + (x &gt;&gt; 3);
<a name="l00187"></a>00187 <span class="keywordflow">if</span> (*ptr &amp; ((uint8_t)0x80) &gt;&gt; (x &amp; 0x07))
<a name="l00188"></a>00188 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a2c7faeeb89d3624b5bbca58871785adc" title="Color value corresponding to &quot;black&quot;.">Black</a>;
<a name="l00189"></a>00189 <span class="keywordflow">else</span>
<a name="l00190"></a>00190 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a39b6754cfe50a457bbfdb1980fd87eb7" title="Color value corresponding to &quot;white&quot;. If the bitmap is displayed on a LED array, then it may have a d...">White</a>;
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192
<a name="l00198"></a><a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114">00198</a> <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)
<a name="l00199"></a>00199 {
<a name="l00200"></a>00200 <span class="keywordflow">if</span> (((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)x) &gt;= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_width) ||
<a name="l00201"></a>00201 ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)y) &gt;= ((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)_height))
<a name="l00202"></a>00202 <span class="keywordflow">return</span>; <span class="comment">// Pixel is off-screen.</span>
<a name="l00203"></a>00203 uint8_t *ptr = fb + y * _stride + (x &gt;&gt; 3);
<a name="l00204"></a>00204 <span class="keywordflow">if</span> (color)
<a name="l00205"></a>00205 *ptr &amp;= ~(((uint8_t)0x80) &gt;&gt; (x &amp; 0x07));
<a name="l00206"></a>00206 <span class="keywordflow">else</span>
<a name="l00207"></a>00207 *ptr |= (((uint8_t)0x80) &gt;&gt; (x &amp; 0x07));
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209
<a name="l00215"></a><a class="code" href="classBitmap.html#aa0a84f3694e343d68e7021552c69f767">00215</a> <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)
<a name="l00216"></a>00216 {
<a name="l00217"></a>00217 <span class="comment">// Midpoint line scan-conversion algorithm from &quot;Computer Graphics:</span>
<a name="l00218"></a>00218 <span class="comment">// Principles and Practice&quot;, Second Edition, Foley, van Dam, et al.</span>
<a name="l00219"></a>00219 <span class="keywordtype">int</span> dx = x2 - x1;
<a name="l00220"></a>00220 <span class="keywordtype">int</span> dy = y2 - y1;
<a name="l00221"></a>00221 <span class="keywordtype">int</span> xstep, ystep;
<a name="l00222"></a>00222 <span class="keywordtype">int</span> d, incrE, incrNE;
<a name="l00223"></a>00223 <span class="keywordflow">if</span> (dx &lt; 0) {
<a name="l00224"></a>00224 xstep = -1;
<a name="l00225"></a>00225 dx = -dx;
<a name="l00226"></a>00226 } <span class="keywordflow">else</span> {
<a name="l00227"></a>00227 xstep = 1;
<a name="l00228"></a>00228 }
<a name="l00229"></a>00229 <span class="keywordflow">if</span> (dy &lt; 0) {
<a name="l00230"></a>00230 ystep = -1;
<a name="l00231"></a>00231 dy = -dy;
<a name="l00232"></a>00232 } <span class="keywordflow">else</span> {
<a name="l00233"></a>00233 ystep = 1;
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 <span class="keywordflow">if</span> (dx &gt;= dy) {
<a name="l00236"></a>00236 d = 2 * dy - dx;
<a name="l00237"></a>00237 incrE = 2 * dy;
<a name="l00238"></a>00238 incrNE = 2 * (dy - dx);
<a name="l00239"></a>00239 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);
<a name="l00240"></a>00240 <span class="keywordflow">while</span> (x1 != x2) {
<a name="l00241"></a>00241 <span class="keywordflow">if</span> (d &lt;= 0) {
<a name="l00242"></a>00242 d += incrE;
<a name="l00243"></a>00243 } <span class="keywordflow">else</span> {
<a name="l00244"></a>00244 d += incrNE;
<a name="l00245"></a>00245 y1 += ystep;
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 x1 += xstep;
<a name="l00248"></a>00248 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250 } <span class="keywordflow">else</span> {
<a name="l00251"></a>00251 d = 2 * dx - dy;
<a name="l00252"></a>00252 incrE = 2 * dx;
<a name="l00253"></a>00253 incrNE = 2 * (dx - dy);
<a name="l00254"></a>00254 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);
<a name="l00255"></a>00255 <span class="keywordflow">while</span> (y1 != y2) {
<a name="l00256"></a>00256 <span class="keywordflow">if</span> (d &lt;= 0) {
<a name="l00257"></a>00257 d += incrE;
<a name="l00258"></a>00258 } <span class="keywordflow">else</span> {
<a name="l00259"></a>00259 d += incrNE;
<a name="l00260"></a>00260 x1 += xstep;
<a name="l00261"></a>00261 }
<a name="l00262"></a>00262 y1 += ystep;
<a name="l00263"></a>00263 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x1, y1, color);
<a name="l00264"></a>00264 }
<a name="l00265"></a>00265 }
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267
<a name="l00276"></a><a class="code" href="classBitmap.html#aac61e3f7f625db568e37d88b52b3b2fc">00276</a> <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)
<a name="l00277"></a>00277 {
<a name="l00278"></a>00278 <span class="keywordtype">int</span> temp;
<a name="l00279"></a>00279 <span class="keywordflow">if</span> (x1 &gt; x2) {
<a name="l00280"></a>00280 temp = x1;
<a name="l00281"></a>00281 x1 = x2;
<a name="l00282"></a>00282 x2 = temp;
<a name="l00283"></a>00283 }
<a name="l00284"></a>00284 <span class="keywordflow">if</span> (y1 &gt; y2) {
<a name="l00285"></a>00285 temp = y1;
<a name="l00286"></a>00286 y1 = y2;
<a name="l00287"></a>00287 y2 = temp;
<a name="l00288"></a>00288 }
<a name="l00289"></a>00289 <span class="keywordflow">if</span> (fillColor == borderColor) {
<a name="l00290"></a>00290 <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);
<a name="l00291"></a>00291 } <span class="keywordflow">else</span> {
<a name="l00292"></a>00292 <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);
<a name="l00293"></a>00293 <span class="keywordflow">if</span> (y1 &lt; y2)
<a name="l00294"></a>00294 <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);
<a name="l00295"></a>00295 <span class="keywordflow">if</span> (x1 &lt; x2)
<a name="l00296"></a>00296 <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);
<a name="l00297"></a>00297 <span class="keywordflow">if</span> (y1 &lt; (y2 - 1))
<a name="l00298"></a>00298 <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);
<a name="l00299"></a>00299 <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>)
<a name="l00300"></a>00300 <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);
<a name="l00301"></a>00301 }
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303
<a name="l00324"></a><a class="code" href="classBitmap.html#a933763a4f3cba79fbcf97ae6d0a864aa">00324</a> <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)
<a name="l00325"></a>00325 {
<a name="l00326"></a>00326 <span class="comment">// Midpoint circle scan-conversion algorithm using second-order</span>
<a name="l00327"></a>00327 <span class="comment">// differences from &quot;Computer Graphics: Principles and Practice&quot;,</span>
<a name="l00328"></a>00328 <span class="comment">// Second Edition, Foley, van Dam, et al.</span>
<a name="l00329"></a>00329 <span class="keywordflow">if</span> (radius &lt; 0)
<a name="l00330"></a>00330 radius = -radius;
<a name="l00331"></a>00331 <span class="keywordtype">int</span> x = 0;
<a name="l00332"></a>00332 <span class="keywordtype">int</span> y = radius;
<a name="l00333"></a>00333 <span class="keywordtype">int</span> d = 1 - radius;
<a name="l00334"></a>00334 <span class="keywordtype">int</span> deltaE = 3;
<a name="l00335"></a>00335 <span class="keywordtype">int</span> deltaSE = 5 - 2 * radius;
<a name="l00336"></a>00336 drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);
<a name="l00337"></a>00337 <span class="keywordflow">while</span> (y &gt; x) {
<a name="l00338"></a>00338 <span class="keywordflow">if</span> (d &lt; 0) {
<a name="l00339"></a>00339 d += deltaE;
<a name="l00340"></a>00340 deltaE += 2;
<a name="l00341"></a>00341 deltaSE += 2;
<a name="l00342"></a>00342 } <span class="keywordflow">else</span> {
<a name="l00343"></a>00343 d += deltaSE;
<a name="l00344"></a>00344 deltaE += 2;
<a name="l00345"></a>00345 deltaSE += 4;
<a name="l00346"></a>00346 --y;
<a name="l00347"></a>00347 }
<a name="l00348"></a>00348 ++x;
<a name="l00349"></a>00349 drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 }
<a name="l00352"></a>00352
<a name="l00378"></a><a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72">00378</a> <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> &amp;bitmap, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380 <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>();
<a name="l00381"></a>00381 <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&#39;s data() buffer.">stride</a>();
<a name="l00382"></a>00382 <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>();
<a name="l00383"></a>00383 <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;
<a name="l00384"></a>00384 <span class="keywordflow">for</span> (uint8_t by = 0; by &lt; h; ++by) {
<a name="l00385"></a>00385 <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&#39;s data buffer.">data</a>() + by * s;
<a name="l00386"></a>00386 uint8_t mask = 0x80;
<a name="l00387"></a>00387 uint8_t value = *line++;
<a name="l00388"></a>00388 <span class="keywordflow">for</span> (uint8_t bx = 0; bx &lt; w; ++bx) {
<a name="l00389"></a>00389 <span class="keywordflow">if</span> (value &amp; mask)
<a name="l00390"></a>00390 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, invColor);
<a name="l00391"></a>00391 <span class="keywordflow">else</span>
<a name="l00392"></a>00392 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, color);
<a name="l00393"></a>00393 mask &gt;&gt;= 1;
<a name="l00394"></a>00394 <span class="keywordflow">if</span> (!mask) {
<a name="l00395"></a>00395 mask = 0x80;
<a name="l00396"></a>00396 value = *line++;
<a name="l00397"></a>00397 }
<a name="l00398"></a>00398 }
<a name="l00399"></a>00399 }
<a name="l00400"></a>00400 }
<a name="l00401"></a>00401
<a name="l00415"></a><a class="code" href="classBitmap.html#aa4089d785c59f16dcf0505ec04b4e658">00415</a> <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> prog_uint8_t *bitmap, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)
<a name="l00416"></a>00416 {
<a name="l00417"></a>00417 uint8_t w = pgm_read_byte(bitmap);
<a name="l00418"></a>00418 uint8_t s = (w + 7) &gt;&gt; 3;
<a name="l00419"></a>00419 uint8_t h = pgm_read_byte(bitmap + 1);
<a name="l00420"></a>00420 <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;
<a name="l00421"></a>00421 <span class="keywordflow">for</span> (uint8_t by = 0; by &lt; h; ++by) {
<a name="l00422"></a>00422 <span class="keyword">const</span> prog_uint8_t *line = bitmap + 2 + by * s;
<a name="l00423"></a>00423 uint8_t mask = 0x80;
<a name="l00424"></a>00424 uint8_t value = pgm_read_byte(line);
<a name="l00425"></a>00425 <span class="keywordflow">for</span> (uint8_t bx = 0; bx &lt; w; ++bx) {
<a name="l00426"></a>00426 <span class="keywordflow">if</span> (value &amp; mask)
<a name="l00427"></a>00427 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, color);
<a name="l00428"></a>00428 <span class="keywordflow">else</span>
<a name="l00429"></a>00429 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + bx, y + by, invColor);
<a name="l00430"></a>00430 mask &gt;&gt;= 1;
<a name="l00431"></a>00431 <span class="keywordflow">if</span> (!mask) {
<a name="l00432"></a>00432 mask = 0x80;
<a name="l00433"></a>00433 ++line;
<a name="l00434"></a>00434 value = pgm_read_byte(line);
<a name="l00435"></a>00435 }
<a name="l00436"></a>00436 }
<a name="l00437"></a>00437 }
<a name="l00438"></a>00438 }
<a name="l00439"></a>00439
<a name="l00499"></a>00499 <span class="preprocessor">#define fontIsFixed(font) (pgm_read_byte((font)) == 0 &amp;&amp; \</span>
<a name="l00500"></a>00500 <span class="preprocessor"> pgm_read_byte((font) + 1) == 0)</span>
<a name="l00501"></a>00501 <span class="preprocessor"></span><span class="preprocessor">#define fontWidth(font) (pgm_read_byte((font) + 2))</span>
<a name="l00502"></a>00502 <span class="preprocessor"></span><span class="preprocessor">#define fontHeight(font) (pgm_read_byte((font) + 3))</span>
<a name="l00503"></a>00503 <span class="preprocessor"></span><span class="preprocessor">#define fontFirstChar(font) (pgm_read_byte((font) + 4))</span>
<a name="l00504"></a>00504 <span class="preprocessor"></span><span class="preprocessor">#define fontCharCount(font) (pgm_read_byte((font) + 5))</span>
<a name="l00505"></a>00505 <span class="preprocessor"></span>
<a name="l00516"></a><a class="code" href="classBitmap.html#a3e9bcbfb584d5020bd6f0a313ee275f0">00516</a> <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)
<a name="l00517"></a>00517 {
<a name="l00518"></a>00518 <span class="keywordflow">if</span> (!_font)
<a name="l00519"></a>00519 <span class="keywordflow">return</span>;
<a name="l00520"></a>00520 uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);
<a name="l00521"></a>00521 <span class="keywordflow">if</span> (len &lt; 0)
<a name="l00522"></a>00522 len = strlen(str);
<a name="l00523"></a>00523 <span class="keywordflow">while</span> (len-- &gt; 0) {
<a name="l00524"></a>00524 x += <a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd" title="Draws a single character ch at (x, y).">drawChar</a>(x, y, *str++);
<a name="l00525"></a>00525 <span class="keywordflow">if</span> (len &gt; 0) {
<a name="l00526"></a>00526 <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);
<a name="l00527"></a>00527 ++x;
<a name="l00528"></a>00528 }
<a name="l00529"></a>00529 <span class="keywordflow">if</span> (x &gt;= _width)
<a name="l00530"></a>00530 <span class="keywordflow">break</span>;
<a name="l00531"></a>00531 }
<a name="l00532"></a>00532 }
<a name="l00533"></a>00533
<a name="l00545"></a><a class="code" href="classBitmap.html#a802f5d6bd19a3727670e61e7a88a0cac">00545</a> <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 &amp;str, <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> len)
<a name="l00546"></a>00546 {
<a name="l00547"></a>00547 <span class="keywordflow">if</span> (!_font)
<a name="l00548"></a>00548 <span class="keywordflow">return</span>;
<a name="l00549"></a>00549 uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);
<a name="l00550"></a>00550 <span class="keywordflow">if</span> (len &lt; 0)
<a name="l00551"></a>00551 len = str.length() - start;
<a name="l00552"></a>00552 <span class="keywordflow">while</span> (len-- &gt; 0) {
<a name="l00553"></a>00553 x += <a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd" title="Draws a single character ch at (x, y).">drawChar</a>(x, y, str[start++]);
<a name="l00554"></a>00554 <span class="keywordflow">if</span> (len &gt; 0) {
<a name="l00555"></a>00555 <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);
<a name="l00556"></a>00556 ++x;
<a name="l00557"></a>00557 }
<a name="l00558"></a>00558 <span class="keywordflow">if</span> (x &gt;= _width)
<a name="l00559"></a>00559 <span class="keywordflow">break</span>;
<a name="l00560"></a>00560 }
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562
<a name="l00575"></a><a class="code" href="classBitmap.html#a1a11f29863ee7f36a3b15c91963102bd">00575</a> <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)
<a name="l00576"></a>00576 {
<a name="l00577"></a>00577 uint8_t <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a> = fontHeight(_font);
<a name="l00578"></a>00578 <span class="keywordflow">if</span> (ch == <span class="charliteral">&#39; &#39;</span>) {
<a name="l00579"></a>00579 <span class="comment">// Font may not have space, or it is zero-width. Calculate</span>
<a name="l00580"></a>00580 <span class="comment">// the real size and fill the space.</span>
<a name="l00581"></a>00581 <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">&#39;n&#39;</span>);
<a name="l00582"></a>00582 <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);
<a name="l00583"></a>00583 <span class="keywordflow">return</span> spaceWidth;
<a name="l00584"></a>00584 }
<a name="l00585"></a>00585 uint8_t first = fontFirstChar(_font);
<a name="l00586"></a>00586 uint8_t count = fontCharCount(_font);
<a name="l00587"></a>00587 uint8_t index = (uint8_t)ch;
<a name="l00588"></a>00588 <span class="keywordflow">if</span> (index &lt; first || index &gt;= (first + count))
<a name="l00589"></a>00589 <span class="keywordflow">return</span> 0;
<a name="l00590"></a>00590 index -= first;
<a name="l00591"></a>00591 uint8_t heightBytes = (height + 7) &gt;&gt; 3;;
<a name="l00592"></a>00592 uint8_t <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00593"></a>00593 <span class="keyword">const</span> prog_uint8_t *image;
<a name="l00594"></a>00594 <span class="keywordflow">if</span> (fontIsFixed(_font)) {
<a name="l00595"></a>00595 <span class="comment">// Fixed-width font.</span>
<a name="l00596"></a>00596 width = fontWidth(_font);
<a name="l00597"></a>00597 image = _font + 6 + index * heightBytes * <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00598"></a>00598 } <span class="keywordflow">else</span> {
<a name="l00599"></a>00599 <span class="comment">// Variable-width font.</span>
<a name="l00600"></a>00600 width = pgm_read_byte(_font + 6 + index);
<a name="l00601"></a>00601 image = _font + 6 + count;
<a name="l00602"></a>00602 <span class="keywordflow">for</span> (uint8_t temp = 0; temp &lt; index; ++temp) {
<a name="l00603"></a>00603 <span class="comment">// Scan through all previous characters to find the starting</span>
<a name="l00604"></a>00604 <span class="comment">// location for this one.</span>
<a name="l00605"></a>00605 image += pgm_read_byte(_font + 6 + temp) * heightBytes;
<a name="l00606"></a>00606 }
<a name="l00607"></a>00607 }
<a name="l00608"></a>00608 <span class="keywordflow">if</span> ((x + width) &lt;= 0 || (y + height) &lt;= 0)
<a name="l00609"></a>00609 <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>
<a name="l00610"></a>00610 <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !_textColor;
<a name="l00611"></a>00611 <span class="keywordflow">for</span> (uint8_t cx = 0; cx &lt; <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++cx) {
<a name="l00612"></a>00612 <span class="keywordflow">for</span> (uint8_t cy = 0; cy &lt; heightBytes; ++cy) {
<a name="l00613"></a>00613 uint8_t value = pgm_read_byte(image + cy * width + cx);
<a name="l00614"></a>00614 <span class="keywordtype">int</span> posn;
<a name="l00615"></a>00615 <span class="keywordflow">if</span> (heightBytes &gt; 1 &amp;&amp; cy == (heightBytes - 1))
<a name="l00616"></a>00616 posn = height - 8;
<a name="l00617"></a>00617 <span class="keywordflow">else</span>
<a name="l00618"></a>00618 posn = cy * 8;
<a name="l00619"></a>00619 <span class="keywordflow">for</span> (uint8_t bit = 0; bit &lt; 8; ++bit) {
<a name="l00620"></a>00620 <span class="keywordflow">if</span> ((posn + bit) &gt;= (cy * 8) &amp;&amp; (posn + bit) &lt;= height) {
<a name="l00621"></a>00621 <span class="keywordflow">if</span> (value &amp; 0x01)
<a name="l00622"></a>00622 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + cx, y + posn + bit, _textColor);
<a name="l00623"></a>00623 <span class="keywordflow">else</span>
<a name="l00624"></a>00624 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + cx, y + posn + bit, invColor);
<a name="l00625"></a>00625 }
<a name="l00626"></a>00626 value &gt;&gt;= 1;
<a name="l00627"></a>00627 }
<a name="l00628"></a>00628 }
<a name="l00629"></a>00629 }
<a name="l00630"></a>00630 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00631"></a>00631 }
<a name="l00632"></a>00632
<a name="l00640"></a><a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd">00640</a> <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>
<a name="l00641"></a>00641 <span class="keyword"></span>{
<a name="l00642"></a>00642 uint8_t index = (uint8_t)ch;
<a name="l00643"></a>00643 <span class="keywordflow">if</span> (!_font)
<a name="l00644"></a>00644 <span class="keywordflow">return</span> 0;
<a name="l00645"></a>00645 uint8_t first = fontFirstChar(_font);
<a name="l00646"></a>00646 uint8_t count = fontCharCount(_font);
<a name="l00647"></a>00647 <span class="keywordflow">if</span> (index == <span class="charliteral">&#39; &#39;</span>)
<a name="l00648"></a>00648 index = <span class="charliteral">&#39;n&#39;</span>; <span class="comment">// In case the font does not contain space.</span>
<a name="l00649"></a>00649 <span class="keywordflow">if</span> (index &lt; first || index &gt;= (first + count))
<a name="l00650"></a>00650 <span class="keywordflow">return</span> 0;
<a name="l00651"></a>00651 <span class="keywordflow">if</span> (fontIsFixed(_font))
<a name="l00652"></a>00652 <span class="keywordflow">return</span> fontWidth(_font);
<a name="l00653"></a>00653 <span class="keywordflow">else</span>
<a name="l00654"></a>00654 <span class="keywordflow">return</span> pgm_read_byte(_font + 6 + (index - first));
<a name="l00655"></a>00655 }
<a name="l00656"></a>00656
<a name="l00665"></a><a class="code" href="classBitmap.html#a0f7607b1c7867987f4500d490a666e8a">00665</a> <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>
<a name="l00666"></a>00666 <span class="keyword"></span>{
<a name="l00667"></a>00667 <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a> = 0;
<a name="l00668"></a>00668 <span class="keywordflow">if</span> (len &lt; 0)
<a name="l00669"></a>00669 len = strlen(str);
<a name="l00670"></a>00670 <span class="keywordflow">while</span> (len-- &gt; 0) {
<a name="l00671"></a>00671 width += <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">charWidth</a>(*str++);
<a name="l00672"></a>00672 <span class="keywordflow">if</span> (len &gt; 0)
<a name="l00673"></a>00673 ++<a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00674"></a>00674 }
<a name="l00675"></a>00675 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00676"></a>00676 }
<a name="l00677"></a>00677
<a name="l00687"></a><a class="code" href="classBitmap.html#a8ca70aa0f8f722a228358bffe794e925">00687</a> <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 &amp;str, <span class="keywordtype">int</span> start, <span class="keywordtype">int</span> len)<span class="keyword"> const</span>
<a name="l00688"></a>00688 <span class="keyword"></span>{
<a name="l00689"></a>00689 <span class="keywordtype">int</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a> = 0;
<a name="l00690"></a>00690 <span class="keywordflow">if</span> (len &lt; 0)
<a name="l00691"></a>00691 len = str.length() - start;
<a name="l00692"></a>00692 <span class="keywordflow">while</span> (len-- &gt; 0) {
<a name="l00693"></a>00693 width += <a class="code" href="classBitmap.html#a9b79ac13077ca865e4515510297780bd" title="Returns the width in pixels of ch in the current font().">charWidth</a>(str[start++]);
<a name="l00694"></a>00694 <span class="keywordflow">if</span> (len &gt; 0)
<a name="l00695"></a>00695 ++<a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00696"></a>00696 }
<a name="l00697"></a>00697 <span class="keywordflow">return</span> <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>;
<a name="l00698"></a>00698 }
<a name="l00699"></a>00699
<a name="l00706"></a><a class="code" href="classBitmap.html#a628bb694fcfe6eab619a4f1e152d41c4">00706</a> <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>
<a name="l00707"></a>00707 <span class="keyword"></span>{
<a name="l00708"></a>00708 <span class="keywordflow">if</span> (_font)
<a name="l00709"></a>00709 <span class="keywordflow">return</span> fontHeight(_font);
<a name="l00710"></a>00710 <span class="keywordflow">else</span>
<a name="l00711"></a>00711 <span class="keywordflow">return</span> 0;
<a name="l00712"></a>00712 }
<a name="l00713"></a>00713
<a name="l00728"></a><a class="code" href="classBitmap.html#ab22fe1f3871934987a670b559f67c67c">00728</a> <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)
<a name="l00729"></a>00729 {
<a name="l00730"></a>00730 <span class="keywordflow">if</span> (dest == <span class="keyword">this</span>) {
<a name="l00731"></a>00731 <span class="comment">// Copying to within the same bitmap, so copy in a direction</span>
<a name="l00732"></a>00732 <span class="comment">// that will prevent problems with overlap.</span>
<a name="l00733"></a>00733 blit(x, y, x + width - 1, y + height - 1, destX, destY);
<a name="l00734"></a>00734 } <span class="keywordflow">else</span> {
<a name="l00735"></a>00735 <span class="comment">// Copying to a different bitmap.</span>
<a name="l00736"></a>00736 <span class="keywordflow">while</span> (height &gt; 0) {
<a name="l00737"></a>00737 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = 0; tempx &lt; <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++tempx)
<a name="l00738"></a>00738 dest-&gt;<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));
<a name="l00739"></a>00739 ++y;
<a name="l00740"></a>00740 ++destY;
<a name="l00741"></a>00741 --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;
<a name="l00742"></a>00742 }
<a name="l00743"></a>00743 }
<a name="l00744"></a>00744 }
<a name="l00745"></a>00745
<a name="l00752"></a><a class="code" href="classBitmap.html#a99da820f9280aace6b512801d5a5e2b2">00752</a> <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)
<a name="l00753"></a>00753 {
<a name="l00754"></a>00754 <span class="keywordflow">while</span> (height &gt; 0) {
<a name="l00755"></a>00755 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> temp = 0; temp &lt; <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++temp)
<a name="l00756"></a>00756 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + temp, y, color);
<a name="l00757"></a>00757 ++y;
<a name="l00758"></a>00758 --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;
<a name="l00759"></a>00759 }
<a name="l00760"></a>00760 }
<a name="l00761"></a>00761
<a name="l00775"></a><a class="code" href="classBitmap.html#aadcad6c9e1f10f0ddbb789401132aa6f">00775</a> <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, <span class="keyword">const</span> prog_uint8_t *pattern, <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> color)
<a name="l00776"></a>00776 {
<a name="l00777"></a>00777 uint8_t w = pgm_read_byte(pattern);
<a name="l00778"></a>00778 uint8_t s = (w + 7) &gt;&gt; 3;
<a name="l00779"></a>00779 uint8_t h = pgm_read_byte(pattern + 1);
<a name="l00780"></a>00780 <span class="keywordflow">if</span> (!w || !h)
<a name="l00781"></a>00781 <span class="keywordflow">return</span>;
<a name="l00782"></a>00782 <a class="code" href="classBitmap.html#a88d386944a7017aa776a177b10d8b2ba" title="Type that represents the color of a pixel in a bitmap.">Color</a> invColor = !color;
<a name="l00783"></a>00783 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = 0; tempy &lt; <a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>; ++tempy) {
<a name="l00784"></a>00784 <span class="keyword">const</span> prog_uint8_t *startLine = pattern + 2 + (tempy % h) * s;
<a name="l00785"></a>00785 <span class="keyword">const</span> prog_uint8_t *line = startLine;
<a name="l00786"></a>00786 uint8_t mask = 0x80;
<a name="l00787"></a>00787 uint8_t value = pgm_read_byte(line++);
<a name="l00788"></a>00788 <span class="keywordtype">int</span> bit = 0;
<a name="l00789"></a>00789 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = 0; tempx &lt; <a class="code" href="classBitmap.html#a76c3b49e535761f07c553e7336daf523" title="Returns the width of the bitmap in pixels.">width</a>; ++tempx) {
<a name="l00790"></a>00790 <span class="keywordflow">if</span> (value &amp; mask)
<a name="l00791"></a>00791 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y + tempy, color);
<a name="l00792"></a>00792 <span class="keywordflow">else</span>
<a name="l00793"></a>00793 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(x + tempx, y + tempy, invColor);
<a name="l00794"></a>00794 <span class="keywordflow">if</span> (++bit &gt;= w) {
<a name="l00795"></a>00795 mask = 0x80;
<a name="l00796"></a>00796 line = startLine;
<a name="l00797"></a>00797 value = pgm_read_byte(line++);
<a name="l00798"></a>00798 bit = 0;
<a name="l00799"></a>00799 } <span class="keywordflow">else</span> {
<a name="l00800"></a>00800 mask &gt;&gt;= 1;
<a name="l00801"></a>00801 <span class="keywordflow">if</span> (!mask) {
<a name="l00802"></a>00802 mask = 0x80;
<a name="l00803"></a>00803 value = pgm_read_byte(line++);
<a name="l00804"></a>00804 }
<a name="l00805"></a>00805 }
<a name="l00806"></a>00806 }
<a name="l00807"></a>00807 }
<a name="l00808"></a>00808 }
<a name="l00809"></a>00809
<a name="l00831"></a><a class="code" href="classBitmap.html#af79ad4432297ff453fddc55625fec485">00831</a> <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)
<a name="l00832"></a>00832 {
<a name="l00833"></a>00833 <span class="comment">// Bail out if no scrolling at all.</span>
<a name="l00834"></a>00834 <span class="keywordflow">if</span> (!dx &amp;&amp; !dy)
<a name="l00835"></a>00835 <span class="keywordflow">return</span>;
<a name="l00836"></a>00836
<a name="l00837"></a>00837 <span class="comment">// Clamp the scroll region to the extents of the bitmap.</span>
<a name="l00838"></a>00838 <span class="keywordflow">if</span> (x &lt; 0) {
<a name="l00839"></a>00839 width += x;
<a name="l00840"></a>00840 x = 0;
<a name="l00841"></a>00841 }
<a name="l00842"></a>00842 <span class="keywordflow">if</span> (y &lt; 0) {
<a name="l00843"></a>00843 height += y;
<a name="l00844"></a>00844 y = 0;
<a name="l00845"></a>00845 }
<a name="l00846"></a>00846 <span class="keywordflow">if</span> ((x + width) &gt; _width)
<a name="l00847"></a>00847 width = _width - x;
<a name="l00848"></a>00848 <span class="keywordflow">if</span> ((y + height) &gt; _height)
<a name="l00849"></a>00849 height = _height - y;
<a name="l00850"></a>00850 <span class="keywordflow">if</span> (width &lt;= 0 || height &lt;= 0)
<a name="l00851"></a>00851 <span class="keywordflow">return</span>;
<a name="l00852"></a>00852
<a name="l00853"></a>00853 <span class="comment">// Scroll the region in the specified direction.</span>
<a name="l00854"></a>00854 <span class="keywordflow">if</span> (dy &lt; 0) {
<a name="l00855"></a>00855 <span class="keywordflow">if</span> (dx &lt; 0)
<a name="l00856"></a>00856 blit(x - dx, y - dy, x + width - 1 + dx, y + height - 1 + dy, x, y);
<a name="l00857"></a>00857 <span class="keywordflow">else</span>
<a name="l00858"></a>00858 blit(x, y - dy, x + width - 1 - dx, y + height - 1 + dy, x + dx, y);
<a name="l00859"></a>00859 } <span class="keywordflow">else</span> {
<a name="l00860"></a>00860 <span class="keywordflow">if</span> (dx &lt; 0)
<a name="l00861"></a>00861 blit(x - dx, y, x + width - 1 + dx, y + height - 1 - dy, x, y + dy);
<a name="l00862"></a>00862 <span class="keywordflow">else</span>
<a name="l00863"></a>00863 blit(x, y, x + width - 1 - dx, y + height - 1 - dy, x + dx, y + dy);
<a name="l00864"></a>00864 }
<a name="l00865"></a>00865
<a name="l00866"></a>00866 <span class="comment">// Fill the pixels that were uncovered by the scroll.</span>
<a name="l00867"></a>00867 <span class="keywordflow">if</span> (dy &lt; 0) {
<a name="l00868"></a>00868 <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);
<a name="l00869"></a>00869 <span class="keywordflow">if</span> (dx &lt; 0)
<a name="l00870"></a>00870 <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);
<a name="l00871"></a>00871 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx &gt; 0)
<a name="l00872"></a>00872 <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);
<a name="l00873"></a>00873 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dy &gt; 0) {
<a name="l00874"></a>00874 <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);
<a name="l00875"></a>00875 <span class="keywordflow">if</span> (dx &lt; 0)
<a name="l00876"></a>00876 <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);
<a name="l00877"></a>00877 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx &gt; 0)
<a name="l00878"></a>00878 <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);
<a name="l00879"></a>00879 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx &lt; 0) {
<a name="l00880"></a>00880 <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);
<a name="l00881"></a>00881 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dx &gt; 0) {
<a name="l00882"></a>00882 <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);
<a name="l00883"></a>00883 }
<a name="l00884"></a>00884 }
<a name="l00885"></a>00885
<a name="l00892"></a><a class="code" href="classBitmap.html#a6d85556bcc9fac91d33f0f6f7a6430dd">00892</a> <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)
<a name="l00893"></a>00893 {
<a name="l00894"></a>00894 <span class="keywordflow">while</span> (height &gt; 0) {
<a name="l00895"></a>00895 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x + width - 1; tempx &gt;= x; --tempx)
<a name="l00896"></a>00896 <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));
<a name="l00897"></a>00897 --<a class="code" href="classBitmap.html#adcd4e3dc7594421e647b0f52da9a41a3" title="Returns the height of the bitmap in pixels.">height</a>;
<a name="l00898"></a>00898 ++y;
<a name="l00899"></a>00899 }
<a name="l00900"></a>00900 }
<a name="l00901"></a>00901
<a name="l00902"></a>00902 <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)
<a name="l00903"></a>00903 {
<a name="l00904"></a>00904 <span class="keywordflow">if</span> (y3 &lt; y1 || (y1 == y3 &amp;&amp; x3 &lt;= x1)) {
<a name="l00905"></a>00905 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = y1; tempy &lt;= y2; ++tempy) {
<a name="l00906"></a>00906 <span class="keywordtype">int</span> y = y1 - tempy + y3;
<a name="l00907"></a>00907 <span class="keywordtype">int</span> x = x3 - x1;
<a name="l00908"></a>00908 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x1; tempx &lt;= x2; ++tempx)
<a name="l00909"></a>00909 <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));
<a name="l00910"></a>00910 }
<a name="l00911"></a>00911 } <span class="keywordflow">else</span> {
<a name="l00912"></a>00912 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempy = y2; tempy &gt;= y1; --tempy) {
<a name="l00913"></a>00913 <span class="keywordtype">int</span> y = y1 - tempy + y3;
<a name="l00914"></a>00914 <span class="keywordtype">int</span> x = x3 - x1;
<a name="l00915"></a>00915 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> tempx = x2; tempx &gt;= x1; --tempx)
<a name="l00916"></a>00916 <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));
<a name="l00917"></a>00917 }
<a name="l00918"></a>00918 }
<a name="l00919"></a>00919 }
<a name="l00920"></a>00920
<a name="l00921"></a>00921 <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)
<a name="l00922"></a>00922 {
<a name="l00923"></a>00923 <span class="keywordflow">if</span> (x != y) {
<a name="l00924"></a>00924 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY + y, borderColor);
<a name="l00925"></a>00925 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY + x, borderColor);
<a name="l00926"></a>00926 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY - x, borderColor);
<a name="l00927"></a>00927 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY - y, borderColor);
<a name="l00928"></a>00928 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY - y, borderColor);
<a name="l00929"></a>00929 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY - x, borderColor);
<a name="l00930"></a>00930 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY + x, borderColor);
<a name="l00931"></a>00931 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY + y, borderColor);
<a name="l00932"></a>00932 <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>) {
<a name="l00933"></a>00933 <span class="keywordflow">if</span> (radius &gt; 1) {
<a name="l00934"></a>00934 <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);
<a name="l00935"></a>00935 <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);
<a name="l00936"></a>00936 <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);
<a name="l00937"></a>00937 <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);
<a name="l00938"></a>00938 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (radius == 1) {
<a name="l00939"></a>00939 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX, centerY, fillColor);
<a name="l00940"></a>00940 }
<a name="l00941"></a>00941 }
<a name="l00942"></a>00942 } <span class="keywordflow">else</span> {
<a name="l00943"></a>00943 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + x, centerY + y, borderColor);
<a name="l00944"></a>00944 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX + y, centerY - x, borderColor);
<a name="l00945"></a>00945 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - x, centerY - y, borderColor);
<a name="l00946"></a>00946 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX - y, centerY + x, borderColor);
<a name="l00947"></a>00947 <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>) {
<a name="l00948"></a>00948 <span class="keywordflow">if</span> (radius &gt; 1) {
<a name="l00949"></a>00949 <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);
<a name="l00950"></a>00950 <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);
<a name="l00951"></a>00951 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (radius == 1) {
<a name="l00952"></a>00952 <a class="code" href="classBitmap.html#aac994b75418e7d37ec66829437329114" title="Sets the pixel at (x, y) to color.">setPixel</a>(centerX, centerY, fillColor);
<a name="l00953"></a>00953 }
<a name="l00954"></a>00954 }
<a name="l00955"></a>00955 }
<a name="l00956"></a>00956 }
</pre></div></div>
</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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</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>
<hr class="footer"/><address class="footer"><small>Generated on Wed May 30 2012 15:44:33 for ArduinoLibs by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>