Jump to content
  • Advertisement
Sign in to follow this  
raptorstrike

making a surface = to part of larger surface

This topic is 5115 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

Advertisement
Write your own function? It should just be as simple as creating x*y new surfaces and then blitting from the larger ones to the smaller one.

Share this post


Link to post
Share on other sites
[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
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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!