<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Zoom in/out</title>
		<link>http://www.allegro.cc/forums/view/586403</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 12 Jul 2006 04:00:22 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Could anybody please tell me the best way to zoom in and out of a background with sprites please.  I know you can increase the size of a bitmap, but you cant dump the contents of a screen to a bitmap can you?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AlexKidd)</author>
		<pubDate>Tue, 11 Jul 2006 06:47:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;d have to do it a different way than you&#39;re thinking.  Yes, you can dump the contents of video memory into a bitmap object, but accessing it is a lot slower than accessing normal ram.</p><p>So you have two choices:<br />1) the easy way, which is to draw all the objects you want &quot;zoomed in&quot; to a buffer, then resize a portion of that to the entire size of the buffer.</p><p>2) Use your skills to figure out the position of all the sprites and the background size after zooming in and draw them.  If done right this may be faster.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (zer0)</author>
		<pubDate>Tue, 11 Jul 2006 07:03:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just stretch the image to the size you want.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Felipe Maia)</author>
		<pubDate>Tue, 11 Jul 2006 07:08:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Im not sure i follow the buffer idea.  Im quite new to Allegro, so im sure im missing the command needed.  I only know how to resize a bitmap image.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AlexKidd)</author>
		<pubDate>Tue, 11 Jul 2006 07:13:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>stretch_blit();  should do the trick for you.  If you actually wanted to resize the image, you could stretch blit the image to another bitmap, and use the other bitmap as the resized image, although I&#39;m sure there are better methods.  I was wondering how to zoom in myself so that you could utilize it for an image creation program.  So the pixels are like actually 10X10.   Ehh, whatever.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Paladin)</author>
		<pubDate>Tue, 11 Jul 2006 09:22:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I know about the strech_blit() command.  But you can only use this on a bitmap cant you?  I need to zoom in and out of a screen which is randomly created at runtime.  Can anyone tell me how i can do this please.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AlexKidd)</author>
		<pubDate>Tue, 11 Jul 2006 17:22:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Like this:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// World coordinates:</span>
<span class="k1">float</span> x_world<span class="k2">;</span>

<span class="c">// Zoom factor:</span>
<span class="k1">float</span> zoom<span class="k2">;</span>

<span class="c">// Screen coordinates:</span>
<span class="k1">float</span> x_screen <span class="k3">=</span> x_world <span class="k3">*</span> zoom<span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 11 Jul 2006 17:25:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I understand that.  But what command would zoom into a screen with sprites/background.  Do i have to somehow dump the contents of the screen to a bitmap?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AlexKidd)</author>
		<pubDate>Tue, 11 Jul 2006 17:37:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can have a dblbuffer with all the things, and then stretch_blit to the screen, or you can draw all items one by one already stretched. I don&#39;t know which method is best because I never did it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Felipe Maia)</author>
		<pubDate>Tue, 11 Jul 2006 17:55:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I understand that. But what command would zoom into a screen with sprites/background. Do i have to somehow dump the contents of the screen to a bitmap?
</p></div></div><p>
Use this:<br /><span class="source-code"><a href="http://www.allegro.cc/manual/masked_stretch_blit" target="_blank"><span class="a">masked_stretch_blit</span></a><span class="k2">(</span>sprite, buffer, <span class="n">0</span>, <span class="n">0</span>, sprite-&gt;w, sprite-&gt;h, screen_x, screen_y, sprite-&gt;w<span class="k3">*</span>zoom, sprite-&gt;h<span class="k3">*</span>zoom<span class="k2">)</span></span><br />for each sprite that you have including tiles. Also you should add a pan variable into the formula for adjusting the position of the zoomed-in area: <tt>screen_x = (world_x + pan)*zoom;</tt>.</p><p>And btw, screen IS a bitmap. Your questions sound very confused.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 11 Jul 2006 18:51:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>are you trying to zoom the background, yet not change the size of the sprites?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Wed, 12 Jul 2006 04:00:22 +0000</pubDate>
	</item>
</rss>
