<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>graphic formats</title>
		<link>http://www.allegro.cc/forums/view/562538</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 30 Jan 2006 17:25:53 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello, I would like to use 32 bit images in my program using the alpha value (ARGB) but I&#39;m not sure how could it be done. First I need an image format, which supports 32 bit interface (bmp doesn&#39;t). Second, I need a library to load images of this type and convert them to BITMAP * . Finally, I do not know how to work with these images (blit(), makecol(), put/getpixel()...). Could someone help me? <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thats  me)</author>
		<pubDate>Sat, 28 Jan 2006 21:39:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
TGA is your friend. Allegro supports it natively.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sat, 28 Jan 2006 21:44:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A better format is PNG, which is supported through an addon. To use the alpha channel, look at the set_alpha_blender and draw_trans_sprite functions. Also, investigate if the AllegroGL or OpenLayer addons are useful to what you want to do - they can use alpha blitting with HW acceleration.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sat, 28 Jan 2006 21:53:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>PNG is good for Alpha channel support.<br />althou im not sure how you go about getpixel() when it returns a signed int
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Sun, 29 Jan 2006 04:43:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>[To mods: can you delete this message and move the thread away from the dev forum?]
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sun, 29 Jan 2006 04:50:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
althou im not sure how you go about getpixel() when it returns a signed int
</p></div></div><p>

32 bits is 32 bits, no matter if you decide to interpret it as signed or unsigned for some operations.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sun, 29 Jan 2006 07:27:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The case is as follows: I have a 24 bitmap and another greyscale bitmap, which could be interpreted as alpha equivalent of the same picture. If I could do a program that combines both of this images (the output can be TGA or whatever) and afterwards use the combined image in my program... <br />If anyone has a tip how to do that and has time for lamers <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />, please share it. I&#39;m going to read all the blender stuff in the docs and if I have further problems I would ask again. Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thats  me)</author>
		<pubDate>Mon, 30 Jan 2006 14:11:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can do it e.g. in Gimp. Add an alpha channel, select the channel, paste the grayscale into it, then save again.</p><p>Or you can do it in Allegro, something like:</p><div class="source-code snippet"><div class="inner"><pre>set_colorconv_mode<span class="k2">(</span>COLORCONV_NONE<span class="k2">)</span><span class="k2">;</span>
bmp24 <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">"24bit.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/PALETTE" target="_blank"><span class="a">PALETTE</span></a> pal<span class="k2">;</span>
alpha8 <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">"8bit.bmp"</span>, pal<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/select_palette" target="_blank"><span class="a">select_palette</span></a><span class="k2">(</span>pal<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp32 <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap_ex" target="_blank"><span class="a">create_bitmap_ex</span></a><span class="k2">(</span><span class="n">32</span>, w, h<span class="k2">)</span><span class="k2">;</span>
<span class="k1">for</span><span class="k2">(</span>y <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> y <span class="k3">&lt;</span> h<span class="k2">;</span> y<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k1">for</span><span class="k2">(</span>x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> x <span class="k3">&lt;</span> w<span class="k2">;</span> x<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
    c <span class="k3">=</span> <a href="http://www.allegro.cc/manual/getpixel" target="_blank"><span class="a">getpixel</span></a><span class="k2">(</span>bmp24, x, y<span class="k2">)</span><span class="k2">;</span>
    r<span class="k3">/</span>g<span class="k3">/</span>b <span class="k3">=</span> <a href="http://www.allegro.cc/manual/getr" target="_blank"><span class="a">getr</span></a><span class="k3">/</span>g<span class="k3">/</span>b24<span class="k2">(</span>c<span class="k2">)</span><span class="k2">;</span>
    a <span class="k3">=</span> <a href="http://www.allegro.cc/manual/getpixel" target="_blank"><span class="a">getpixel</span></a><span class="k2">(</span>bmp8, x, y<span class="k2">)</span><span class="k2">;</span>
    r <span class="k3">=</span> <a href="http://www.allegro.cc/manual/getr8" target="_blank"><span class="a">getr8</span></a><span class="k2">(</span>a<span class="k2">)</span><span class="k2">;</span> <span class="c">// assuming, r/g/b is the same in the grayscale..</span>
    <a href="http://www.allegro.cc/manual/putpixel" target="_blank"><span class="a">putpixel</span></a><span class="k2">(</span>bmp32, <a href="http://www.allegro.cc/manual/makeacol32" target="_blank"><span class="a">makeacol32</span></a><span class="k2">(</span>r, g, b, a<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

The code is apparently only pseudo-code, but basically, you can create a 32-bit bitmap with alpha channel using putpixel.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 30 Jan 2006 17:24:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The case is as follows: I have a 24 bitmap and another greyscale bitmap, which could be interpreted as alpha equivalent of the same picture. If I could do a program that combines both of this images (the output can be TGA or whatever) and afterwards use the combined image in my program...<br />If anyone has a tip how to do that and has time for lamers <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />, please share it. I&#39;m going to read all the blender stuff in the docs and if I have further problems I would ask again. Thanks.
</p></div></div><p>

Check the manual entry for <span class="source-code"><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>and do exactly what it says. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Mon, 30 Jan 2006 17:25:53 +0000</pubDate>
	</item>
</rss>
