<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>8bit bitmap to alpha channel</title>
		<link>http://www.allegro.cc/forums/view/591796</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 08 Jun 2007 16:16:26 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><s>Is there a quick method of writing the values of an 8bit bit map to the alpha channel of a 32bit bitmap, without changing the RGB components of the 32bit bitmap?

Alternatively, is there a quick method of writing the alpha channel of a 32bit bitmap to the alpha channel of another 32bit bitmap without changing the RGB components of the second bitmap (the one being written to)?
</s></p><p>[edit]<br />Worked it out :</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//  image = 32 bit image, size of buffer == size of screen</span>
<span class="c">//  trans = 8 bit image representing what the alpha channel on image should be</span>

        <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_write_alpha_blender" target="_blank"><span class="a">set_write_alpha_blender</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
        <a href="http://www.allegro.cc/manual/draw_trans_sprite" target="_blank"><span class="a">draw_trans_sprite</span></a><span class="k2">(</span>image, trans, tx, ty<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>
        <a href="http://www.allegro.cc/manual/draw_trans_sprite" target="_blank"><span class="a">draw_trans_sprite</span></a><span class="k2">(</span>buffer, image, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
[/edit]
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HardTranceFan)</author>
		<pubDate>Fri, 08 Jun 2007 16:16:26 +0000</pubDate>
	</item>
</rss>
