Sign in to follow this  

making a surface = to part of larger surface

This topic is 4742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[source lang = "cpp"]
//Setup SDL and other stuff. . .

SDL_Surface * BigSurface = SDL_LoadBMP("BIGIMAGE.bmp");

SDL_Rect SmallImage;
SmallImage.x = 0;
SmallImage.y = 0;
SmallImage.w = 100;
SmallImage.h = 100;
SDL_Surface * SmallerImage = SDL_CreateRGBSurface(0, SmallImage.w, SmallImage.h, 32, 0 0 0 0); // More info look in the docs

SDL_BlitSurface(BigSurface, &SmallImage, SmallerImage, NULL);

Share this post


Link to post
Share on other sites
Quote:
Original post by raptorstrike
well the first method wont work because i dont want to blit them i want to save them to a file and the second one wont work because it only makes a solid 1 color surface thanks for the replys though


you can save an SDL Surface to a file using SDL_SaveBMP().

Share this post


Link to post
Share on other sites

This topic is 4742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this