1. ## SDL problem

I'm using SDL_Surface for my bitmaps, the thing is i want to rotate and scale my bitmaps, and
blit them after that. Is there a gl function for this, or should i write an algorithm for it. In case
so, give me some tips - i need this scaling and rotating to be fast as possible.

2. I don't believe there are built-in functions with SDL that do this.

BTW, if you can rotate PNGs, you should probably use those. Bitmaps are really freaking huge.

3. I recommend the SDL Graphics Extension (http://www.etek.chalmers.se/~e8cal1/sge/)
It does scaling/rotation, as well as some other stuff that might be handy

4. but i just want scaling and rotation, not other stuff...

5. and besides i'm using SDL_Image, so it doesn't matter what i load ( .jpg .bmp .png ... ) it's all SDL_Surface

6. If you want to do it yourself then read this for scaling:http://scien.stanford.edu/class/psyc...cts/99/emkwok/

rotation pseudocode:
Originally Posted by some site :)
Code:
float OriginalXPos = 0;
float OriginalYPos = 0;
for (long Y = 0; Y < ImageHeight; Y++)
{
float CurrentXPos = OriginalXPos;
float CurrentYPos = OriginalYPos;
for (long X = 0; X < ImageWidth; X++)
{
TargetPixel [Y][X] = Image [CurrentYPos][CurrentXPos];
CurrentXPos += cos (Angle);
CurrentYPos += -sin (Angle);
}
OriginalXPos += sin (Angle);
OriginalYPos += cos (Angle);
}

7. thanks. but this rotation pseudocode isn't the fastest way, i gues...

8. I can't get cos, sin, (sin) on -1 to work! <math.h> sucks
can you post an example of using cos, sin, -sin with some library

9. i get these when i try to use cos(), sin() from <math.h>

10. Well your problem is that you need to cast whatever you enter into cos or sin to float.
Example...
Code:
#include <math.h>
int main()
{
cos((float)5);
}
As far as speed goes it should be fine if you compute sin and cos of Angle outside of the loop.

The only other consideration is that a rotated picture is going to be bigger than a nonrated one. You have to compensate by calculating how big your rotated surface is going to be. Also, it may be neccesary to set the unused parts of the rotated surface transparent.

11. Let me know if you get it to work. I'm trying to do the same thing: http://cboard.cprogramming.com/showthread.php?p=528010

BTW, it doesn't work if you just rotate each pixel individually.

12. Code:
#define PI 3.14159
#define DEGTORAD(angle)  (float) ( (angle) * (PI) / (180.0f )
...

float MYSIN[360];
float MYCOS[360];
for (int i=0;i<360;i++)
{