<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How to properly use al_draw_scaled_bitmap?</title>
		<link>http://www.allegro.cc/forums/view/618225</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 01 Sep 2020 08:48:28 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello. Allegro 5. Windows.</p><p>I am using al_draw_scaled_bitmap with 8-megabyte PNG.</p><p>I receive no errors when loading the PNG.</p><p>My call looks like:</p><p>al_draw_scaled_bitmap(storm, 0, 0, 100, 100, 50, 50, 200, 200, 0);</p><p>I assume that I am able to specify a bounding-rectangle for both source and destination.</p><p>The above code, when operating on the 8-MB file doesn&#39;t render anything from that bitmap. Everything else renders okay.</p><p>I resized the PNG to about 275-KB and the above operation works.</p><p>I assume it has to do with the size of the file?</p><p>I looked briefly and didn&#39;t see any mention of limitations in this regard.</p><p>Thoughts?</p><p>-- edit-1</p><p>I tried this:</p><p>al_set_new_display_option(ALLEGRO_MAX_BITMAP_SIZE, 10000, ALLEGRO_REQUIRE);</p><p>The docs say 2nd argument is &quot;size&quot;, height and width, so I assume that value represents a square.</p><p>Either way, doesn&#39;t seem to give the desired effect.</p><p>-- edit-2</p><p>I tried:</p><p>al_set_new_display_option(ALLEGRO_MAX_BITMAP_SIZE, 1, ALLEGRO_REQUIRE);</p><p>Assuming my other bitmap would also not draw; it did draw. How does that function work?</p><p>-- edit-3</p><p>Oh no. I found this:</p><p>If a display bitmap is created, there may be limitations on the allowed dimensions. For example a DirectX or OpenGL backend usually has a maximum allowed texture size - so if bitmap creation fails for very large dimensions, you may want to re-try with a smaller bitmap. Some platforms also dictate a minimum texture size, which is relevant if you plan to use this bitmap with the primitives addon. If you try to create a bitmap smaller than this, this call will not fail but the returned bitmap will be a section of a larger bitmap with the minimum size. The minimum size that will work on all platforms is 32 by 32.</p><p>-- edit-4</p><p>Oh! Fortune smiles upon thee, Rabbit. For thou hast purchased assets whose original size works perfectly!</p><p>This means I will have to load 2 bitmaps to cover 1 spell. SO BE IT!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thatrabbit)</author>
		<pubDate>Tue, 01 Sep 2020 07:34:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What&#39;s the resolution of your original PNG? Considering it&#39;s an 8 MB file, I guess it&#39;s several megapixels in size, so a block of 100x100 pixels could appear as a solid color square or even transparency, something that doesn&#39;t happen when you resize your PNG to a much smaller size.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Tue, 01 Sep 2020 08:04:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618225/1047145#target">kenmasters1976</a> said:</div><div class="quote"><p> a block of 100x100 pixels could appear as a solid color square or even transparency</p></div></div><p>Hmm... You may have a point here. The image uses transparency, and that particular frame was mostly transparent with dark clouds on an entirely black background...</p><p>I&#39;ll give it a shot.</p><p>-- edit-1</p><p>And to answer your question, the original image is 960x6912.</p><p>-- edit-2</p><p>HA! You were totally right! I offset the rect to where the animation is basically white, and poof!</p><p>THANK-YOU. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thatrabbit)</author>
		<pubDate>Tue, 01 Sep 2020 08:07:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Keep in mind the arguments for <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_scaled_bitmap"><span class="a">al_draw_scaled_bitmap</span></a><span class="k2">(</span><span class="k2">)</span></span> include the width and height of the source and target areas in the respective bitmaps. That is, if you want to scale the full image to a 200x200 area, you&#39;d have to call:</p><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_scaled_bitmap"><span class="a">al_draw_scaled_bitmap</span></a><span class="k2">(</span>storm, <span class="n">0</span>, <span class="n">0</span>, <span class="n">960</span>, <span class="n">6912</span>, <span class="n">50</span>, <span class="n">50</span>, <span class="n">200</span>, <span class="n">200</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Tue, 01 Sep 2020 08:18:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618225/1047147#target">kenmasters1976</a> said:</div><div class="quote"><p> include the width and height of the source and target areas</p></div></div><p>Aye! That was my hope.</p><p>In this case, the PNG is a sprite-sheet. Each frame is 192x192. And I want to scale each frame to the window.</p><p>I was using SDL 1.2 previously (jumped ship after trying to get sound working), and there was no blit_scaled function, so I scaled it in Gimp... yielding 160-MB file. <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><p>Thank-you again!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (thatrabbit)</author>
		<pubDate>Tue, 01 Sep 2020 08:48:28 +0000</pubDate>
	</item>
</rss>
