<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>MASkinG question</title>
		<link>http://www.allegro.cc/forums/view/587157</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 22 Aug 2006 19:40:04 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve been reading about the MASkinG library and I am confused on one thing.  The information about MASkinG&#39;s own Bitmap wrapper class suggests that it shouldn&#39;t be used and instead we should use Allegro&#39;s own built in graphics functions.  I am wondering how you can extract the Allegro BITMAP object that the MASkinG Bitmap class contains, in order to draw on it with the Allegro functions.</p><p>Say for example you are making a widget for use with MASkinG.  The draw method for the Widget you create is called by the MASkinG system with a MASkinG Bitmap object as its argument.  Basically, I am wondering how you can take the MASkinG Bitmap object and use the standard Allegro graphics drawing functions on the Allegro style BITMAP structure that it contains.</p><p>I looked through the MASkinG Bitmap.h header and I couldn&#39;t seem to find any function that returns an Allegro BITMAP*, so I am not sure how you would do this.  I suppose I could hack the code or something but I would rather not break anything.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Tue, 22 Aug 2006 04:46:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm, well, that documentation might not be completely accurate. I changed my mind about this 20 times over. In the end I decided to keep the documentation as is, but there&#39;s nothing wrong if you use Bitmap&#39;s functions. In the end they&#39;re just wrappers for Allegro&#39;s BITMAP functions.</p><p>As for your question, the Bitmap class has a conversion operator that converts a Bitmap to a BITMAP (in fact it just returns the underlying BITMAP pointer, so no real conversion is actually done). This means that you can use a Bitmap as if it was a BITMAP. For example:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">class</span> MyWidget <span class="k2">:</span> <span class="k1">public</span> Widget <span class="k2">{</span>
   protected:
      <span class="k1">void</span> Draw<span class="k2">(</span>Bitmap <span class="k3">&amp;</span>canvas<span class="k2">)</span> <span class="k2">{</span>
         <a href="http://www.allegro.cc/manual/clear_to_color" target="_blank"><span class="a">clear_to_color</span></a><span class="k2">(</span>canvas<span class="k2">)</span><span class="k2">;</span>
         <a href="http://www.allegro.cc/manual/rectfill" target="_blank"><span class="a">rectfill</span></a><span class="k2">(</span>canvas, <span class="n">10</span>, <span class="n">20</span>, <span class="n">30</span>, <span class="n">40</span>, <a href="http://www.allegro.cc/manual/makecol" target="_blank"><span class="a">makecol</span></a><span class="k2">(</span><span class="n">123</span>,<span class="n">123</span>,<span class="n">123</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
         <a href="http://www.allegro.cc/manual/circlefill" target="_blank"><span class="a">circlefill</span></a><span class="k2">(</span>canvas, <span class="n">30</span>, <span class="n">40</span>, <span class="n">20</span>, Color<span class="k2">(</span><span class="n">200</span>,<span class="n">100</span>,<span class="n">100</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
         <a href="http://www.allegro.cc/manual/line" target="_blank"><span class="a">line</span></a><span class="k2">(</span>canvas, <span class="n">20</span>, <span class="n">30</span>, <span class="n">40</span>, <span class="n">50</span>, Color::green<span class="k2">)</span><span class="k2">;</span>
      <span class="k2">}</span>
<span class="k2">}</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 22 Aug 2006 10:59:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for the response.  I didn&#39;t have a chance to install MASKing when I had asked the question yesterday, so I couldn&#39;t look at the official documentation that comes with the install.</p><p>Anyway, just now I tried to install the AllegroFont library that MASkinG requires and I have some compiling errors.  I am using the latest mingw compiler with allegro 4.2 and I made sure to uncomment the appropriate line in the makefile (TARGET=MINGW32_STATIC).  I also checked the .h file as the AllegroFont readme said to.  When I run make on the makefile I get the following compiler error:</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>C:\mingw\AlFont206&gt;mingw32-make</td></tr><tr><td class="number">2</td><td>gcc <span class="k3">-</span>c <span class="k3">-</span>Wall <span class="k3">-</span>O2 <span class="k3">-</span>march<span class="k3">=</span>pentium <span class="k3">-</span>fomit-frame-pointer <span class="k3">-</span>finline-functions <span class="k3">-</span>ffast-m</td></tr><tr><td class="number">3</td><td>ath <span class="k3">-</span>Ifreetype<span class="k3">/</span>include <span class="k3">-</span>Iinclude src<span class="k3">/</span>alfont.c <span class="k3">-</span>o obj<span class="k3">/</span>mingw32<span class="k3">/</span><span class="k1">static</span><span class="k3">/</span>alfont.o</td></tr><tr><td class="number">4</td><td>In file included from src<span class="k3">/</span>alfont.c:17:</td></tr><tr><td class="number">5</td><td>include<span class="k3">/</span>alfont.h:464:3: warning: no newline at end of file</td></tr><tr><td class="number">6</td><td>src<span class="k3">/</span>alfont.c: In function `alfont_textout_aa_ex<span class="s">':</span></td></tr><tr><td class="number">7</td><td><span class="s">src/alfont.c:876: error: invalid lvalue in unary `&amp;'</span></td></tr><tr><td class="number">8</td><td>src<span class="k3">/</span>alfont.c:876: error: invalid lvalue in unary `<span class="k3">&amp;</span><span class="s">'</span></td></tr><tr><td class="number">9</td><td><span class="s">src/alfont.c: In function `alfont_textout_ex'</span><span class="k2">:</span></td></tr><tr><td class="number">10</td><td>src<span class="k3">/</span>alfont.c:1962: error: invalid lvalue in unary `<span class="k3">&amp;</span><span class="s">'</span></td></tr><tr><td class="number">11</td><td><span class="s">src/alfont.c:1962: error: invalid lvalue in unary `&amp;'</span></td></tr><tr><td class="number">12</td><td>src<span class="k3">/</span>alfont.c: In function `alfont_text_length<span class="s">':</span></td></tr><tr><td class="number">13</td><td><span class="s">src/alfont.c:2740: error: invalid lvalue in unary `&amp;'</span></td></tr><tr><td class="number">14</td><td>src<span class="k3">/</span>alfont.c:2740: error: invalid lvalue in unary `<span class="k3">&amp;</span><span class="s">'</span></td></tr><tr><td class="number">15</td><td><span class="s">src/alfont.c: In function `alfont_ugetc'</span><span class="k2">:</span></td></tr><tr><td class="number">16</td><td>src<span class="k3">/</span>alfont.c:3052: warning: unused variable `lpszW_pointer<span class="s">'</span></td></tr><tr><td class="number">17</td><td><span class="s">mingw32-make: *** [alfont.o] Error 1</span></td></tr></tbody></table></div></div><p>

I get the exact same error if I try to compile AllegroFont library as a DLL as well.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Tue, 22 Aug 2006 19:28:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Use an older version of AlFont. I have v1.9something on my MASkinG page. Apparently the guy who decided to continue to develop AlFont after the original author abandoned it isn&#39;t doing a very good job...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 22 Aug 2006 19:40:04 +0000</pubDate>
	</item>
</rss>
