Need help rotating a PPM image 90 degrees to the right!
I am trying to write a function rotate() that will rotate a PPM image 90 degrees to the right.
So far this is what i have (which doesn't work):
Code:
void rotate(pixel_t *image, int x, int y)
{
int r, c, red, green, blue;
for (c = 0; c < y; c++)
{
for (r = 0; r < x; r++)
{
red = (x-c-1)+(r*3);
green = (x-c-1)+(r*3+1);
blue = (x-c-1)+(r*3+2);
printf("%c%c%c", image[red].r, image[green].g, image[blue].b);
}
}
}
If you need to see the rest of the program let me know! Please help!