Skip to content

Instantly share code, notes, and snippets.

David Capello dacap

Block or report user

Report or block dacap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dacap
dacap / save-each-cel.lua
Created Jan 4, 2020
Save each cel/layer of the file in its own file
View save-each-cel.lua
local sprite = app.activeSprite
for _,layer in ipairs(sprite.layers) do
local cel = layer.cels[1]
if cel then
cel.image:saveAs('layer-' .. cel.layer.name .. '.png')
end
end
@dacap
dacap / grafx2.lua
Created Dec 11, 2019
WIP grafx2 API on Aseprite
View grafx2.lua
----------------------------------------------------------------------
-- grafx2 compatibility by David Capello (C) 2018-2019
----------------------------------------------------------------------
local brush = nil
local spare = nil
local function getpicture()
return app.activeImage
end
@dacap
dacap / Move Layer Down.lua
Last active Dec 3, 2019
Move active layer up/down in Aseprite
View Move Layer Down.lua
local layer = app.activeLayer
if layer then
layer.stackIndex = layer.stackIndex-1
end
@dacap
dacap / Export x20.lua
Created Nov 25, 2019
Export the active sprite to a png file scaling it to 2000%
View Export x20.lua
local orig = app.activeSprite
if not orig then print("There is no active sprite to resize") end
local function replace_extension(path, newext)
local file, ext = string.match(path, "(.-)([^.]*)$")
if file and ext and file ~= "" and ext ~= "" then
return file .. newext
else
return path .. '.' .. newext
end
View clonable.cpp
#include <memory>
using namespace std;
// --- library ---
template<class T>
class clonable {
public:
using Base = T;
View gist:50203ded88044bdb540f54602b6327c2
objdump -h skia_draw_text.cpp.o
skia_draw_text.cpp.o: file format Mach-O 64-bit x86-64
Sections:
Idx Name Size Address Type
0 __text 0000042b 0000000000000000 TEXT
1 __gcc_except_tab 0000009c 000000000000042c DATA
2 __literal4 00000008 00000000000004c8 DATA
3 __cstring 00000021 00000000000004d0 DATA
View libskshaper.txt
This file has been truncated, but you can view the full file.
libskshaper.a(libskshaper.SkShaper.o):
U __ZN17SkTextBlobBuilder15allocRunTextPosERK6SkFontii8SkStringPK6SkRect
U __ZN17SkTextBlobBuilder4makeEv
U __ZN17SkTextBlobBuilderD1Ev
00000000000006d0 T __ZN18FontMgrRunIterator7consumeEv
00000000000004e0 T __ZN18FontMgrRunIteratorC2EPKcmRK6SkFont5sk_spI9SkFontMgrE
0000000000000670 T __ZN18FontMgrRunIteratorD0Ev
0000000000000610 T __ZN18FontMgrRunIteratorD1Ev
@dacap
dacap / MoveMask Test.lua
Last active Jul 11, 2019
MoveMask test
View MoveMask Test.lua
local spr = app.activeSprite
spr.selection = Selection(Rectangle(0,0,spr.width,spr.height))
app.command.MoveMask{
target='content',
direction='right',
units='pixel',
quantity=2,
wrap=true
}
@dacap
dacap / Plasma.lua
Created Jul 4, 2019
Plasma Script for Aseprite -- https://www.aseprite.org
View Plasma.lua
-- Copyright (C) 2019 David Capello
local dlg = Dialog("Plasma")
:number{ id="width", label="Size:", text="100", focus=true }
:number{ id="height", text="100" }
:number{ id="frames", label="Frames:", text="100" }
:button{ id="ok", text="OK", focus=true }
:button{ id="cancel", text="Cancel" }
dlg:show()
View Create Sprite With DB32 Palette.lua
local s = Sprite(32, 32, ColorMode.INDEXED)
local p = Palette(32)
local function setc(i,r,g,b) p:setColor(i, Color{r=r, g=g, b=b}) end
setc(0, 0, 0, 0)
setc(1, 34, 32, 52)
setc(2, 69, 40, 60)
setc(3,102, 57, 49)
setc(4,143, 86, 59)
setc(5,223, 113, 38)
setc(6,217, 160, 102)
You can’t perform that action at this time.