<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Quesiton about masked_blit</title>
		<link>http://www.allegro.cc/forums/view/601029</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 24 Jul 2009 01:16:00 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello,</p><p>I was just wondering if anyone can explain me how in fact masked_blit works?</p><p>As we already know, masked_blit eliminates background that could be in various colors and displays sprite we want to blit to the screen.</p><p>Well, I would like to show you some example as I did experiment quite a bit with this command and I cant understand how and when it &quot;removes&quot; background and what are the cases needed to be satasfied in order it to do so?</p><p>1st example:</p><p>When I use <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> on this picture: <a href="http://img27.imageshack.us/i/doggle.png/">http://img27.imageshack.us/i/doggle.png/</a></p><p>It sucssesfuly removes pink background and shows &quot;doggy&quot; in black screen background. Perfect!</p><p>2nd example:</p><p>But here I got Linux &quot;Tux&quot; mascot, that also has pink background. When I use masked_blit with it then it dosen&#39;t remove pink background - but in fact it displays it! <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /> <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /></p><p>Why is that so? What needs to be done with picture in order to <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> only show sprite itself? Another color in bitmap&#39;s background?</p><p>I did set pixel_depth(32) also but problem with &quot;Tux&quot; still remains.</p><p>BUT - I did solve this in a specific way:</p><p>I used &quot;Eyedroppe tool&quot; from Photoshop and used &quot;specific pink&quot; from &quot;doggy&quot; picture and used it on &quot;Tux&quot; picture as background color.</p><p>After that - <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> with &quot;Tux&quot; picture worked PERFECT!.</p><p>So my questions is in fact:</p><p>Why does <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> only removes specific color of background and how to manipulate it better? Should I always color my pictures with that &quot;specific pink&quot; in order to <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> remove it afterwards? How it works is right question <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>Thanks! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 16:43:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The pink colour must be exactly that shade of pink for masked_blit to know it shouldn&#39;t draw it. It only treats one colour (the pink) this way because it is a lot simpliar to remember one colour you cant use when drawing sprites (unless you want it to be transparent of course).</p><p>The rgb value for that pink is (255,0,255) and I think its that pink because the colour isn&#39;t used often? Not sure though, I might have made that up.</p><p>Anyway I wouldn&#39;t worry why it works, just worry that it works with that pink only <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tomoso)</author>
		<pubDate>Thu, 23 Jul 2009 16:51:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/601029/822833#target">Tomoso</a> said:</div><div class="quote"><p>The pink colour must be exactly that shade of pink for masked_blit to know it shouldn&#39;t draw it. It only treats one colour (the pink) this way because it is a lot simpliar to remember one colour you cant use when drawing sprites (unless you want it to be transparent of course).</p><p>The rgb value for that pink is (255,0,255) and I think its that pink because the colour isn&#39;t used often? Not sure though, I might have made that up.</p><p>Anyway I wouldn&#39;t worry why it works, just worry that it works with that pink only <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> </p></div></div><p>


Thanks, </p><p>Anyway, could anyone be more technical about this? </p><p>Also, when I did put &quot;shade of pink&quot; on background of &quot;Tux&quot;, in my program <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> did remove background, but lines of &quot;tux&quot; bitmap did left pink colored.</p><p>Like this:<br /><a href="http://img132.imageshack.us/i/87703854.jpg/">http://img132.imageshack.us/i/87703854.jpg/</a></p><p>What technique should I use to make most of my bitmap&#39;s background &quot;pink shaded&quot; so it works perfectly with <span class="source-code"><a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a></span> or even with <span class="source-code">draw_bitmap?</span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 17:13:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Maybe this thread will help</p><p><a href="http://www.allegro.cc/forums/thread/600895">http://www.allegro.cc/forums/thread/600895</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 17:30:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That topic did help me a lot, thanks.</p><p>Anyway, I just wanted to ask - no need to open another topic:</p><p>Is there easy way to me load .PNG files with Allegro? Some stabile and easy to use library with tutorials?</p><p>I am using Microsoft Visual Studio 2008 Express edition SP1.</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 19:20:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.allegro.cc/resource/Libraries/ImageFormats/loadpng">http://www.allegro.cc/resource/Libraries/ImageFormats/loadpng</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 21:17:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks, but can I use this library without installing libpng and zlib? Atleast basic functions like loading .PNG file and displaying it on screen?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 22:18:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t see how you expect to use a &quot;library&quot; without something that has &quot;lib&quot; in the name, for example, liballeg.a or allegro.lib.  And I assume zlib provides compression.  It&#39;s not that hard to use them, really!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 22:25:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well in fact it is, because I don&#39;t get .lib files with it but need to get trough process of compiling them or whatnot and to things be better - it&#39;s so on Linux side of things and there is no tutorial how to implement this on VS 2008 Express SP1 IDE.</p><p>I think I will need to learn more about libraryes and process of their implementation before I can use these things. Any tutorials that are worth studying?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 22:28:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not sure what the problem is. Have you tried the libpng binaries on <a href="http://www.libpng.org/pub/png/libpng.html">this page</a>? They have them for multiple platforms if that&#39;s what you&#39;re asking.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Schyfis)</author>
		<pubDate>Thu, 23 Jul 2009 22:34:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK, I did try to use these libraryes and here is my test code :</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;loadpng.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;png.h&gt;</span>
<span class="number">  4</span><span class="p">#include &lt;zlib.h&gt;</span>
<span class="number">  5</span>
<span class="number">  6</span>
<span class="number">  7</span>
<span class="number">  8</span><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number">  9</span>
<span class="number"> 10</span>
<span class="number"> 11</span>  <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>    
<span class="number"> 13</span>  <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT,<span class="n">640</span>,<span class="n">480</span>,<span class="n">0</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>  <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">32</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>
<span class="number"> 16</span>  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span>alpha<span class="k2">;</span>
<span class="number"> 17</span>
<span class="number"> 18</span>  alpha <span class="k3">=</span> load_png<span class="k2">(</span><span class="s">"alpha.png"</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 19</span>
<span class="number"> 20</span>  <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>alpha,<a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">200</span>,<span class="n">200</span>,<span class="n">256</span>,<span class="n">256</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>
<span class="number"> 22</span>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 23</span>
<span class="number"> 24</span><span class="k2">}</span>
<span class="number"> 25</span><a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>


I get this error:</p><div class="source-code snippet"><div class="inner"><pre><span class="n">1</span><span class="k3">&gt;</span>Compiling...
<span class="n">1</span><span class="k3">&gt;</span>Main.cpp
<span class="n">1</span><span class="k3">&gt;</span>Linking...
<span class="n">1</span><span class="k3">&gt;</span>LINK <span class="k2">:</span> C:\Users\ReiKo\Documents\Visual Studio <span class="n">2008</span>\Projects\Test3\Debug\Test3.exe <span class="k1">not</span> found <span class="k1">or</span> <span class="k1">not</span> built by the last incremental <a href="http://www.delorie.com/djgpp/doc/libc/libc_531.html" target="_blank">link</a><span class="k2">;</span> performing full <a href="http://www.delorie.com/djgpp/doc/libc/libc_531.html" target="_blank">link</a>
<span class="n">1</span><span class="k3">&gt;</span>Main.obj <span class="k2">:</span> error LNK2019: unresolved external symbol _load_png referenced in function <span class="s">"int __cdecl _mangled_main(void)"</span> <span class="k2">(</span>?_mangled_main@@YAHXZ<span class="k2">)</span>
<span class="n">1</span><span class="k3">&gt;</span>C:\Users\ReiKo\Documents\Visual Studio <span class="n">2008</span>\Projects\Test3\Debug\Test3.exe <span class="k2">:</span> fatal error LNK1120: <span class="n">1</span> unresolved externals
<span class="n">1</span><span class="k3">&gt;</span>Build <a href="http://www.delorie.com/djgpp/doc/libc/libc_542.html" target="_blank">log</a> was saved at <span class="s">"file://c:\Users\ReiKo\Documents\Visual Studio 2008\Projects\Test3\Debug\BuildLog.htm"</span>
</pre></div></div><p>


I did link these libraryes:</p><p>alld.lib lpngce.lib zlibce.lib</p><p>Anything that I&#39;m missing here? Maybe I should link loadpng .lib but I don&#39;t have any .lib files from that library. How to get them?</p><p>Sorry if questions are a bit stupid but I&#39;m trying my best to learn.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 23:17:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As far as I can see, libraries with XXXXce.lib in their name are for Windows CE, running in pocket PC&#39;s and pda devices.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 23:21:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh...I see, because I couldn&#39;t find libraryes for my platform as &quot;Schyfis&quot; said, there is only:</p><p>HP-UX<br />Linux<br />Solaris </p><p>I don&#39;t see any of them for Windows... maybe I should get Linux one and try it out? Or compile Linux one? It seems that getting this thing to work on Windows platfrom is not so easy or am I wrong?</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Thu, 23 Jul 2009 23:26:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It looks like nobody has compiled the latest version for Windows and put it online. You can either try compiling it or get the previous version (1.2.37) for Windows. I&#39;m not sure what the changes are between the versions, the site doesn&#39;t seem to have a changelog.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Schyfis)</author>
		<pubDate>Thu, 23 Jul 2009 23:43:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I give up.</p><p><a href="http://www.google.com/#hl=en&amp;q=libpng+msvc+8&amp;aq=f&amp;oq=&amp;aqi=&amp;fp=VEE02fthf5k">http://www.google.com/#hl=en&amp;q=libpng+msvc+8&amp;aq=f&amp;oq=&amp;aqi=&amp;fp=VEE02fthf5k</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 23:45:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Arhur, your link is broken.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 23 Jul 2009 23:46:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Works for me <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /></p><p>The stuff in the Google search box is<br />libpng msvc 8
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 23 Jul 2009 23:51:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Doesn&#39;t work here at all.</p><p>this however is the correct link: <a href="http://www.google.com/search?hl=en&amp;q=libpng+msvc+8&amp;aq=f&amp;oq=&amp;aqi=&amp;fp=VEE02fthf5k">http://www.google.com/search?hl=en&amp;q=libpng+msvc+8&amp;aq=f&amp;oq=&amp;aqi=&amp;fp=VEE02fthf5k</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 24 Jul 2009 00:01:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks on the link, currently I&#39;m trying to compile dll&#39;s from &quot;loadpng&quot; library, I did include like it said &quot;zdll.dll&quot; and &quot;libpng.dll&quot; libraryes but I get this error:</p><p><span class="source-code"><span class="n">1</span><span class="k3">&gt;</span>LINK <span class="k2">:</span> fatal error LNK1561: entry point must be defined</span></p><p>I also did linked adll.lib from Allegro library.</p><p>I sense I&#39;m close but some part of puzzle is missing <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /> <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Fri, 24 Jul 2009 00:02:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><i>Your</i> link gives <i>me</i> a blank white screen...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Fri, 24 Jul 2009 00:02:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>you need to somehow tell MSVC that you&#39;re creating a library when you&#39;re building zlib and libpng.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 24 Jul 2009 00:03:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Both of those libraries come with MSVC project files that work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 24 Jul 2009 00:11:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/601029/822904#target">Matthew Leverton</a> said:</div><div class="quote"><p>Both of those libraries come with MSVC project files that work.</p></div></div><p>Not well enough it seems <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 24 Jul 2009 00:15:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve seen a thing in MSVC 8 that claims to convert MSVC 6 project files (which are listed in the libpng page), but I&#39;ve never tried it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Fri, 24 Jul 2009 00:18:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/601029/822902#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>you need to somehow tell MSVC that you&#39;re creating a library when you&#39;re building zlib and libpng. </p></div></div><p>

Great hint, now I&#39;m on right track, I did sucsessfuly(altough with 5 warnings) compiled loadpng library.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Fri, 24 Jul 2009 00:45:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/601029/822912#target">ReiKo90</a> said:</div><div class="quote"><p>Great hint, now I&#39;m on right track, I did sucsessfuly(altough with 5 warnings) compiled loadpng library.</p></div></div><p>Did you use the MSVC project files that each library comes with?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 24 Jul 2009 00:47:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did try but too much errors.</p><p>Now I did all things manually, but at the highest moment of my expectations I did get this error <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /> :<br /><a href="http://img9.imageshack.us/i/55643522.jpg/">http://img9.imageshack.us/i/55643522.jpg/</a></p><p>heh man...this is so exciting <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Fri, 24 Jul 2009 01:02:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The error looks like it might be mixing up the runtimes or the silly xml runtime stuff is wrong.</p><p>Also, you want to set the color depth before set_gfx_mode, and check for all possible errors coming from set_gfx_mode, and load_*. And heck, and other function that can possibly fail.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 24 Jul 2009 01:08:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK, I will try to do so...play with it for a while <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> But nevertheless, I did learn something new so thanks everyone <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReiKo90)</author>
		<pubDate>Fri, 24 Jul 2009 01:16:00 +0000</pubDate>
	</item>
</rss>
