I need to rotate a bmp given an angle in multiples of 90. Im trying to figure out how to accomplish this. Can somebody guide me in the right direction to approach this problem?
The rotation angles, which are multiples of 90 could be positive as well as negative. It should also accept angle 0
thanks for your time in advance.
better approach:
struct bitmap
{
int** array[3]; //RGB
int N;
int M;
};
void f(struct bitmap source, struct bitmap dest)
{ for(int i=0;i<source.N;i++)
{
for(int j=0;j<source.M;j++)
{
dest.array[j][source.N-i-1]=source.array[i][j];
}
}
dest.N=array.M;
dest.M=array.N;
}
Here's a picture
to rotate anti-clockwise you change only
dest.result[source.M-j-1][i]=source.array[i][j];