[Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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>
- [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch, Raimar Falke via RT, 2003/01/07
- [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch, Paul Zastoupil, 2003/01/07
- Message not available
- [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch, ChrisK@xxxxxxxx via RT, 2003/01/07
- Message not available
- [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch, esr@xxxxxxxxxxx via RT, 2003/01/07
- Message not available
- [Freeciv-Dev] Re: (PR#2591) Nondenominational calendar patch, Paul Zastoupil via RT, 2003/01/07
Message not available
|
|