c - Rotate pixels 90 / -90 degrees without extra memory allocation -
currently use next algorithm rotate 2d pixel array 90 degrees, requires memory buffer allocation. there way without allocating new entire buffer? , simple way specify if needs 90 , -90?
unsigned int *output = (unsigned int*)malloc(inputbuffersize); (int pixel = 0, x = width - 1; x > -1; --x) { (int y = 0; y < height; ++y) { output[pixel++] = input[width * y + x]; } }
Comments
Post a Comment