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, sambc@xxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch
From: "esr@xxxxxxxxxxx via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 12:51:24 -0800
Reply-to: rt@xxxxxxxxxxxxxx

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'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?  
-- 
                <a href="http://www.tuxedo.org/~esr/";>Eric S. Raymond</a>



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