DogLua is a scriptable interface for
Project Dogwaffle,
a painting and animation tool by Dan Ritchie.
It provide an environment for experimenting with image processing
algorithms, using Lua as the scripting language.
DogLua it's largely inspired by gluas,
by OEyvind Kolaas, and try to be as compatible as possible with it, providing a similar syntax
for the basics pixel manipulation functions.
Installation
Just unpack in the same folder of Project DogWaffle.
Then DogLuaEdit will show up in the Misc tab of the plugins panel.
Here's a quick summary of the available functions. Check the
reference section for all the details.
gluas compatible API
v = get_value(x, y)
set_value(x, y, v)
r, g, b = get_rgb(x, y)
set_rgb(x, y, r, g, b)
r, g, b, a = get_rgba(x, y)
set_rgba(x, y, r, g, b, a)
h, s, v = get_hsv(x, y)
set_hsv(x, y, h, s, v)
progress(v)
flush()
gluas-like API
y, u, v = get_yuv(x, y)
set_yuv(x, y, y, u, v)
y, i, q = get_yuv(x, y)
set_yiq(x, y, y, i, q)
Here's an example of a simple script to generate a negative image:
-- negative (from a gluas sample)
local x, y, r, g, b
for y = 0, height - 1 do
for x = 0, width - 1 do
r, g, b = get_rgb(x, y)
r = 1 - r
g = 1 - g
b = 1 - b
set_rgb(x, y, r, g, b)
end
progress(y / height)
end
A slightly more complex filter for a user selectable threshold effect:
-- Simple threshold
local level, x, y, v
level = Dog_ValueBox("Threshold",
"Choose level", 0, 100, 50)
if level >= 0 then
level = level / 100
for y = 0, height - 1 do
for x = 0, width - 1 do
v = get_value(x, y)
if v > level then
v = 1.0
else
v = 0.0
end
set_value(x, y, v)
end
progress(y / height)
end
end
Other scripts can also be found on the
Artweaver site, for witch there's a
Lua plugin that also provide a compatible syntax for the core functions.
Last but not least, don't miss the DogLua page at The Best 3D
witch feature a nice gallery of Lua scripts for various effects.
For a quick start on Lua, instead, you may refer to the
Lua Tutorial section of the
lua-users wiki, in addition to the official
Lua home.
Download
DogLua v0.61b, 196KB ZIP
- Alternate mirror at TheBest3D.com, link
Change Log
DogLua v0.61b - 22/09/05:
+ Editor & DogLua runtime splitted as two separate exe.
+ Now use LuaJIT, based on Lua 5.1
+ Vast speed improvements: 3x is common
+ DogLua output errors on standard output, to be parsed by any editor
+ DogLuaEdit will position the cursor on the correct line if there is an error
+ Progress bar updating more efficent
+ GUI Server panel auto close on exit, auto open when a GUI_WaitOnEvent() is issued
+ GUI Server GUI_AddLogo() search in DogLuaScripts folder if no path is specified
+ Lua helper: decimal2rgb() function to convert values returned by GUI Server Colorbox
DogLua v0.59b - 11/09/05:
+ GUI Server API: GUI_SetSpacing, GUI_SetList, GUI_AddLogo
+ Dogwaffle API: Dog_SaveUndo, Dog_RestoreUndo
+ gluas-like API: set_yiq, get_yiq
+ Lua helper: hex() function to convert an hex string to a number
* Fixed a bit the getter & setter for YUV colorspace
DogLua v0.58b - 05/09/05:
+ gluas-like API: set_yuv, get_yuv (mimic gluas's ones, but for YUV color space)
+ GUI Server API: GUI_SetCaption, GUI_AddControl, GUI_OpenPanel, GUI_WaitOnEvent, GUI_ClosePanel, GUI_GetSettings, GUI_SetSettings
DogLua v0.57b - 02/09/05:
+ Dogwaffle API: Dog_GetTotalFrames, Dog_GetCurrentFrame, Dog_GotoFrame,
Dog_GetBuffer, Dog_ShellExe
* Alpha was checked even if disabled
DogLua v0.56b - 29/08/05:
+ Deatailed Lua errors reporting
+ gluas API & vars: get_hsv, set_hsv, bound_x0, bound_x1, bound_y0, bound_y1
+ Window can be resized
DogLua v0.55b - 25/08/05:
+ Plugins panel progress bar
+ Dog_ValueBox function for getting input from user
+ Added menu accelerators keys
DogLua v0.54b - 21/08/05:
+ Abilty to run a script (source & bytecode) from the command line
* Fixed a memory leak when refreshing
DogLua v0.53b - 20/08/05:
+ The "New" menu option now reset the Lua state
+ Pixel writing operations now check for alpha
* Now works with both PD Pro and the free version
DogLua v0.52b - 18/08/05:
+ Dogwaffle API: Dog_Refresh
+ gluas compatible API: get_rgba, set_rgba, flush
* Open file... now start in the correct folder
DogLua v0.51b - 16/08/05:
+ Monospaced font in code window
+ Standard Lua libraries (math, table, strings, etc.) included
+ Added "Save As..." option
- Changed from filter to misc plugin
DogLua v0.50b - 15/08/05:
+ First working version released!