Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2001:
[Freeciv-Dev] flag scaling problem
Home

[Freeciv-Dev] flag scaling problem

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] flag scaling problem
From: Karl-Ingo Friese <kif@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 16 Jun 2001 14:57:56 +0200 (CEST)

Hello again,

I am currently trying to enhance the player report again, based on a
suggestion by Peter Barker:

> The feature I was going to work on next was adding a "Flag" column to this
> dialogue. Primary reason is that last lan-game we had, people were having
> trouble remembering which flag was which since they only had two mouse
> buttons.
>
> I don't suppose while you're hacking that code you'd care to add
> it?

The idea sounded good, so I implemented it. A first picture of this can be
found at:

   www-c.informatik.uni-hannover.de/~kif/civ/plrs4.jpg

Now I have the following problem: I had to scale the flag pixmaps to fit
into the rows (row heigh depends on the font using to display the playerinfos).
I did this by using the gtk_scale_pixmap() function from
client/gui-gtk/gui_stuff.h.

So far so good. The problem is, that the original flag pixmaps contains
not only the flag image, but "unused" pixels, because the flag pixmap
dimensions seem to be related to the tileset dimensions. To get a proper
image, I would need to find out the dimensions of the "real" flag. Even
better, create an original-flag-pixmap first, containing only the flag-image
itself, and scaling it later. Right now, the unused pixels are scaled as
well, resulting in a black border and very small flag picture.

What I am doing right now is:

void build_flag(int playerindex) {
  double oldh, oldw, flagh, flagw;

  oldw=get_nation_by_idx(playerindex)->flag_sprite->width;
  oldh=get_nation_by_idx(playerindex)->flag_sprite->height;

  flagh=GTK_CLIST(players_list)->row_height;
  flagw=(flagh/oldh)*oldw;

  flags[playerindex]=gtk_scale_pixmap(
    get_nation_by_plr(&game.players[playerindex])->flag_sprite->pixmap,
    oldw, oldh,
    flagw, flagh);
}

Help would be very much appreciated!
ChaosE

PS: Please reply to me directly, since I am not on the developers mailing
    list yet.

-- 

Karl-Ingo Friese
kif@xxxxxxxxxxxxxxxxxxxxxxxxxx



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