[crossfire] Partial transparency

Mark Wedel mwedel at sonic.net
Mon May 29 02:55:52 CDT 2006


Nicolas Weeger (Laposte) wrote:
> Hello.
> 
> GTK client (I didn't test the other clients) doesn't seem to support partial 
> pic transparency.
> 
> Has anyone tried to implement that?
> 
> I'm asking because my centipede would look much nicer :)

  IIRC, gtk has no convenient way on handling the alpha channel (the 
inconvenient way would be for the program to figure it all on its own, figuring 
out the appropriate RGB values, and then drawing those point by point to the 
screen.  This is also pretty CPU intensive).  So I don't expect to add that 
support anytime soon (it would basically be a complete re-write of how images 
are handled).

  The opengl draw mode of the gtkv2 client most certainly does handle partial 
transparencies, but I've never tested it (ok, most certainly might be an over 
statement).  However, opengl handles alpha channel images, and the client is 
just passing the data to opengl, so it should all work.  And since the blending 
will be done by your graphics card (if supported) it should be quite fast.

  That said, opengl support is only in the gtkv2 client (but probably would be 
pretty easy to port back to the gtkv1 client).  Also, only supported on unix/X11 
right there.  There are I think 20-30 lines of code in the file related to 
initializing opengl with X11 - for windows or other OS's, those would need to be 
rewritten to use whatever the proper native code needs to be.

  I believe the SDL draw mode (in both gtkv1 and gtkv2, but IMO, with opengl 
mode, SDL mode should go away) also supports alpha channel values.  Once again, 
I don't know if this has ever been tested, but SDL does, and like opengl, we're 
jsut passing the data to SDL to handle, so it should be doing the right thing. 
That said, my experience with SDL is that it is relatively slow - I think that 
the blending is being done by the main cpu, and not the gpu.  However, with a 
fast enough cpu this probably still works.


> 
> Nicolas
> 
> _______________________________________________
> crossfire mailing list
> crossfire at metalforge.org
> http://mailman.metalforge.org/mailman/listinfo/crossfire




More information about the crossfire mailing list