[SDL] creating SDL_PixelFormat

Jimmy jimmy at jimmysworld.org
Tue Oct 15 13:19:01 PDT 2002


On Mon, 2002-10-14 at 16:38, Jacek Popławski wrote:
> On Mon, Oct 14, 2002 at 04:14:17PM -0400, pvwr at sympatico.ca wrote:
> >    If the pixel format you want to use on the conversion is the same as your
> >    video surface format, 
> 
> I've ask how to create PixelFormat _without_ Surface.

I think the answer that everyone here is groping for is 'no'.  There
isn't any simple function to call that'll take a couple of simple
parameters and spit out a format for you.

Given that a surface that's 1x1 of the format you want uses trivially
more memory than the format by itself, you're probably safest just
biting the bullet and keeping the whole surface.  I know it's gross, and
it feels like a hack... but the alternatives I know of would be to fill
the whole thing out by hand (which you mentioned you didn't want to do)
or creating a surface and just doing a malloc & memcopy on the surface
and then freeing the surface... which (to me anyway) feels even uglier
than keeping a small surface around.

> 
> -- 
> http://decopter.sf.net - free unrealistic helicopter simulator
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
-- 
Jimmy <jimmy at jimmysworld.org>
Jimmy's World.org






More information about the SDL mailing list