<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>converting to a bitmap</title>
		<link>http://www.allegro.cc/forums/view/611109</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 23 Sep 2012 08:18:27 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In my program I download a image from a server into memory now I want to take a pointer and turn it into an ALLEGRO_BITMAP. Is there special way to do that or does allegro have something that I can use to do that? I tried casting it but it didn&#39;t work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Sun, 23 Sep 2012 01:14:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can make a memfile (using the memfile addon) from the data, and use <span class="source-code"><a href="http://www.allegro.cc/manual/al_load_bitmap_f"><span class="a">al_load_bitmap_f</span></a></span>.</p><p>Or save it to disk and <span class="source-code"><a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a></span> it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 23 Sep 2012 01:53:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks I&#39;ll give it a shot. I can&#39;t save it to the disk for performance issues but I think the first one will work. I&#39;m getting a crash when I try to draw it. Does this look valid?</p><p><span class="source-code">selectedCard.Load<span class="k2">(</span><a href="http://www.allegro.cc/manual/al_load_bitmap_f"><span class="a">al_load_bitmap_f</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_open_memfile"><span class="a">al_open_memfile</span></a><span class="k2">(</span>chunk.memory, chunk.size, <span class="s">"w"</span><span class="k2">)</span>, <span class="s">""</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span></p><p>The Load function takes a parameter of ALLEGRO_BITMAP.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Sun, 23 Sep 2012 01:56:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You should check for failure in both <span class="source-code"><a href="http://www.allegro.cc/manual/al_open_memfile"><span class="a">al_open_memfile</span></a></span> and <span class="source-code"><a href="http://www.allegro.cc/manual/al_load_bitmap_f"><span class="a">al_load_bitmap_f</span></a></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 23 Sep 2012 02:19:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Plus that&#39;s a memory leak (leaking from al_open_memfile).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 23 Sep 2012 02:40:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do you know it&#39;s a memory leak?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Sun, 23 Sep 2012 03:08:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_open_memfile"><span class="a">al_open_memfile</span></a></span> (click for docs) returns an ALLEGRO_FILE that has to be closed with al_fclose, which frees up the memory used.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 23 Sep 2012 03:16:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So I have to use memfile open close it then use load bitmap f?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Sun, 23 Sep 2012 03:24:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;d close the memfile after using load_bitmap_f. Also free up the memory buffer you have the image in.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 23 Sep 2012 03:28:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>is this good enough for freeing memory or is there more i need to do? Everytime I call the function my memory usage goes up <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_fclose"><span class="a">al_fclose</span></a><span class="k2">(</span>file<span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.delorie.com/djgpp/doc/libc/libc_350.html" target="_blank">free</a><span class="k2">(</span>chunk.memory<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Sun, 23 Sep 2012 08:18:27 +0000</pubDate>
	</item>
</rss>
