Skip to content

Instantly share code, notes, and snippets.

@TheTimgor
Created March 5, 2021 07:51
Show Gist options
  • Save TheTimgor/a8962206f89b51adb425e8a90492e3e0 to your computer and use it in GitHub Desktop.
Save TheTimgor/a8962206f89b51adb425e8a90492e3e0 to your computer and use it in GitHub Desktop.
def fast_rot(width, height, raster):
for j in range(0, width):
for k in range(0, height):
to = width * height - (height * j + k + 1)
i = (width - j - 1) + width * k
if i != to:
while i > to:
i = width * (height - (i % height) - 1) + ((i - (i % height)) / height)
buffer = raster[int(i)]
raster[int(i)] = raster[int(to)]
raster[int(to)] = buffer
return raster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment