[SDL] Scaling Images

Guilherme De Sousa g_hds at yahoo.co.uk
Tue Nov 15 05:33:38 PST 2005


--- Bill Kendrick <nbs at sonic.net> wrote:

> On Mon, Nov 14, 2005 at 01:13:57PM +0000, Guilherme
> De Sousa wrote:
> > Basically what I'm looking for is a routine that
> will
> > take a rectangular image, can scale it to a
> smaller or
> > larger rectangle but can also scale it to appear
> as
> > though it's in perspective. The screenshots here
> might
> > make it clearer:
> > 
> > http://wateraxe.demon.nl/alternatereality/  
> 
> Right-on!  Out of curiosity, have you spoken with
> the original AR creators?
> (A while back they were hoping to make a modern
> version of AR for PCs,
> but that sadly fell through.)

Dan Pinal who worked on the Dungeon still posts to the
AR Mailing list. Philip Price and Ken Jordan have both
posted to it in the past. Gary Gilbertson who wrote
the music has posted some updated versions of his
music on the AtariAge forums recently. You can find
the AR mailing list at:

http://www.avatardesign.net/alternatereality/

The Archives don't currently include posts since April
but the list is still in use. Philip Price was working
on a new version but there hasn't been any news from
him for a few years.

> Firstly, it looks like you're coming from a C=64
> perspective, since
> there are so few colors in your demo screenshots. 
> Pump it up!  Go for
> all 256 Atari 8-bit colors, man!  ;^)  (That game
> was _gorgeous_ on the
> Atari... lots of DLI tricks used!)
> 
> (or, like, maybe AR:The Dungeon was less colorful
> than AR:The City ;^) )

No these are the Atari Dungeon graphics and should
look just about identical :) If you look at the
gateway room you should be able to see the DLI stuff.
The Dungeon doesn't have the colourful ground / sky of
the City. I haven't added any City content yet.

> So in other words you want to take something like
> this:
> 
>   +--+
>   |  |
>   +--+
> 
> and turn it into:
> 
>   |\
>   | \
>   | /
>   |/

That's right.

> In a sense, it's simply slicing the rectangle into
> long, vertical slices,
> and scaling each one differently.  In the example
> above, the leftmost 'slice'
> (be it one pixel wide, or more... up to you) is kept
> at 100% height.
> 
> The middle slice is at 50%.  The rightmost slice
> diminishes to nothing. :)
> 
> Alter the percentages accordingly for other shapes
> pieces, e.g.:
> 
>   |\
>   | |
>   | |
>   |/

I think the main thing I was unsure of was how to
decide which pixels or vertical slices you should omit
from the image (If you're scaling down say). I'll
check out your example anyway.

> Scaling can be pretty simple to code.  And, as
> someone else pointed out,
> you might want to consider using OpenGL.  But, I
> guess it depends on if
> you're targetting high-end PCs, or, say, PDAs,
> phones or Dreamcasts. :)

I have looked at OpenGL but I feel that it's properly
overkill for this case given that the 3D environment
is fairly simple and I would like to be able to offer
the port to PDA users.

> > Can anybody point me to some code or examples that
> > might be helpful?
> 
> I don't do perspective, but there is a scaling
> routine ("thumbnail", I 
> call it) in Tux Paint, which is GPL.  See the URL in
> my sig.

Thanks I'll have a look at Tux Paint.

Guilherme


		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com




More information about the SDL mailing list