Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] non-rectangular flag scaling
Home

[Freeciv-Dev] non-rectangular flag scaling

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <rf13@xxxxxxxxxxxxxxxxxxxxxx>
Cc: Daniel Sjölie <deepone@xxxxxxxxxx>, Freeciv List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] non-rectangular flag scaling
From: Karl-Ingo Friese <kif@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Sep 2001 19:42:05 +0200 (CEST)

On Sat, 1 Sep 2001, Karl-Ingo Friese wrote:

> On Sat, 1 Sep 2001, Raimar Falke wrote:
> > The attached patch should work but doesn't. It works half if the
> > clipping is disabled. This leaves however black borders. Any ideas?
> >
> >     Raimar
>
> I will have a look at it lateron today.
>
> Ingo

I rewrote the crop & scale part so that is able to deal
with non-rectangular flags now (which do not even have
to begin in the first row/column of pixels). Instead of
the combined crop & scale action before, I splited it
into first calculating the bounding box of the non-masked
pixels, croping it to the new dimensions and finaly scale
the croped image.

................
................
......X.........             ...X...
.....XXX........    crop     ..XXX..    scale    .X.
....XXXXX.......   ----->    .XXXXX.   ------->  XXX
...XXXXXXX......             XXXXXXX             .X.
......X.........             ...X...
................
................


Raimar: I took your function and just changed it that way that
it looks now for the first/last column that contains a non
masked pixel (and same for the rows of course). The "old"
code parsed only the first row/column for start and end.

The result looks a little better; what is left to do now is
mask out the black pixels. I will have to look-up gtk-manuals
for this.

Current version of the patch is attached for comments.
Ingo

-- 

Karl-Ingo Friese
kif@xxxxxxxxxxxxxxxxxxxxxxxxxx

Attachment: plrdlg.c.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]