Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-02-25 15:06:11 -03:00
commit dbe2af6daf
2 changed files with 80 additions and 1 deletions

View File

@ -1,4 +1,4 @@
-- Copyright (C) 2018 Igara Studio S.A.
-- Copyright (C) 2018-2022 Igara Studio S.A.
--
-- This file is released under the terms of the MIT license.
-- Read LICENSE.txt for more information.
@ -65,3 +65,19 @@ do
assert(r:getPixel(1, 2) == pc.rgba(0, 0, 255, 255))
assert(r:getPixel(2, 2) == pc.rgba(255, 255, 0, 255))
end
-- Image:drawPixel with indexed color
do
local a = Sprite(32, 32, ColorMode.INDEXED)
local i = a.cels[1].image
assert(i:getPixel(0, 0) == 0)
assert(i:getPixel(1, 0) == 0)
assert(i:getPixel(2, 0) == 0)
i:drawPixel(0, 0, Color{ index=2 })
i:drawPixel(1, 0, Color{ index=3 }.index)
i:drawPixel(2, 0, Color(4))
assert(i:getPixel(0, 0) == 2)
assert(i:getPixel(1, 0) == 3)
assert(i:getPixel(2, 0) == 4)
end

View File

@ -619,3 +619,66 @@ function drawing_with_tiled_mode_and_image_brush()
docPref.tiled.mode = 0 -- none (disable tiled mode)
end
drawing_with_tiled_mode_and_image_brush()
----------------------------------------------------------------------
-- countour with pixel perfect
----------------------------------------------------------------------
do
local s = Sprite(3, 3, ColorMode.INDEXED)
local i = app.activeImage
i:clear(1)
expect_img(i,
{ 1, 1, 1,
1, 1, 1,
1, 1, 1 })
app.useTool{
tool='contour',
brush=Brush(1),
color=2,
freehandAlgorithm=1, -- 1=FreehandAlgorithm.PIXEL_PERFECT
points={ { 1, 1 }, { 2, 1 }, { 2, 2 }
}
}
expect_img(app.activeImage,
{ 1, 1, 1,
1, 2, 1,
1, 1, 2 })
app.undo()
-- Test one pixel when using one point
app.useTool{
tool='contour',
brush=Brush(1),
color=2,
freehandAlgorithm=1, -- 1=FreehandAlgorithm.PIXEL_PERFECT
points={ { 1, 1 } }
}
expect_img(app.activeImage,
{ 1, 1, 1,
1, 2, 1,
1, 1, 1 })
app.undo()
-- Test bug where one click doesn't draw with the contour tool with
-- pixel perfect algorith.
-- Report: https://community.aseprite.org/t/13149
expect_img(app.activeImage,
{ 1, 1, 1,
1, 1, 1,
1, 1, 1 })
app.useTool{
tool='contour',
brush=Brush(1),
color=2,
freehandAlgorithm=1, -- 1=FreehandAlgorithm.PIXEL_PERFECT
-- Two points in the same spot, this happens in the UI, one
-- created in mouse down, other in mouse up.
points={ { 1, 1 }, { 1, 1 } }
}
expect_img(app.activeImage,
{ 1, 1, 1,
1, 2, 1,
1, 1, 1 })
end