(where “amask” is of type “Uint32”; and notice that is “= ~” (equals not),
not “~=”), and use that as the amask you sent to SDL_CreateRGBSurface()
Let us know if that helps!
-bill!
As I can see I’m having same problem, I create a surface with previos
format->[RGBA]mask, then I SetAlpha(sfc, SDL_SRCALPHA, 255) but when I
FillRects with MapRGBA(r,g,b,a) I only get opaque rectangles, I tried
with this “trick” but I get everything BLACK, changing
SetAlpha(…,…,128) make the whole thing semitransparent
El mi?, 25 de 06 de 2003 a las 11:24, Bill Kendrick escribi?:
I had trouble with similar code. THen someone pointed out this neat
trick… Instead of using “oldSurface->format->Amask”, try:
amask = ~(oldSurface->format->Rmask |
oldSurface->format->Gmask |
oldSurface->format->Bmask);
(where "amask" is of type "Uint32"; and notice that is "= ~" (equals not),
not "~="), and use that as the amask you sent to SDL_CreateRGBSurface()
Let us know if that helps!
-bill!
As I can see I’m having same problem, I create a surface with previos
format->[RGBA]mask, then I SetAlpha(sfc, SDL_SRCALPHA, 255) but when I
FillRects with MapRGBA(r,g,b,a) I only get opaque rectangles, I tried
with this “trick” but I get everything BLACK, changing
SetAlpha(…,…,128) make the whole thing semitransparent
If I understand correctly, then I think your ‘problem’ is with SDL_FillRect().
If you read the documentation for SDL_FillRect() you will find:
“If the color value contains an alpha value then the destination is simply
’filled’ with that alpha information, no blending takes place.”
Hope that helps,
cheers,
John.On Sunday 29 June 2003 3:19 am, pirata wrote:
As I can see I’m having same problem, I create a surface with previos
format->[RGBA]mask, then I SetAlpha(sfc, SDL_SRCALPHA, 255) but when I
FillRects with MapRGBA(r,g,b,a) I only get opaque rectangles, I tried
with this “trick” but I get everything BLACK, changing
SetAlpha(…,…,128) make the whole thing semitransparent
As I can see I’m having same problem, I create a surface with previos
format->[RGBA]mask, then I SetAlpha(sfc, SDL_SRCALPHA, 255) but when I
FillRects with MapRGBA(r,g,b,a) I only get opaque rectangles, I tried
with this “trick” but I get everything BLACK, changing
SetAlpha(…,…,128) make the whole thing semitransparent
Any help?
If I understand correctly, then I think your 'problem' is with SDL_FillRect().
If you read the documentation for SDL_FillRect() you will find:
"If the color value contains an alpha value then the destination is simply
'filled' with that alpha information, no blending takes place."
Hope that helps,
cheers,
John.
Oops!, you’re right!, I missed it out
Thanks a lot
PirataOn Sun, 2003-06-29 at 13:33, john popplewell wrote:
On Sunday 29 June 2003 3:19 am, pirata wrote: