<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Alpha Channel</title>
		<link>http://www.allegro.cc/forums/view/405374</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 12 Sep 2004 05:15:37 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can anyone help me out with alpha channel issue? I have created an image using PS5.5 and made an alpha channel for my selection. As a next step, I have saved this image as a Targa (TGA) format including alpha channel. </p><p>My question is how do I load this image back to my Allegro project? I want to display it over other backgrounds so it would create transparency in the areas where it should. I have seen some DirectX demos a while ago where a particle system would be using some alpha channels (it looked really nice.)</p><p>I would really appreciate if someone had a link or an example of how to accomplish alpha channel within the Allegro.</p><p>Best regards,<br />Marius
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mariusz)</author>
		<pubDate>Thu, 09 Sep 2004 03:50:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>bmp = load_bmp(&quot;blah.tga&quot;, NULL);<br />set_alpha_channel();<br />blit(bmp, buffer, 0, 0, 0, 0, bmp-&gt;w, bmp-&gt;h);</p><p>I mean it&#39;s not hard <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Thu, 09 Sep 2004 03:53:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>To load the image you must be sure that it&#39;s loaded in a 32bpp bitmap. For that, you have to disable color conversion:</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/set_color_conversion" target="_blank"><span class="a">set_color_conversion</span></a><span class="k2">(</span>COLORCONV_NONE<span class="k2">)</span><span class="k2">;</span>
image_with_alpha <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bitmap" target="_blank"><span class="a">load_bitmap</span></a><span class="k2">(</span><span class="s">"file.tga"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/set_color_conversion" target="_blank"><span class="a">set_color_conversion</span></a><span class="k2">(</span>COLORCONV_TOTAL<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

To blit you just have to enable alpha blending:</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/drawing_mode" target="_blank"><span class="a">drawing_mode</span></a><span class="k2">(</span>DRAW_MODE_TRANS, NULL, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/set_alpha_blender" target="_blank"><span class="a">set_alpha_blender</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="c">// blit the alpha image</span>
<a href="http://www.allegro.cc/manual/solid_mode" target="_blank"><span class="a">solid_mode</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>


[edit]
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
set_alpha_channel();
</p></div></div><p>
Steve, you just made that up, didn&#39;t you? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Thu, 09 Sep 2004 03:59:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt;_&lt; I had alpha channel in my mind when I wrote that... it&#39;s a typo yes <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Thu, 09 Sep 2004 04:09:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you guys so much! This is one of the best places to get some answers :-)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mariusz)</author>
		<pubDate>Thu, 09 Sep 2004 04:34:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You better believe it <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Thu, 09 Sep 2004 05:07:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Worked like a charm <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mariusz)</author>
		<pubDate>Fri, 10 Sep 2004 04:23:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>WE rule, and GameDev drools <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 10 Sep 2004 08:46:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hahaha.  Sorry to interrupt the scheduled victory dance, but what&#39;s the point of draw_trans_sprite() if a regular blit does the same thing?</p><p><u><i>Steve Terry said:</i></u>
</p><div class="source-code snippet"><div class="inner"><pre>    bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp" target="_blank"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"blah.tga"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
    set_alpha_channel<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>bmp, buffer, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, bmp-&gt;w, bmp-&gt;h<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Gideon Weems)</author>
		<pubDate>Fri, 10 Sep 2004 17:19:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I wouldn&#39;t look much to Steve&#39;s code <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /><img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Sat, 11 Sep 2004 06:49:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" />:&#39;(<br />I wrote it in a hurry and wasn&#39;t thinking<br />/me goes back to RTFM :P
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sat, 11 Sep 2004 07:21:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Actually, the docs are a bit vague about this:</p><div class="quote_container"><div class="title">drawing_mode said:</div><div class="quote"><p>
This only affects the geometric routines like putpixel, lines, rectangles, circles, polygons, floodfill, etc, not the text output, <b>blitting</b>, or sprite drawing functions.
</p></div></div><p>
but if you go to the <i>blitting and sprites</i> section, only draw_trans_sprite (and draw_lit_sprite) mentions it&#39;s affected by the current drawing mode.</p><p>IIRC blit is not affected by draw_mode, but the docs say the opposite <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /> (but it wouldn&#39;t have sense to have two functions, draw_sprite and draw_trans_sprite).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Sat, 11 Sep 2004 08:04:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Actually, the docs are a bit vague about this
</p></div></div><p>
Eh?  Maybe I&#39;m missing something, but the snippet you posted says &quot;<u>not</u> the text output, blitting, or sprite drawing functions&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Gideon Weems)</author>
		<pubDate>Sat, 11 Sep 2004 18:16:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, I had to replace blit with draw_trans_sprite function. Thanks to the fast response from Steve and Oscar. Thank you guys :-)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mariusz)</author>
		<pubDate>Sat, 11 Sep 2004 19:22:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Eh? Maybe I&#39;m missing something, but the snippet you posted says &quot;not the text output, blitting, or sprite drawing functions&quot;.
</p></div></div><p>
<img src="http://www.allegro.cc/forums/smileys/lipsrsealed.gif" alt=":-X" />  It was very late when I read that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Oscar Giner)</author>
		<pubDate>Sat, 11 Sep 2004 19:33:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hahaha!  I only laugh because I&#39;ve been there...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Gideon Weems)</author>
		<pubDate>Sun, 12 Sep 2004 05:15:37 +0000</pubDate>
	</item>
</rss>
