[SDL] New to SDL and have an alpha blitting question

pvwr at sympatico.ca pvwr at sympatico.ca
Thu Oct 31 08:32:00 PST 2002


   Robert,

   To copy every pixels with color different than FF you need to 
set the colorkey, setting the alpha value won't make a color 
disappear when blitting. So all you need is to set ff as the 
COLORKEY and an alpha value. I have done similar things and 
had no problem, if you can't solve it, send the code :).

   Also it's good that the background color on 
your font, if a bitmap, is the same color as the intermediate 
surface colorkey, or you will have to set a colorkey on it also.

   Paulo

> 
> From: Robert Diel <robert at littlebitlost.com>
> Date: 2002/10/31 Thu AM 10:30:43 EST
> To: sdl at libsdl.org
> Subject: [SDL] New to SDL and have an alpha blitting question
> 
> Hello All,
>  I have recently started working with SDL and have had little to 
no
> problems until recently.  I am trying to create a transparent text
> overlay.  So, what I want to do is blit per-pixel alpha blended 
text
> onto a transparent surface, so that I can overlay this surface 
on
> different backgrounds.  My problem is that I cannot figure out 
how to do
> this without the entire surface either becoming fully opaque or 
fully
> transparent.  My biggest problem is I need to find out how to 
just copy
> the per-pixel alpha information from a character font onto a 
transparent
> surface, and then blit that surface.  I have tried creating a 
surface,
> then filling it with the color 0xff000000 where FF is the alpha 
value. 
> Then setting the alpha with SDL_SetAlpha to no 
SDL_SRCALPHA and no per
> surface alpha.  Then performing the blitsurface of the character 
onto
> that surface.  Then blitting that surface onto the background.  
This
> didn't work.  So, I tried just creating the surface in the GIMP, as 
just
> a .png with a fully transparent background, and using this 
surface in
> the same way, only to discover the same result.  I know I am 
just doing
> something stupid, can someone please help me out?
> Robert
> 
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 





More information about the SDL mailing list