SDL bitmap stretching question
/*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??
-----------------------My Page: † AncienT RituaL †
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().
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.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
Include the comment as well
/* Insane Kung Fu, Quack hackery, and probably soon broken! */
SDL_SoftStretch(source, sourcerect, destination, destrect);
/* Insane Kung Fu, Quack hackery, and probably soon broken! */
SDL_SoftStretch(source, sourcerect, destination, destrect);
I'm not sure if this will help, but I did find this on SourceForge.
From the Project Info Page:
It looks pretty interesting. Or you could always switch over to teh darkside and use Allegro [grin].
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].
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.
2 of the big things it handles better than SDL, blending and stretching.
PM me if you are interested.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Thanks for the help to you all
I think I will make my 2D engine engine using OpenGL
I think I will make my 2D engine engine using OpenGL
-----------------------My Page: † AncienT RituaL †
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement