🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Speed of color-keying (or something)

Started by
3 comments, last by Drki 24 years, 7 months ago
The transparent one will be a lot faster. Each pixel of the non-transparent one will have to be written to the destination surface, but none will on the transparent one. Blit checks each pixel to see if it matches the color key, and if it does, it doesn't write it to the destination surface. Now blitting with a color key when the surface has none of that color will be slower than if you don't blit with the color key because it won't have to check each pixel to see if it matches the color key.

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

Advertisement
What are you talking about? Bliting a surface with transparent pixels is much slower then one with all non-transparent pixels. If you need to blit a transparent pixel then you blit with a color key. If you don't need to blit any transparent pixels then don't use the color key, then it doesn't have to check each pixel.

note: the fastest method of bliting a sprite with transparent pixels is to make it into a compiled sprite.

William Reiach - Human Extrodinaire

Marlene and Me


Anyways, who would want to blit a totally transparent sprite?
William Reiach - Human Extrodinaire

Marlene and Me


Lets say one surface doesent have any transparent parts and the other is totaly transparent.
Whitch one will be blted faster(or they will be blted the same speed)
Not the issue. It IS faster not to move a pixel compared to actually moving it. E.g.

get pixel into register
if (! pixel transparent)
write pixel

is faster than

get pixel into register
write pixel

If there's a "sufficient" number of transparent pixels (I have no exact numbers - do the test)...

/Niels

<b>/NJ</b>

This topic is closed to new replies.

Advertisement