<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libg15render: screen.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="contents"> <h1>screen.c File Reference</h1><code>#include "<a class="el" href="libg15render_8h_source.html">libg15render.h</a>"</code><br> <p> <a href="screen_8c_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="screen_8c.html#79439b23f960f2701cd33b24d98adc88">g15r_clearScreen</a> (<a class="el" href="structg15canvas.html">g15canvas</a> *canvas, int color)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Fills the screen with pixels of color. <a href="#79439b23f960f2701cd33b24d98adc88"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="screen_8c.html#b71c2319a2892031f45c7cb685387d76">g15r_getPixel</a> (<a class="el" href="structg15canvas.html">g15canvas</a> *canvas, unsigned int x, unsigned int y)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the value of the pixel at (x, y). <a href="#b71c2319a2892031f45c7cb685387d76"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="screen_8c.html#9fca67171d0100a4bde88a9c8f6023ab">g15r_initCanvas</a> (<a class="el" href="structg15canvas.html">g15canvas</a> *canvas)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Clears the canvas and resets the mode switches. <a href="#9fca67171d0100a4bde88a9c8f6023ab"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="screen_8c.html#55ea1758ff829b3cab04383f8a5eccd4">g15r_setPixel</a> (<a class="el" href="structg15canvas.html">g15canvas</a> *canvas, unsigned int x, unsigned int y, int val)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the value of the pixel at (x, y). <a href="#55ea1758ff829b3cab04383f8a5eccd4"></a><br></td></tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="79439b23f960f2701cd33b24d98adc88"></a><!-- doxytag: member="screen.c::g15r_clearScreen" ref="79439b23f960f2701cd33b24d98adc88" args="(g15canvas *canvas, int color)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void g15r_clearScreen </td> <td>(</td> <td class="paramtype"><a class="el" href="structg15canvas.html">g15canvas</a> * </td> <td class="paramname"> <em>canvas</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>color</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Fills the screen with pixels of color. <p> Clears the screen and fills it with pixels of color<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>canvas</em> </td><td>A pointer to a <a class="el" href="structg15canvas.html" title="This structure holds the data need to render objects to the LCD screen.">g15canvas</a> struct in which the buffer to be operated on is found. </td></tr> <tr><td valign="top"></td><td valign="top"><em>color</em> </td><td>Screen will be filled with this color. </td></tr> </table> </dl> <p>Definition at line <a class="el" href="screen_8c_source.html#l00080">80</a> of file <a class="el" href="screen_8c_source.html">screen.c</a>.</p> <p>References <a class="el" href="libg15render_8h_source.html#l00039">g15canvas::buffer</a>, and <a class="el" href="libg15render_8h_source.html#l00022">G15_BUFFER_LEN</a>.</p> <div class="fragment"><pre class="fragment"><a name="l00081"></a>00081 { <a name="l00082"></a>00082 memset (canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>, (color ? 0xFF : 0), <a class="code" href="libg15render_8h.html#be1086e7ddda5f7600019031f76fb7b6">G15_BUFFER_LEN</a>); <a name="l00083"></a>00083 } </pre></div> <p> </div> </div><p> <a class="anchor" name="b71c2319a2892031f45c7cb685387d76"></a><!-- doxytag: member="screen.c::g15r_getPixel" ref="b71c2319a2892031f45c7cb685387d76" args="(g15canvas *canvas, unsigned int x, unsigned int y)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int g15r_getPixel </td> <td>(</td> <td class="paramtype"><a class="el" href="structg15canvas.html">g15canvas</a> * </td> <td class="paramname"> <em>canvas</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>y</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Gets the value of the pixel at (x, y). <p> Retrieves the value of the pixel at (x, y)<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>canvas</em> </td><td>A pointer to a <a class="el" href="structg15canvas.html" title="This structure holds the data need to render objects to the LCD screen.">g15canvas</a> struct in which the buffer to be operated on is found. </td></tr> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>X offset for pixel to be retrieved. </td></tr> <tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>Y offset for pixel to be retrieved. </td></tr> </table> </dl> <p>Definition at line <a class="el" href="screen_8c_source.html#l00029">29</a> of file <a class="el" href="screen_8c_source.html">screen.c</a>.</p> <p>References <a class="el" href="libg15render_8h_source.html#l00039">g15canvas::buffer</a>, <a class="el" href="libg15render_8h_source.html#l00021">BYTE_SIZE</a>, <a class="el" href="libg15render_8h_source.html#l00024">G15_LCD_HEIGHT</a>, and <a class="el" href="libg15render_8h_source.html#l00025">G15_LCD_WIDTH</a>.</p> <p>Referenced by <a class="el" href="pixel_8c_source.html#l00045">g15r_pixelReverseFill()</a>, and <a class="el" href="screen_8c_source.html#l00050">g15r_setPixel()</a>.</p> <div class="fragment"><pre class="fragment"><a name="l00030"></a>00030 { <a name="l00031"></a>00031 <span class="keywordflow">if</span> (x >= <a class="code" href="libg15render_8h.html#1f1337297f4dd068563a5ee3db597fa0">G15_LCD_WIDTH</a> || y >= <a class="code" href="libg15render_8h.html#c4e62328af8f7e892528121bd90079cf">G15_LCD_HEIGHT</a>) <a name="l00032"></a>00032 <span class="keywordflow">return</span> 0; <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pixel_offset = y * <a class="code" href="libg15render_8h.html#1f1337297f4dd068563a5ee3db597fa0">G15_LCD_WIDTH</a> + x; <a name="l00035"></a>00035 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> byte_offset = pixel_offset / <a class="code" href="libg15render_8h.html#86fd4404b140711fdb77326609c0f393">BYTE_SIZE</a>; <a name="l00036"></a>00036 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bit_offset = 7 - (pixel_offset % <a class="code" href="libg15render_8h.html#86fd4404b140711fdb77326609c0f393">BYTE_SIZE</a>); <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keywordflow">return</span> (canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>[byte_offset] & (1 << bit_offset)) >> bit_offset; <a name="l00039"></a>00039 } </pre></div> <p> </div> </div><p> <a class="anchor" name="9fca67171d0100a4bde88a9c8f6023ab"></a><!-- doxytag: member="screen.c::g15r_initCanvas" ref="9fca67171d0100a4bde88a9c8f6023ab" args="(g15canvas *canvas)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void g15r_initCanvas </td> <td>(</td> <td class="paramtype"><a class="el" href="structg15canvas.html">g15canvas</a> * </td> <td class="paramname"> <em>canvas</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Clears the canvas and resets the mode switches. <p> Clears the screen and resets the mode values for a canvas<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>canvas</em> </td><td>A pointer to a <a class="el" href="structg15canvas.html" title="This structure holds the data need to render objects to the LCD screen.">g15canvas</a> struct </td></tr> </table> </dl> <p>Definition at line <a class="el" href="screen_8c_source.html#l00091">91</a> of file <a class="el" href="screen_8c_source.html">screen.c</a>.</p> <p>References <a class="el" href="libg15render_8h_source.html#l00039">g15canvas::buffer</a>, <a class="el" href="libg15render_8h_source.html#l00047">g15canvas::ftLib</a>, <a class="el" href="libg15render_8h_source.html#l00022">G15_BUFFER_LEN</a>, <a class="el" href="libg15render_8h_source.html#l00043">g15canvas::mode_cache</a>, <a class="el" href="libg15render_8h_source.html#l00045">g15canvas::mode_reverse</a>, and <a class="el" href="libg15render_8h_source.html#l00041">g15canvas::mode_xor</a>.</p> <div class="fragment"><pre class="fragment"><a name="l00092"></a>00092 { <a name="l00093"></a>00093 memset (canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>, 0, <a class="code" href="libg15render_8h.html#be1086e7ddda5f7600019031f76fb7b6">G15_BUFFER_LEN</a>); <a name="l00094"></a>00094 canvas-><a class="code" href="structg15canvas.html#c7c366d9889cc757beea4d3679bf4a15">mode_cache</a> = 0; <a name="l00095"></a>00095 canvas-><a class="code" href="structg15canvas.html#e840b2364440434884f8c34a5be6150d">mode_reverse</a> = 0; <a name="l00096"></a>00096 canvas-><a class="code" href="structg15canvas.html#09c9ae8f508cbfd0c3dc8e2a239fc1b5">mode_xor</a> = 0; <a name="l00097"></a>00097 <span class="preprocessor">#ifdef TTF_SUPPORT</span> <a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keywordflow">if</span> (FT_Init_FreeType (&canvas-><a class="code" href="structg15canvas.html#497342d92d60f2bd38f26f539422c77c">ftLib</a>)) <a name="l00099"></a>00099 printf (<span class="stringliteral">"Freetype couldnt initialise\n"</span>); <a name="l00100"></a>00100 <span class="preprocessor">#endif</span> <a name="l00101"></a>00101 <span class="preprocessor"></span>} </pre></div> <p> </div> </div><p> <a class="anchor" name="55ea1758ff829b3cab04383f8a5eccd4"></a><!-- doxytag: member="screen.c::g15r_setPixel" ref="55ea1758ff829b3cab04383f8a5eccd4" args="(g15canvas *canvas, unsigned int x, unsigned int y, int val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void g15r_setPixel </td> <td>(</td> <td class="paramtype"><a class="el" href="structg15canvas.html">g15canvas</a> * </td> <td class="paramname"> <em>canvas</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>val</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Sets the value of the pixel at (x, y). <p> Sets the value of the pixel at (x, y)<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>canvas</em> </td><td>A pointer to a <a class="el" href="structg15canvas.html" title="This structure holds the data need to render objects to the LCD screen.">g15canvas</a> struct in which the buffer to be operated on is found. </td></tr> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>X offset for pixel to be set. </td></tr> <tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>Y offset for pixel to be set. </td></tr> <tr><td valign="top"></td><td valign="top"><em>val</em> </td><td>Value to which pixel should be set. </td></tr> </table> </dl> <p>Definition at line <a class="el" href="screen_8c_source.html#l00050">50</a> of file <a class="el" href="screen_8c_source.html">screen.c</a>.</p> <p>References <a class="el" href="libg15render_8h_source.html#l00039">g15canvas::buffer</a>, <a class="el" href="libg15render_8h_source.html#l00021">BYTE_SIZE</a>, <a class="el" href="libg15render_8h_source.html#l00024">G15_LCD_HEIGHT</a>, <a class="el" href="libg15render_8h_source.html#l00025">G15_LCD_WIDTH</a>, <a class="el" href="screen_8c_source.html#l00029">g15r_getPixel()</a>, <a class="el" href="libg15render_8h_source.html#l00045">g15canvas::mode_reverse</a>, and <a class="el" href="libg15render_8h_source.html#l00041">g15canvas::mode_xor</a>.</p> <p>Referenced by <a class="el" href="text_8c_source.html#l00233">draw_ttf_char()</a>, <a class="el" href="pixel_8c_source.html#l00203">g15r_drawCircle()</a>, <a class="el" href="pixel_8c_source.html#l00411">g15r_drawIcon()</a>, <a class="el" href="pixel_8c_source.html#l00099">g15r_drawLine()</a>, <a class="el" href="pixel_8c_source.html#l00252">g15r_drawRoundBox()</a>, <a class="el" href="pixel_8c_source.html#l00443">g15r_drawSprite()</a>, <a class="el" href="pixel_8c_source.html#l00163">g15r_pixelBox()</a>, <a class="el" href="pixel_8c_source.html#l00074">g15r_pixelOverlay()</a>, <a class="el" href="pixel_8c_source.html#l00045">g15r_pixelReverseFill()</a>, <a class="el" href="text_8c_source.html#l00022">g15r_renderCharacterLarge()</a>, <a class="el" href="text_8c_source.html#l00050">g15r_renderCharacterMedium()</a>, and <a class="el" href="text_8c_source.html#l00077">g15r_renderCharacterSmall()</a>.</p> <div class="fragment"><pre class="fragment"><a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="keywordflow">if</span> (x >= <a class="code" href="libg15render_8h.html#1f1337297f4dd068563a5ee3db597fa0">G15_LCD_WIDTH</a> || y >= <a class="code" href="libg15render_8h.html#c4e62328af8f7e892528121bd90079cf">G15_LCD_HEIGHT</a>) <a name="l00053"></a>00053 <span class="keywordflow">return</span>; <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pixel_offset = y * <a class="code" href="libg15render_8h.html#1f1337297f4dd068563a5ee3db597fa0">G15_LCD_WIDTH</a> + x; <a name="l00056"></a>00056 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> byte_offset = pixel_offset / <a class="code" href="libg15render_8h.html#86fd4404b140711fdb77326609c0f393">BYTE_SIZE</a>; <a name="l00057"></a>00057 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bit_offset = 7 - (pixel_offset % <a class="code" href="libg15render_8h.html#86fd4404b140711fdb77326609c0f393">BYTE_SIZE</a>); <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keywordflow">if</span> (canvas-><a class="code" href="structg15canvas.html#09c9ae8f508cbfd0c3dc8e2a239fc1b5">mode_xor</a>) <a name="l00060"></a>00060 val ^= <a class="code" href="libg15render_8h.html#b71c2319a2892031f45c7cb685387d76" title="Gets the value of the pixel at (x, y).">g15r_getPixel</a> (canvas, x, y); <a name="l00061"></a>00061 <span class="keywordflow">if</span> (canvas-><a class="code" href="structg15canvas.html#e840b2364440434884f8c34a5be6150d">mode_reverse</a>) <a name="l00062"></a>00062 val = !val; <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keywordflow">if</span> (val) <a name="l00065"></a>00065 canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>[byte_offset] = <a name="l00066"></a>00066 canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>[byte_offset] | 1 << bit_offset; <a name="l00067"></a>00067 <span class="keywordflow">else</span> <a name="l00068"></a>00068 canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>[byte_offset] = <a name="l00069"></a>00069 canvas-><a class="code" href="structg15canvas.html#4216bb87453363bae6c4418583015e76">buffer</a>[byte_offset] & ~(1 << bit_offset); <a name="l00070"></a>00070 <a name="l00071"></a>00071 } </pre></div> <p> </div> </div><p> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Sep 14 03:07:53 2009 for libg15render by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>