Problem with transparency drawig a sprite onto another

Started by jerakeen, Thu 15/01/2009 13:23:51

Previous topic - Next topic

jerakeen

When i draw sprites using transparency onto another, if the second one has a image background it works all right and use transparency.
But when i clear the second sprite with clear() or clear(COLOR_TRANSPARENT), the sprites i draw has transparent colour instead being transparent.

All the sprites, background etc has the same color depth
I use AGS v3.1.1

Code: ags

    DynamicSprite * sprParticleSystem = DynamicSprite.CreateFromBackground();
    surface = sprParticleSystem.GetDrawingSurface();
    surface.Clear();

    DynamicSprite  *sprite = DynamicSprite.CreateFromExistingSprite (18, false);
    surface.DrawImage (5, 5, sprite.Graphic, 40);
    sprite.Delete();

    surface.Release();

    Overlay * ovrParticleSystem = Overlay.CreateGraphical(0, 0, sprParticleSystem.Graphic, true);

   ...

   sprParticleSystem.Delete();
   ovrParticleSystem.Remove();


WhatI'm doing wrong?

EDIT:

This is an example of what im doing

     

the first image shows when i draw sprites transparent into another sprite cleared to transparent colour

the second one shows when i draw sprites transparent into other sprite with background


Please tell me something.

I'm wrong posting here, and should post on technical forum?


Pumaman

Are you using any sprites with alpha channels? What colour depth is the game?

jerakeen

I tried with sprites in 32 color depth without alpha channels, and game at 32 depth too and this is what happens.

Then i tried sprites with alpha channel and without using transparency and happens the same, this pink colour again. (sprites and game at 32 color depth)

So i don't understand what happens.




Pumaman

It's probably the transparency setting, whereby it's trying to draw 40% transparent pixels against the transparent colour (which is pink #FF00FF). If you remove the ",40" from the DrawImage command, do the pink areas disappear?

GarageGothic

CJ, in relation to this, I was wondering: How much work would it take you to implement alpha channel support for DrawingSurface routines, so that using DrawImage on a cleared surface with transparency or an alpha channel sprite would actually result in a DynamicSprite with an alpha channel rather than the effect we see in this example? Personally I would find it a very useful feature.

jerakeen

Yes Pumaman, it draws the sprite opaque, exactly as i imported into the sprite editor

SMF spam blocked by CleanTalk