[SDL] Help with SDL_Convert

Lilith Calbridge lilith at dcccd.edu
Mon May 14 12:06:56 PDT 2007



>>> On 5/14/2007 at 1:14 PM, Ulrich Eckhardt <doomster at knuut.de>
wrote:
> I'll assume you mean SDL_ConvertSurface.

Sorry about that.  That will teach me to try to pen messages between
phone calls at the office.
 
> On Monday 14 May 2007 18:38:32 Lilith Calbridge wrote:
>> The name SDL_Convert implies that one surface is being converted to
>> another's format.  But in fact it returns a new surface.
> 
> Right, as the documentation says.
> 
>> My situation is that I have a surface that's a fraction of the size
of
>> my display surface.  But apparently I need to convert the surface so
that
>> when I blit it to the display surface it matches format.
> 
> I don't think so, but for performance reasons I would always convert
loaded 
> images to the display's format. Other than that, I think that you can
also 
> blit between surfaces of different formats, it then does the
conversion on 
> the fly.
> 
>> Does that mean that surface designated as "src" in the documentation
should
>> be the non-display surface that I need converted to the display
surface
>> format?
> 
> Yes. You call it with the surface you want to blit to the screen but
with 
> the 
> screen's format.

Let's say I have a surface called "terrain" and I want to convert it to
the format of "screen".

terrain2 =   SDL_Convert Surface (terrain, screen->format, options);

I assume that terrain2 points to a newly created surface and that
terrain is still pointing to a valid surface?

> Uli

-- 
Thanks,
Lilith


More information about the SDL mailing list