Skip to content

Instantly share code, notes, and snippets.

🎨
Working on @aseprite / @igarastudio

David Capello dacap

🎨
Working on @aseprite / @igarastudio
View GitHub Profile
View handy-compile.el
;; ==================================================
;; handy-compile (redefined)
;; ==================================================
(require 'bookmark)
(defun handy-current-buffer-path ()
(cond
((buffer-file-name) (file-name-directory (buffer-file-name)))
((eq major-mode 'dired-mode) (dired-current-directory))
@dacap
dacap / Switch Both Layers.lua
Created Jan 29, 2020
Switches the visibility of two layers (Back/Front) at the same time
View Switch Both Layers.lua
-- Switches the visibility of the active layer, if the layer is called
-- "Something Back" or "Something Front", it will try to switch the
-- visibility of the other layer "Something Back/Front" too (so you
-- can switch the visibility of two layers at the same time).
local layer = app.activeLayer
if not layer then
return app.alert "There is no active layer"
end
@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
}
You can’t perform that action at this time.