www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/04/09:48:45

Message-ID: <000201bda752$49304920$7a4d08c3@arthur>
From: "Arthur" <arfa AT clara DOT net>
To: "DJGPP Mailing List" <djgpp AT delorie DOT com>
Subject: Re: Scaling an image
Date: Fri, 3 Jul 1998 16:01:09 +0100
MIME-Version: 1.0

>Hi,I'm using allegro's routine to load graphicas file , and got a
>question. I got a 320*200 pcx file, but i need to draw it, lets say  in
>640*400, how can i scale so that it fill the whole screen in the same
>way it did in 320 * 200?.
>
>Is there any way allegro can do it, or do i have to write a routine to
>perform this scaling, or is there other way i can do it.


You can find the format for PCX pictures at any reasonable programming site.
PCX pictures can be encoded, so you'll need to know how to uncompress it.

If you can get Allegro to display the picture to a memory block which
emulates a 320*200 screen, then you can write a simple routine to scale it
up. For each pixel of your picture, draw a 2x2 pixel block at co-ordinates
(2*x,2*y) on the screen. You are, in effect, doubling the resolution of the
picture.

You can advance the routine further, by using various filtering methods to
reduce the "blockyness" of the image in 640x480.

HTH

James Arthur
jaa AT arfa DOT clara DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019