<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] Load indexed bitmap</title>
		<link>http://www.allegro.cc/forums/view/617561</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 18 Sep 2018 03:24:06 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is it possible to load an indexed/paletted bitmap using Allegro 5 while keeping the index information? I&#39;ve tried using <span class="source-code">ALLEGRO_KEEP_INDEX</span> but then how do I access the bitmap data? <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_pixel"><span class="a">al_get_pixel</span></a><span class="k2">(</span><span class="k2">)</span></span> returns an <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a></span>, not an index. I&#39;ve also tried locking the bitmap to access the data pointer but I can&#39;t get the index data either.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Mon, 17 Sep 2018 22:26:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Have you tried locking it with <span class="source-code">ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8</span>?</p><p>See the bitmap loading code: <a href="https://github.com/liballeg/allegro5/blob/999008dee8fe13c4775237c46b809670ef3e0376/addons/image/bmp.c#L1334">https://github.com/liballeg/allegro5/blob/999008dee8fe13c4775237c46b809670ef3e0376/addons/image/bmp.c#L1334</a></p><p>It&#39;s also in the docs on pixel formats: <a href="https://liballeg.org/a5docs/trunk/graphics.html#allegro_pixel_format">https://liballeg.org/a5docs/trunk/graphics.html#allegro_pixel_format</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Erin Maus)</author>
		<pubDate>Tue, 18 Sep 2018 00:59:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have tried that, yes. After doing that, the <span class="source-code">data</span> pointer of the locked region represents the red component of the image, as stated in the docs, but not the color index of the original bitmap.</p><p>[EDIT:] Nevermind, it seems the right way to do it is to load the bitmap with <span class="source-code">al_load_bitmap_flags<span class="k2">(</span><span class="k2">)</span></span> using the <span class="source-code">ALLEGRO_KEEP_INDEX</span> flag and <b>then</b> locking the bitmap with the <span class="source-code">ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8</span> format.</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Tue, 18 Sep 2018 01:16:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Glad you got it working. The red channel should be the index when done correctly, I believe.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 18 Sep 2018 03:24:06 +0000</pubDate>
	</item>
</rss>
