* Add scripts from dawnbringer : 3D palette viewer and applycolor (with tint and colorize effects)

* Add the dawnbringer lib 
Some changes were made
 * Remove line and filled circle functions from dawnbringer lib 
 * Add C replacement (slightly faster, and useful enough to be part of core)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1730 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues
2011-02-19 12:40:12 +00:00
parent c80ec5edbf
commit f6da992038
4 changed files with 3136 additions and 12 deletions

View File

@@ -348,6 +348,85 @@ int L_PutPicturePixel(lua_State* L)
return 0; // no values returned for lua
}
int L_DrawLine(lua_State* L)
{
int x1, y1, x2, y2, c;
int nb_args = lua_gettop(L);
LUA_ARG_LIMIT(5, "drawline");
LUA_ARG_NUMBER(1, "drawline", x1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(2, "drawline", y1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(3, "drawline", x2, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(4, "drawline", y2, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(5, "drawline", c, INT_MIN, INT_MAX);
Pixel_figure = Display_pixel;
Draw_line_general(x1, y1, x2, y2, c);
return 0;
}
int L_DrawFilledRect(lua_State* L)
{
int x1, y1, x2, y2, c;
int nb_args = lua_gettop(L);
LUA_ARG_LIMIT(5, "drawfilledrect");
LUA_ARG_NUMBER(1, "drawfilledrect", x1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(2, "drawfilledrect", y1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(3, "drawfilledrect", x2, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(4, "drawfilledrect", y2, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(5, "drawfilledrect", c, INT_MIN, INT_MAX);
Draw_filled_rectangle(x1, y1, x2, y2, c);
return 0;
}
int L_DrawCircle(lua_State* L)
{
int x1, y1, r, c;
int nb_args = lua_gettop(L);
LUA_ARG_LIMIT(4, "drawcircle");
LUA_ARG_NUMBER(1, "drawcircle", x1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(2, "drawcircle", y1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(3, "drawcircle", r, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(4, "drawcircle", c, INT_MIN, INT_MAX);
Pixel_figure = Display_pixel;
Circle_limit = r*r;
Draw_empty_circle_general(x1, y1, r, c);
return 0;
}
int L_DrawDisk(lua_State* L)
{
int x1, y1, r, c;
int nb_args = lua_gettop(L);
LUA_ARG_LIMIT(4, "drawdisk");
LUA_ARG_NUMBER(1, "drawdisk", x1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(2, "drawdisk", y1, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(3, "drawdisk", r, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(4, "drawdisk", c, INT_MIN, INT_MAX);
Circle_limit = r*r;
Draw_filled_circle(x1, y1, r, c);
return 0;
}
int L_GetPicturePixel(lua_State* L)
{
int x;
@@ -1308,36 +1387,54 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
L = lua_open();
putenv("LUA_PATH=libs\\?.lua");
// writing and reading pixels
lua_register(L,"putbrushpixel",L_PutBrushPixel);
lua_register(L,"putpicturepixel",L_PutPicturePixel);
lua_register(L, "drawline",L_DrawLine);
lua_register(L, "drawfilledrect",L_DrawFilledRect);
lua_register(L, "drawcircle",L_DrawCircle);
lua_register(L, "drawdisk",L_DrawDisk);
lua_register(L,"getbrushpixel",L_GetBrushPixel);
lua_register(L,"getbrushbackuppixel",L_GetBrushBackupPixel);
lua_register(L,"putpicturepixel",L_PutPicturePixel);
lua_register(L,"getpicturepixel",L_GetPicturePixel);
lua_register(L,"getlayerpixel",L_GetLayerPixel);
lua_register(L,"getbackuppixel",L_GetBackupPixel);
lua_register(L,"getsparelayerpixel",L_GetSpareLayerPixel);
lua_register(L,"getsparepicturepixel",L_GetSparePicturePixel);
// resizing stuff
lua_register(L,"setbrushsize",L_SetBrushSize);
lua_register(L,"setpicturesize",L_SetPictureSize);
lua_register(L,"getbrushsize",L_GetBrushSize);
lua_register(L,"getpicturesize",L_GetPictureSize);
lua_register(L,"getsparepicturesize",L_GetSparePictureSize);
// color and palette
lua_register(L,"setcolor",L_SetColor);
lua_register(L,"setforecolor",L_SetForeColor);
lua_register(L,"setbackcolor",L_SetBackColor);
lua_register(L,"getcolor",L_GetColor);
lua_register(L,"getbackupcolor",L_GetBackupColor);
lua_register(L,"matchcolor",L_MatchColor);
lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);
lua_register(L,"getsparecolor",L_GetSpareColor);
lua_register(L,"getsparetranscolor",L_GetSpareTransColor);
lua_register(L,"getforecolor",L_GetForeColor);
lua_register(L,"getbackcolor",L_GetBackColor);
lua_register(L,"gettranscolor",L_GetTransColor);
lua_register(L,"matchcolor",L_MatchColor);
// ui
lua_register(L,"inputbox",L_InputBox);
lua_register(L,"messagebox",L_MessageBox);
lua_register(L,"statusmessage",L_StatusMessage);
lua_register(L,"selectbox",L_SelectBox);
lua_register(L,"getforecolor",L_GetForeColor);
lua_register(L,"getbackcolor",L_GetBackColor);
lua_register(L,"setforecolor",L_SetForeColor);
lua_register(L,"setbackcolor",L_SetBackColor);
lua_register(L,"gettranscolor",L_GetTransColor);
lua_register(L,"getsparepicturesize",L_GetSparePictureSize);
lua_register(L,"getsparelayerpixel",L_GetSpareLayerPixel);
lua_register(L,"getsparepicturepixel",L_GetSparePicturePixel);
lua_register(L,"getsparecolor",L_GetSpareColor);
lua_register(L,"getsparetranscolor",L_GetSpareTransColor);
// misc. stuff
lua_register(L,"clearpicture",L_ClearPicture);
lua_register(L,"wait",L_Wait);
lua_register(L,"waitbreak",L_WaitBreak);