1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Revert using Image.rotate_90() from the previous commit

Image.rotate_90() is also changing the size of the image, which we don't want to, at least not yet
This commit is contained in:
Emmanouil Papadeas 2024-03-02 18:03:06 +02:00
parent 4a404b2883
commit b0a8ad17d4

View file

@ -218,11 +218,8 @@ func scale_3x(sprite: Image, tol := 50.0) -> Image:
func rotxel(sprite: Image, angle: float, pivot: Vector2) -> void:
if is_zero_approx(angle) or is_equal_approx(angle, TAU):
return
if is_equal_approx(angle, PI / 2.0):
sprite.rotate_90(CLOCKWISE)
return
if is_equal_approx(angle, 3.0 * PI / 2.0):
sprite.rotate_90(COUNTERCLOCKWISE)
if is_equal_approx(angle, PI / 2.0) or is_equal_approx(angle, 3.0 * PI / 2.0):
nn_rotate(sprite, angle, pivot)
return
if is_equal_approx(angle, PI):
sprite.rotate_180()
@ -408,11 +405,8 @@ func rotxel(sprite: Image, angle: float, pivot: Vector2) -> void:
func fake_rotsprite(sprite: Image, angle: float, pivot: Vector2) -> void:
if is_zero_approx(angle) or is_equal_approx(angle, TAU):
return
if is_equal_approx(angle, PI / 2.0):
sprite.rotate_90(CLOCKWISE)
return
if is_equal_approx(angle, 3.0 * PI / 2.0):
sprite.rotate_90(COUNTERCLOCKWISE)
if is_equal_approx(angle, PI / 2.0) or is_equal_approx(angle, 3.0 * PI / 2.0):
nn_rotate(sprite, angle, pivot)
return
if is_equal_approx(angle, PI):
sprite.rotate_180()
@ -428,12 +422,6 @@ func fake_rotsprite(sprite: Image, angle: float, pivot: Vector2) -> void:
func nn_rotate(sprite: Image, angle: float, pivot: Vector2) -> void:
if is_zero_approx(angle) or is_equal_approx(angle, TAU):
return
if is_equal_approx(angle, PI / 2.0):
sprite.rotate_90(CLOCKWISE)
return
if is_equal_approx(angle, 3.0 * PI / 2.0):
sprite.rotate_90(COUNTERCLOCKWISE)
return
if is_equal_approx(angle, PI):
sprite.rotate_180()
return