currently I use the next algorithm to rotate a 2d pixel array to 90 degrees, but it requires I do an memory extra buffer allocation. Is there another way to do this without allocating a new entire buffer? And with a simple way to specify if it needs to be 90 and -90?
unsigned int *output = (unsigned int*)malloc(inputBufferSize);
for (int pixel = 0, x = width - 1; x > -1; --x)
{
for (int y = 0; y < height; ++y)
{
output[pixel++] = input[width * y + x];
}
}