int SDL_BlitSurface(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);src (first argument) is the SDL_Surface that you want to draw on to some other surface.
srcrect (second argument) is the rectangle that you want to cut out of src surface.
dst (third argument) is the SDL_Surface that you want to draw the src surface on.
srcrect (third argument) will decide where on the dst it will draw.
// The surface that we want to draw SDL_Surface* src = SDL_LoadBMP("img.bmp"); // The area that we want to draw from img.bmp. SDL_Rect srcrect; // The area is ... srcrect.w = 100; // ... 100x100 pixels ... srcrect.h = 100; // srcrect.x = 0; // ... with the top left corner located at position (0,50) srcrect.y = 50; // // The surface that we want draw on. SDL_Surface* dst = SDL_GetVideoSurface(); // The screen surface // The position on the screen where the top left corner of the cropped image will be drawn. SDL_Rect dstrect; dstrect.x = 10; dstrect.y = 20; // w and h will not be used by SDL_BlitSurface. SDL_BlitSurface(src, &srcrect, dst, &dstrect);