[Freeciv-Dev] Re: non-rectangular flag scaling
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, 2 Sep 2001, Karl-Ingo Friese wrote:
> 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...
> ................
> ................
This is ok as a stopgap measure but i think it would be easier/cleaner to
just add 2 extra fields to the flag.spec files stating what is the
x_offset and y_offset, x_width and y_width of the flags. You would then
use that instead of searching for the values at run time.
> 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.
---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa
|
|