aseprite/scripts/save_file_command.lua

28 lines
879 B
Lua
Raw Normal View History

2022-06-13 22:17:05 +00:00
-- Copyright (C) 2022 Igara Studio S.A.
--
-- This file is released under the terms of the MIT license.
-- Read LICENSE.txt for more information.
do
local spr = Sprite(32, 32)
2022-06-14 13:58:14 +00:00
app.useTool{ color=Color(255, 255, 255), brush=Brush(1),
tool="filled_ellipse", points={{0,0},{31,31}} }
spr.filename = "_test_a.aseprite"
2022-06-13 22:17:05 +00:00
app.command.SaveFile()
2022-06-14 13:58:14 +00:00
assert(spr.filename == "_test_a.aseprite")
2022-06-13 22:17:05 +00:00
app.command.SaveFileAs{ filename="_test_b.png" }
assert(spr.filename == "_test_b.png")
app.command.SaveFileCopyAs{ filename="_test_c.png" }
assert(spr.filename == "_test_b.png")
2022-06-14 13:58:14 +00:00
-- Slices
local slice = spr:newSlice(Rectangle(1, 2, 8, 15))
slice.name = "small_slice"
app.command.SaveFileCopyAs{ filename="_test_c_small_slice.png", slice="small_slice" }
local c = app.open("_test_c_small_slice.png")
assert(c.width == 8)
assert(c.height == 15)
2022-06-13 22:17:05 +00:00
end