mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 17:24:44 -04:00
Added Scale3X algorithm as an option to scale sprites (#290)
This commit is contained in:
parent
5bbea6fa03
commit
6d23f95d07
2 changed files with 14 additions and 5 deletions
|
@ -226,7 +226,14 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
|
|||
for i in range(f.cels.size() - 1, -1, -1):
|
||||
var sprite := Image.new()
|
||||
sprite.copy_from(f.cels[i].image)
|
||||
sprite.resize(width, height, interpolation)
|
||||
# Different method for scale3x
|
||||
if interpolation == 5:
|
||||
var times : Vector2 = Vector2(ceil(width/(3.0*sprite.get_width())),ceil(height/(3.0*sprite.get_height())))
|
||||
for j in range(max(times.x,times.y)):
|
||||
sprite.copy_from(scale3X(sprite))
|
||||
sprite.resize(width, height, 0)
|
||||
else:
|
||||
sprite.resize(width, height, interpolation)
|
||||
Global.current_project.undo_redo.add_do_property(f.cels[i].image, "data", sprite.data)
|
||||
Global.current_project.undo_redo.add_undo_property(f.cels[i].image, "data", f.cels[i].image.data)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue