Setting a transparent color in Pixie

<< < (2/8) > >>

Cycl0ne:
Quote

To make a sprite semi-transparent, you simply need to call SetAlpha. The reason for this is that colours are 16 bits in Pixie, and thus there's no room for an alpha (transparency) component, which is why it has a separate function.


Ohh you dindt get me on this. I dont want the whole sprite to be transparent. I want to select one color to be transparent.
I know, that i can select with irfanview (saving it as a png file) to select a transparent pixel. And that pixie recognizes this. But what should i do, if i would like to change this transparent pixel on the fly? In SDL you have the Function: SDL_SetColorKey(); With this you can say, that one special kind of color is transparent for the Sprite.

Mattias Gustavsson:
Hmm, using transformations should work with the current code... Mirror_Y should flip the sprite upside down. But it won't work if the bitmap type is any of the RLE formats (but again, next version of pixie will have support for transforms even on RLE bitmaps).

Ah, ok, I hear you on the colour key issue. The reason I don't support color keys, is mostly for efficiency reasons - to do blitting with a colour key means doing a comparison for each pixel. On the other hand, using an alpha channel and .PIX files in RLE format, means that empty pixels will just be skipped - so it will in fact be faster than blitting non-compressed files.

If I were to add colour key support, I would actually add it to PixiePCT, the picture conversion tool, as an option to automatically generate an alpha channel from the specified colour...

Cycl0ne:
MIRROR_Y didnt work.. because it was an RLE .. correct ;-)

Hmm, so you tell me, if i work through the sprite bitmap and set every pixel i find, i wish to be transparent, in the alphachannel, this should work?

then this would be a very easy "colorkey" implementation or?

Mattias Gustavsson:
yes, that should definitely work - but if you put it into the code which generates RLE files, and use them, it will be much faster (but if you don't use many sprites, that's not a problem)

Cycl0ne:
Hmm, the problem is, that i have a special sprite with two transparent colors. At first i need to blit it to a wall or door sprite with the outer transparent color set. after that i need to blit both with the inner transparent color to the screen to "see" whats behind it. Thats the "look through wall/door" spell.

To be honest, im working on a Clone of Dungeon Master with new Graphics for mobile devices as tablets in 1280x800x16. Here are some graphics from my gfx artist:



I think this is a perfect game for tablets/mobile devices and pixie is great for developing under windows and porting it to android.

Navigation

[0] Message Index

[#] Next page

[*] Previous page