delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/23/20:22:15

Sender: mike AT Home-51 DOT inp DOT nsk DOT su
To: djgpp AT delorie DOT com
Cc: killferfun AT aol DOT com
Subject: Re: Allegro loads graphics funny...
References: <655800$ilq$2 AT news DOT ox DOT ac DOT uk>
<19971123163701 DOT LAA27728 AT ladder02 DOT news DOT aol DOT com>
From: Michael Bukin <bukinm AT inp DOT nsk DOT su>
Date: 24 Nov 1997 07:17:59 +0600
In-Reply-To: killferfun@aol.com's message of 23 Nov 1997 16:37:48 GMT
Message-ID: <m3pvnrccoo.fsf@H-Bukin.inp.nsk.su>
Lines: 39

killferfun AT aol DOT com (KillFerFun) writes:

> The problem is, I created these graphics with a ray-tracer (POVRay), and I use
> Microsoft Imager to mess with them. I resize the images (these are little
> images, 8x20 pixels) but they turn out incomprehensible and unrecognizable,
> because I resize them from about 100x150 to 8x20. I mean to use these things as
> little sprite-like soldiers for a Warcraft ripoff game. (You don't have to tell
> me that Im going beyond myself here, I know that perfectly well :) 
> More comments? Thanks...

If you use Allegro's stretch_blit, then it may be your problem.
I think, when it scales bitmap down, it divides width and height
of original bitmap on width and height of resulting bitmap, and
each pixel in target bitmap is is taken as an upper-left pixel
in corresponding part from original bitmap.

+-+-+-+-+-+-+-+-+-+
|o    |o    |o    |  Original bitmap (9 pixels wide),
||    ||    ||    |  divided on 3 boxes
 |     |     |
 +---+ | +---+
     | | |
     V V V
    +-+-+-+
    | | | | Target bitmap (3 pixels wide)

This scheme is not symmetrical.  It will be more symmetrical
if you take central pixel from each box as a value for target pixel.

Another idea is to use rgb components of all pixels in a box to
create rgb components of target bitmap (and use makecol to convert
it into color index).  Simple one is just calculate average
of each red, green and blue.  Or calculate average with weights.
Central pixels in a box have more weight...
This may have a little problem.  You may have no transparent color
in resulting bitmap made in this way.  You can try to solve it
by calculating the number of transparent pixels in original bitmap.
If their number is large (say, more than half of all pixels number),
then put transparent pixel in target bitmap.

- Raw text -


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