[SDL] SDL_Image export image capability?
albert at users.sf.net
Tue Jan 18 09:09:57 PST 2005
On Tue, 2005-01-18 at 12:12, Philip D. Bober wrote:
> Albert Cahalan wrote:
> > It needs work. In your "src" directory, I get nothing from this:
> > egrep -i 'srgb|gamma|linear' *.c
> SDL doesn't store per-surface gamma info, so I thought no metadata is
> better than wrong metadata.
Yes, no metadata is better than wrong metadata.
While SDL is wrong to not handle per-surface gamma,
you can work around this by adding a flag argument.
You only need two values: sRGB and linear. You can
make that be 5 if you include all 4 sRGB rendering
For normal sRGB, do this:
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
(do NOT set gamma==2.2; this is wrong)
For linear, supply a gamma==1.0 value.
BTW, it appears that SDL is really clueless about gamma.
Data goes directly to screen, implying that sRGB is used.
Data is linearly alpha-blended, implying that linear RGB
is used. Well, data can't be both sRGB and linear RGB.
I see this as ugly dark outlines around alpha-blended
objects. Try a fuzzy line in Tux Paint, using yellow and
blue. (yellow on blue, or blue on yellow) I'd naturally
go for sRGB 0..255 with 8-bit unsigned channels, and for
linear RGB 0..1 with 32-bit float channels. Tux Paint has
some fast conversion tables if you need them, with 12-bit
accuracy going from linear RGB to sRGB.
More information about the SDL