Page 1 of 1

Opacity with Color Key

PostPosted: Aug 12, 2003 @ 12:04pm
by rsequeira
Hi all,

I'm stuck with an annoying problem:
I'm blitting a surface with color key, as many others, but I'm trying to do a fade-out effect. By the docs, you could do that simply with a blit with GDBLT_KEYSRC | GDBLT_OPACITY flags, which should do the effect.
My problem is that it seems that GapiDraw is doing the operations in the reverse order: ie. instead of applying opacity AFTER keysrc, it's applying opacity BEFORE keysrc which makes the undesired effect of having the sprite tend to the transparent color (255, 0, 255 in my case, which makes the sprite progressively becoming a pink rectangle) instend of blend with the BG.

Has anyone got any ideas?
Thx in advance.

Ricardo

PostPosted: Aug 13, 2003 @ 1:01am
by seb0uille

PostPosted: Aug 13, 2003 @ 10:34am
by rsequeira
The SetColorKey's where in init methods and are working well without the, but I've tried to concentrate the code in one block just to be sure, with the same result. The code is of the uttermost simplicy and should work, so here goes:

RECT clip;
clip.bottom = 100;
clip.left = 0;
clip.right = 10;
clip.top = 0;

GDBLTFX flags;
surface.CreateSurface(GDSURFACE_CLEAR, "test.png");
surface.SetColorKey(RGB(255,0,255));
dst->SetColorKey(RGB(255,0,255));
flags.dwOpacity = 128;

dst->Blt(&clip, &surface, NULL, GDBLT_KEYSRC | GDBLT_OPACITY, &flags);


What I get is the a pink colorized sprite instead of a half opaque key-colored sprite.
Thank you for the attention!

PostPosted: Aug 13, 2003 @ 7:32pm
by Sm!rk

PostPosted: Aug 14, 2003 @ 12:01am
by Guest

PostPosted: Aug 14, 2003 @ 3:02am
by ppcStudios