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

[Freeciv-Dev] Re: non-rectangular flag scaling

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: Karl-Ingo Friese <kif@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Daniel Sjölie <deepone@xxxxxxxxxx>, Freeciv List <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: non-rectangular flag scaling
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Sep 2001 20:54:21 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Sep 02, 2001 at 07:14:40PM +0100, Vasco Alexandre Da Silva Costa wrote:
> On Sun, 2 Sep 2001, Raimar Falke wrote:
> 
> > On Sun, Sep 02, 2001 at 07:42:05PM +0200, 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.
> > 
> > This was also my plan.
> > 
> > > ................
> > > ................
> > > ......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.
> > 
> > I thought I have allready changed this.
> > 
> > > 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.
> > 
> > My idea was: making a white picture, drawing the flag on the white
> > picture (includes cropping)(with the mask set as the clipping mask the
> > white background is untouched outside the flag) and than scale it.
> 
> You would have to take care with this since on certain themes the
> background may not be white, it may not even be a solid color at all.

I haven't thought about this. There is a mask arguement for
gtk_clist_set_pixmap. So this is not a problem.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  reality.sys corrupt. Reboot Universe? (y,n,q)


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