Jump to content
  • Advertisement
Sign in to follow this  
Godlike

SDL bitmap stretching question

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

/*Code*/ SDL_Surface* screen = SDL_SetVideoMode(640, 480, 8, SDL_HWSURFACE | SDL_ANYFORMAT | SDL_DOUBLEBUF); SDL_Surface* image; image = SDL_LoadBMP(“C:\b.bmp”); //a 200x200 bitmap /*End Code*/ What should I do then in order to draw the 200x200 bitmap stretched into the 640x480 screen surface??

Share this post


Link to post
Share on other sites
Advertisement
As far as I know, SDL does not support Stretch-Blitting. However, SDL_gfx does. You can download it at: http://www.ferzkopp.net/~aschiffler/Software/SDL_gfx-2.0/. The functions you want is zoomSurface().

Share this post


Link to post
Share on other sites
Yes but SDL_gfx is slow. There is another library that allows bitmap rotation, SDL_rotozoom, which is equally if not much more slower. If you want to stretch-blit you're better off with a 3D API such as OpenGL.

Share this post


Link to post
Share on other sites
Include the comment as well

/* Insane Kung Fu, Quack hackery, and probably soon broken! */
SDL_SoftStretch(source, sourcerect, destination, destrect);

Share this post


Link to post
Share on other sites
I'm not sure if this will help, but I did find this on SourceForge.

From the Project Info Page:
Quote:

Providing stretch and blit routines for SDL surfaces. These are optimized for speed including lots of assembler parts in the general routines and dynamic cpu native code generation for applications to compile specialized stretch-and-blit routines at runtime.


It looks pretty interesting. Or you could always switch over to teh darkside and use Allegro [grin].

Share this post


Link to post
Share on other sites
Or, if software rendering isn't fast enough, I am working on a 2d library based off of openGL. It is designed to look as much like SDL as possible. With minimal effort, you could port you app to openGL using my library. It is still in a pre-release state until I can get documentation written, but I can help you as you go with it.

2 of the big things it handles better than SDL, blending and stretching.

PM me if you are interested.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!