-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|83|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Advanced Techniques


 
Jayenkai
Created : 07 April 2007
Edited : 07 April 2007
System : Windows
Language : Blitz

Scaling 2D Resolutions

How to fill a 640x480 area with only 320x240 graphics.

There are various scaling techniques used in Emulators, to make classic 320x240 games look great even in huge resolutions.
Unfortunately things are a little trickier in Blitz, mostly due to it's slow pixel functions.

Let's take a simple program and scale it up.


There are two simple ways you can upscale your game in Blitz.

The first is pretty simple. You can use DirectX to upscale things.
Blitz has two Window types. One is Size, and the other is Resolution.
If you create a 640x480 window, but only use 320x240 resolution, then the 320x240 will be automatically scaled to the windows area.



As you can see, that was pretty simple!
It did, however, make the end result a little blurry. But it is the fastest way (both code wise, and processor wise) to achieve the result.
If you're running your game on a low end system, this is probably a nice option to have.


Our other option is to scale it using CopyRect.

The basic idea is to do a Pixel Based rescale.. We first go through our screen copying vertical rows to a buffer. Draw each row twice to "spread it out", and then do the same with horizontal rows to a second buffer. Draw the result back onto the backbuffer, and everything becomes nice and chunky.

I've created a handy "Zoom" function that should be able to cope with most resolutions. Although, it's not been stress tested, it should be fairly speedy on half-decent systems.



And I even shoved in a Scanlines effect, for you, too!

 

Comments