[SDL] Stretch Blitting

michael brown n5qmg at earthlink.net
Sat Apr 25 11:09:51 PDT 2009


Vincent R. wrote:
> On Sat, 25 Apr 2009 15:05:13 +0200, "Vincent R."
> <forumer at smartmobili.com> wrote:
>> Hi,
>>
>> I wanted to evaluate SDL on windows CE and I am not convinced.
>> Firt thing I want to do is to load a png and reduce display size, is
>> it possible to do it ?
>> For instance I am loading a 320x240 png and I want to display it as
> 80x60.
>>> From what I read there is SDL_gfx but is very slow, so is there any
>>> other option ?
>>
>> Thanks
>
> I have found STL_Stretch and I have compiled it for wince.
> Now I don't really understand how to use it? If someone could provide
> a very small
> sample code where a png(240x320) is load and displayed centered in
> 80x60. I am trying this but with no success :
>
> static SDL_Surface *sprite;
>
> sprite = IMG_Load(file);
> converted = SDL_DisplayFormat(sprite);
>
> position.x = position.y = 0;
> position.w = 80;
> position.h = 60;
>
> updates[1] = position;
> SDL_StretchSurfaceBlit(sprite, NULL, screen, &position);

Shouldn't this be:
SDL_StretchSurfaceBlit(converted, NULL, screen, &position);

I remember you having problems until you called SDL_DisplayFormat.  Don't 
you need to use the "converted" surface?

> SDL_Flip(screen);




More information about the SDL mailing list