[SDL] sRGB alpha blending
Xavier Joubert
xavier.joubert at free.fr
Sat Feb 26 14:04:26 PST 2005
Hello Albert,
Selon Albert Cahalan <albert at users.sf.net>:
> That's nothing like, for example, sRGB to YCbCr or CIE L,a*,b*.
> What is normally thought of as a color space conversion will
> involve horribly complicated stuff like dealing with out-of-gamut
> values.
Your explanations are very interesting.
I knew something was wrong with alpha blending done the current way, but didn't
knew the rational behind this. I saw this recently in a small painting program
I'm writing for my daughter (and in some old painting programs in the past).
I think we must keep in mind the basic purpose of SDL. It is a multimedia
library. Most applications written using it doesn't care about wrong alpha
blending. Current implementation is enough to draw a nice antialised space ship
over a battlefield. Most applications don't want sRGB conversion, since this
would mean a big drop in speed.
Of course, painting programs badly need accurate alpha blending and don't care
that much about speed.
I see one way to handle this dilemna : implement a new
SDL_BlitSurfaceAccurateBlending() function that would use sRGB conversion. This
one would of course not be hardware accelerated, and so not recommended on
hardware surfaces.
Maybe this function would better fit an add-on lib than SDL itself...
Would it be enough for you ?
I think you can't expect SDL to ever work internaly in sRGB for the reasons I
gave above.
Best regards,
Xavier
More information about the SDL
mailing list