Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8215) win32 client: draw_fog_part doesn't use a mask
Home

[Freeciv-Dev] (PR#8215) win32 client: draw_fog_part doesn't use a mask

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8215) win32 client: draw_fog_part doesn't use a mask
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Wed, 24 Mar 2004 19:34:32 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8215 >

> [jdorje - Thu Mar 25 00:14:37 2004]:
> 
> James Canete wrote:
> 
> > There is an AlphaBlend() function in Windows GDI, but according to MSDN
> > it's not supported under Windows 95.  I could write a function to alpha
> > blend pixel by pixel, but it'd probably be very slow.  Though it'd only
> > be slow when creating the fog sprites.
> 
> Seems reasonable.  Can you use this function to draw fog at draw-time 
> without loss of speed?

Not at draw time.  It either uses a constant alpha to do blending, or it
uses the per-pixel alpha of the source bitmap.  I'd have to create a
bitmap at draw time with a alpha that matches the sprite mask, and at
present I can't think of a fast way to do this.

As is, the current gui-win32 code doesn't create an alpha channel when
loading sprites, it instead creates a separate bitmap and mask.  And the
win32 masks are peculiar in that they don't really mask drawing, they
just cut out holes in which drawing can be done.

In the end, it would probably be easier to implement alpha blended
sprites before trying to do alpha blended fog.  Then I could simply
create a new sprite at draw-time and blend a darkness sprite into it.

I also found out that AlphaBlend() requires me to "#define WINVER
0x0500" (WinME/WinNT) otherwise wingdi.h doesn't prototype the function,
and I also have to link libmsimg32.a.

I wonder if it's time to debate moving the gui-win32 client to
DirectDraw, or splitting off a DirectDraw variant. :)

-James Canete


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