I can change the size of surface, don^t window?

Specifically need I blit a big image to little window

Specifically need I blit a big image to little window

Which function you use depends on if you are using 1.2 or 2.0. But the concept is the same. I’ll use 1.2 since you said “blit” and “surface” rather than “render” and “texture” :wink:

SDL_Surface *bmp; // A pointer to a 800x600 image
SDL_Surface *screen; // A pointer to the 640x480 screen
SDL_Rect src; // source rectangle (tells what part of bmp to use)
SDL_Rect dest; // destination rectangle (tells what part of screen to blit to)

So, lets say you want to blit the first 640x480 of bmp:
src.x = 0; src.y = 0; src.w=640; src.h=480;
dest.x = 0; dest.y=0;dest.w=640;dest.h=480; // Since you will be filling the whole screen, this part isn’t needed. You can pass null rather than dest.
SDL_Blit(bmp, &src, screen, &dest); //&dest can be NULL and this will still do the same thing.

Now, lets say you want to show the lower 640x480 of bmp:
src.x = (bmp->w-640); src.y = (bmp->h-480); src.w=640; src.h=480;
dest.x = 0; dest.y=0;dest.w=640;dest.h=480; // Since you will be filling the whole screen, this part isn’t needed. You can pass null rather than dest.
SDL_Blit(bmp, &src, screen, &dest); //&dest can be NULL and this will still do the same thing.

Last of all, lets say you only want to show a piece of the bmp and show it only on part of the screen:
src.x = 100; src.y = 100; src.w=50; src.h=50;
dest.x = 250; dest.y=45;dest.w=50;dest.h=50;
SDL_Blit(bmp, &src, screen, &dest);

If you want to render the full 800x600 to a 640x480 window, then you have to do scaling. With 1.2 look at the SDL_gfx library. The functionality is built in to 2.0.

I hope that answered your question.
If not, try to be a little more specific.

Thank, I will rtfm SDL_gfx :slight_smile: . SDL_Rect I use of course.
SDL 2.0? :o This don*t in my repository (openSUSE-12).

Thank, I will rtfm SDL_gfx :slight_smile: . SDL_Rect I use of course.
SDL 2.0? :o This don*t in my repository (openSUSE-12).

There isn’t an official SDL 2.0 just yet. It is a work in progress. You’d have to grab the source from the repository.
It uses hardware acceleration where available. So it’s scaling would be a lot faster when there is hardware acceleration.
If you don’t mind dabbling with downloading from the repository and building SDL yourself, then I’d see about switching to SDL 2.0.

Otherwise, SDL_gfx’s rotozoom is probably your best option.