Converting 8bit surface to 32bit surface

i am working with an 8 bit surface for part of my application. the
8bit surface needs to be blitted or drawn to the 32 bit surface about
60 frames per second. i was trying to use SDL_BlitSurface without
converting but was getting an error. then i added SDL_DisplayFormat
right before and it worked. do i need to do that or is there a
better way, perhaps an sdl function that does that in one step so i
dont have to ?

how efficient or inefficient is sdl with 8 bit surfaces ?

i was using them so i could easily change the palette, if i use a 32
bit surface i would have to do more blits or color changes with each
palette change.

thanks

matt

Problem is, you’re doing that ANYWAY, aren’t you? (When you blit the
8bpp paletted surface over to your 32bpp RGB one.) Or, at least,
SDL_DisplayFormat() does it for you (and is, as you’ve found, a necessary
step).

Depending on what you’re doing, you may want to rethink how you’re using
the surfaces, and maybe do everything in the 32bpp surface…?On Tue, Sep 25, 2007 at 02:34:15AM -0500, matt hull wrote:

i was using them so i could easily change the palette, if i use a 32
bit surface i would have to do more blits or color changes with each
palette change.


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/

i am working with an 8 bit surface for part of my application. the
8bit surface needs to be blitted or drawn to the 32 bit surface about
60 frames per second. i was trying to use SDL_BlitSurface without
converting but was getting an error.

This should work, what error were you getting?

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

sorry for replying to an old email.

i tried it again and now it seems to work. i spent some time trying
to break it so i figure out what happened, but seems to work fine.On Sep 25, 2007, at 10:08 PM, Sam Lantinga wrote:

i am working with an 8 bit surface for part of my application. the
8bit surface needs to be blitted or drawn to the 32 bit surface about
60 frames per second. i was trying to use SDL_BlitSurface without
converting but was getting an error.

This should work, what error were you getting?

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org