Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch
Home

[Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cameron@xxxxxxxxxx, esr@xxxxxxxxxxx, sambc@xxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 13:28:15 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Jan 07, 2003 at 12:51:24PM -0800, esr@xxxxxxxxxxx via RT wrote:
> Raimar Falke via RT <rt@xxxxxxxxxxxxxx>:
> > > I've written a Python class that can parse FreeCiv data files.  I
> > > plan to combine it with the Python Imaging Library to write a little
> > > tool to make composing flags and shields for nations easier.
> > 
> > What do you mean here with composing? Creating the flags.png file?
> 
> Yes, and the shields file as well.  I couldn't get the GIMP plugin script 
> to work; the HOWTO's instructions are unhelpful, I fear.
> 
> The main consequence of the tool design I have in my head is that it
> will become easy to break flags and shields files into individual
> icons, reassemble them, and re-order them.  The hard part -- parsing
> the data files to break out the icon coordinates and associate them
> with the f.names -- is already done.  It's a set of mods to the Python
> ConfigParser library.
> 
> The easy part will be dicing and reassembling the icon-array PNGs.
> PIL is really good for stuff like that.  I won't have to write any C,
> and it will surprise me greatly if the Python code to do it is more
> than thirty lines or so.

I have no idea how much this simplifies it to add a flag.

> I'm missing one piece of information before I can do the easy part.  Once
> I know the row/column coordinates of an icon, how do I define the 
> clipping rectangle to extract it?  I know it must have something to
> do with the dx and dy properties, but those don't seem like enough
> information.   If my mental model of the problem is correct,  
> think I need to know four numbers:
> 
> (sx, sy) -- The size of the icon.  This is not constant, even within the 
>             same flags file.  I remember noticing that in one of them the
>             Russian flag is larger than the others.  How do I compute this?
>             Am I expected to do some kind of lassoing number where I have to
>             grab a maximum-sized rectangle and clip the transparent bits?
> 
> (nx, nx) -- the grid spacing of the icons.  It looks like their upper-left
>             corners are regularly spaced, so that multiplying the row/column
>             numbers by some pair of fixed pixel deltas will get you there.
>             It looks like that's what dx and dy are; am I correct?  

This is only reading the source code. I have never created a spec
file:

  Each PNG file divided into equal sized tiles of size (dx,dy). There
  may _one_ pixel spacing between these if is_pixel_border is set true
  in the spec file.

For the flags and for the flags only: we crop the sprite further
(gui-gtk/plrdlg.c:build_flag) by calling
gui-gtk/graphics.c:sprite_get_bounding_box and
gui-gtk/graphics.c:crop_sprite. And yes this is isn't what I would
call nice.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 checking for the vaidity of the Maxwell laws on this machine... ok
 checking if e=mc^2... ok
 checking if we can safely swap on /dev/fd0... yes
    -- kvirc 2.0.0's configure 




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