[SDL] Alpha blending transparent PNGs

Cracker tcracker at vipmail.hu
Sat Oct 20 14:27:08 PDT 2007


            Ilya Olevsky wrote:"Using the PNG alpha = per pixel alpha. Fading a surface = per surface alpha. Youcan't mix the two in SDL 1.2 (I don't know if it's possible in SDL 1.3)."Jonathan Dearborn wrote:"If you didn't read the other response: The SDL docs say no mixing per-pixel and per-surface alpha. But if you'd like to do this, you'll just have to do it yourself. That means sacrificing a lot of speed, but in many cases it's still worth it. I always pop up when this topic is raised, so I'll direct you to download U32_SDL at http://pubpages.unh.edu/~jmb97. In that library, you'll find U32_Blit(), which by default calls U32_BlitClip() and then U32_BlendBlit(). I can't be sure that it works perfectly, but it should do the job... You may need to adjust the color-packing bit-shift part if you have problems with it."Hello again!Thanks for your answers. Speed is important in my program, so nothing left but to write my own image loading/displaying system and use SDL for input/timer handling only, or to not use transparent PNGs.But is it possible to blend a PNG which has no transparency, but instead of a background color, it has completely transparent alpha?Thanks again for your help.By the way: is this feature will be added to SDL 1.3?

--------------------------Hirdetés-----------------------------

Egy millió forintos ajánlatÁtlagosan ennyit veszítünk 10 év alatt rossz befektetéseinken. Hogyan kerülheti el Ön?
http://www.portfoliomoney.hu/befektetes.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20071020/be7fd433/attachment.html 


More information about the SDL mailing list