SDL_image quality

Hi,
I’ve noticed that when I try to load file with a gradient using
SDL_image, regardless of format the gradient goes away and I’m left with
a very non-smooth color transition, as if the image had been converted
to 8 bit with no dithering. It happens with showimage as well, so I
don’t think I am leaving something out. Any suggestions what is going
wrong and how to fix it?
The images load fine in GIMP by the way, I’m using a radial gradient if
that makes any difference. Any help would be greatly appreciated. Oh, I
am now using SDL_image 1.2, although the problem also existed in 1.1.

that makes any difference. Any help would be greatly appreciated. Oh, I
am now using SDL_image 1.2, although the problem also existed in 1.1.

If you could email me an example image, I’ll take a look.

–ryan.

Are you running in 16-bit color?–

Olivier A. Dagenais - Software Architect and Developer

“John Garrison” wrote in message
news:3B465106.C8850C84 at visi.net

Hi,
I’ve noticed that when I try to load file with a gradient using
SDL_image, regardless of format the gradient goes away and I’m left
with
a very non-smooth color transition, as if the image had been
converted
to 8 bit with no dithering. It happens with showimage as well, so I
don’t think I am leaving something out. Any suggestions what is
going
wrong and how to fix it?
The images load fine in GIMP by the way, I’m using a radial gradient
if
that makes any difference. Any help would be greatly appreciated.
Oh, I
am now using SDL_image 1.2, although the problem also existed in
1.1.

Olivier Dagenais wrote:

Are you running in 16-bit color?

Yep, sorry, should have probably specified that shouldn’t I? :)> –


Olivier A. Dagenais - Software Architect and Developer

“John Garrison” <@John_Garrison> wrote in message
news:3B465106.C8850C84 at visi.net

Hi,
I’ve noticed that when I try to load file with a gradient using
SDL_image, regardless of format the gradient goes away and I’m left
with
a very non-smooth color transition, as if the image had been
converted
to 8 bit with no dithering. It happens with showimage as well, so I
don’t think I am leaving something out. Any suggestions what is
going
wrong and how to fix it?
The images load fine in GIMP by the way, I’m using a radial gradient
if
that makes any difference. Any help would be greatly appreciated.
Oh, I
am now using SDL_image 1.2, although the problem also existed in
1.1.

I am assuming you are converting your image formats to your local screen format
before blitting (using SDL_DisplayFormat, or SDL_ConvertSurface or whatever).
This will cause the loss of visual gradiation you’re talking about.

One way (there are other, perhaps better ways) to fix this is to not convert
your image format to the local screen format. If you don’t convert it, the
image visually retains the gradiation, but will be much slower to blit each
time.

There are other more complicated ways to do this, and even image tricks you can
do, that make the blits faster… but this is the most direct method.

If this doesn’t help, post an example of your code online somewhere and point
us to it so we can take a loot.On Fri, 06 Jul 2001, you wrote:

Hi,
I’ve noticed that when I try to load file with a gradient using
SDL_image, regardless of format the gradient goes away and I’m left with
a very non-smooth color transition, as if the image had been converted
to 8 bit with no dithering. It happens with showimage as well, so I
don’t think I am leaving something out. Any suggestions what is going
wrong and how to fix it?
The images load fine in GIMP by the way, I’m using a radial gradient if
that makes any difference. Any help would be greatly appreciated. Oh, I
am now using SDL_image 1.2, although the problem also existed in 1.1.


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

Samuel Hart wrote:

Hi,
I’ve noticed that when I try to load file with a gradient using
SDL_image, regardless of format the gradient goes away and I’m left with
a very non-smooth color transition, as if the image had been converted
to 8 bit with no dithering. It happens with showimage as well, so I
don’t think I am leaving something out. Any suggestions what is going
wrong and how to fix it?
The images load fine in GIMP by the way, I’m using a radial gradient if
that makes any difference. Any help would be greatly appreciated. Oh, I
am now using SDL_image 1.2, although the problem also existed in 1.1.

I am assuming you are converting your image formats to your local screen format
before blitting (using SDL_DisplayFormat, or SDL_ConvertSurface or whatever).
This will cause the loss of visual gradiation you’re talking about.

One way (there are other, perhaps better ways) to fix this is to not convert
your image format to the local screen format. If you don’t convert it, the
image visually retains the gradiation, but will be much slower to blit each
time.

There are other more complicated ways to do this, and even image tricks you can
do, that make the blits faster… but this is the most direct method.

If this doesn’t help, post an example of your code online somewhere and point
us to it so we can take a loot.

Actually I don’t call SDL_Display format. The relevant code is basically
just:

SDL_Surface *Background, *Screen;
SDL_Rect src, dest;

SDL_Init(SDL_INIT_VIDEO);
Screen = SDL_SetVideoMode(800, 600, 16, SDL_HWSURFACE);

Background IMG_Load(“images/image.png”);

src.x = 0;
src.y = 0;
src.w = 800;
src.h = 600;

dest.x = 0;
dest.y = 0;
dest.w = 800;
dest.h = 600;

SDL_BlitSurface(Background, &src, Screen, &dest);
SDL_Flip(Screen);

Maybe SDL_Image calls SDL_DisplayFormat before returning the surface?> On Fri, 06 Jul 2001, you wrote: