From 0017fbce725d6a686de691f5c36d0c7edc8d1d15 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sun, 21 Mar 2010 15:43:11 +0000 Subject: [PATCH] Lua scripts: Added the 'table' library. Added GPL headers to DawnBringer's scripts (thanks!). 2 cosmetic fixes in scripts. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1391 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- share/grafx2/scripts/bru_db_Amigaball.lua | 7 +++++++ share/grafx2/scripts/bru_db_ColorSphere.lua | 7 +++++++ share/grafx2/scripts/bru_db_FindAA.lua | 6 ++++++ share/grafx2/scripts/bru_db_Fisheye.lua | 7 +++++++ share/grafx2/scripts/bru_db_GrayscaleAvg.lua | 6 ++++++ share/grafx2/scripts/bru_db_GrayscaleDesat.lua | 13 ++++++++++--- share/grafx2/scripts/bru_db_Halfsmooth.lua | 6 ++++++ share/grafx2/scripts/bru_db_Mandelbrot.lua | 7 +++++++ share/grafx2/scripts/bru_db_Waves.lua | 7 +++++++ share/grafx2/scripts/pal_db_Desaturate.lua | 7 +++++++ share/grafx2/scripts/pal_db_ExpandColors.lua | 7 +++++++ share/grafx2/scripts/pal_db_FillColorCube.lua | 7 +++++++ share/grafx2/scripts/pal_db_InvertedRGB.lua | 7 +++++++ share/grafx2/scripts/pal_db_Set3bit.lua | 7 +++++++ share/grafx2/scripts/pal_db_Set6bit.lua | 7 +++++++ share/grafx2/scripts/pal_db_SetC64Palette.lua | 7 +++++++ share/grafx2/scripts/pal_db_ShiftHue.lua | 14 +++++++------- share/grafx2/scripts/pic_db_Pic2isometric.lua | 8 ++++++++ .../grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua | 7 +++++++ share/grafx2/scripts/pic_db_SierpinskyCarpet.lua | 7 +++++++ share/grafx2/scripts/pic_db_SierpinskyTriangle.lua | 7 +++++++ share/grafx2/scripts/scn_db_RemapImage2RGB.lua | 7 ++++++- share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua | 7 +++++++ .../grafx2/scripts/scn_db_RemapImageTo3bitPal.lua | 8 ++++++++ src/factory.c | 8 +++++++- 25 files changed, 176 insertions(+), 12 deletions(-) diff --git a/share/grafx2/scripts/bru_db_Amigaball.lua b/share/grafx2/scripts/bru_db_Amigaball.lua index d7f93371..0ed613ad 100644 --- a/share/grafx2/scripts/bru_db_Amigaball.lua +++ b/share/grafx2/scripts/bru_db_Amigaball.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project --http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/bru_db_ColorSphere.lua b/share/grafx2/scripts/bru_db_ColorSphere.lua index d5447382..7cadb85b 100644 --- a/share/grafx2/scripts/bru_db_ColorSphere.lua +++ b/share/grafx2/scripts/bru_db_ColorSphere.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project --http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/bru_db_FindAA.lua b/share/grafx2/scripts/bru_db_FindAA.lua index 46719e8b..03695a02 100644 --- a/share/grafx2/scripts/bru_db_FindAA.lua +++ b/share/grafx2/scripts/bru_db_FindAA.lua @@ -2,6 +2,12 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See cellw = 8 cellh = 4 diff --git a/share/grafx2/scripts/bru_db_Fisheye.lua b/share/grafx2/scripts/bru_db_Fisheye.lua index be91e941..ef487160 100644 --- a/share/grafx2/scripts/bru_db_Fisheye.lua +++ b/share/grafx2/scripts/bru_db_Fisheye.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project --http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/bru_db_GrayscaleAvg.lua b/share/grafx2/scripts/bru_db_GrayscaleAvg.lua index 6b9bb039..3146ab7b 100644 --- a/share/grafx2/scripts/bru_db_GrayscaleAvg.lua +++ b/share/grafx2/scripts/bru_db_GrayscaleAvg.lua @@ -2,6 +2,12 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See w, h = getbrushsize() diff --git a/share/grafx2/scripts/bru_db_GrayscaleDesat.lua b/share/grafx2/scripts/bru_db_GrayscaleDesat.lua index f60bb049..80db6264 100644 --- a/share/grafx2/scripts/bru_db_GrayscaleDesat.lua +++ b/share/grafx2/scripts/bru_db_GrayscaleDesat.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project --http://goto.glocalnet.net/richard_fhager/evalion/evalion.html @@ -12,9 +19,9 @@ percent = 100 function desaturate(percent,r,g,b) -- V1.0 by Richard Fhager p = percent / 100 a = (math.min(math.max(r,g,b),255) + math.max(math.min(r,g,b),0)) * 0.5 * p - r = math.min(math.max(r + (a-r*p),0),255) -- Capping may not be needed if mathcolor/setcolor is updated - g = math.min(math.max(g + (a-g*p),0),255) - b = math.min(math.max(b + (a-b*p),0),255) + r = r + (a-r*p) + g = g + (a-g*p) + b = b + (a-b*p) return r,g,b end -- diff --git a/share/grafx2/scripts/bru_db_Halfsmooth.lua b/share/grafx2/scripts/bru_db_Halfsmooth.lua index d1bd0b7a..68e2f1d3 100644 --- a/share/grafx2/scripts/bru_db_Halfsmooth.lua +++ b/share/grafx2/scripts/bru_db_Halfsmooth.lua @@ -2,6 +2,12 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See w, h = getbrushsize() diff --git a/share/grafx2/scripts/bru_db_Mandelbrot.lua b/share/grafx2/scripts/bru_db_Mandelbrot.lua index b526b16e..6fc12433 100644 --- a/share/grafx2/scripts/bru_db_Mandelbrot.lua +++ b/share/grafx2/scripts/bru_db_Mandelbrot.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project --http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/bru_db_Waves.lua b/share/grafx2/scripts/bru_db_Waves.lua index 9783a62b..14e4e0e6 100644 --- a/share/grafx2/scripts/bru_db_Waves.lua +++ b/share/grafx2/scripts/bru_db_Waves.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/pal_db_Desaturate.lua b/share/grafx2/scripts/pal_db_Desaturate.lua index 89b56700..91470de2 100644 --- a/share/grafx2/scripts/pal_db_Desaturate.lua +++ b/share/grafx2/scripts/pal_db_Desaturate.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/pal_db_ExpandColors.lua b/share/grafx2/scripts/pal_db_ExpandColors.lua index 07e42617..d3e64359 100644 --- a/share/grafx2/scripts/pal_db_ExpandColors.lua +++ b/share/grafx2/scripts/pal_db_ExpandColors.lua @@ -4,7 +4,14 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager -- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + + -- Continously fill the greatest void in the area of the color-cube enclosed by (or along ramps of) initial colors -- This algorithm will create lines of allowed colors (all ranges) in 3d colorspace and the pick -- new colors from the most void areas (on any line). Almost like a Median-cut in reverse. diff --git a/share/grafx2/scripts/pal_db_FillColorCube.lua b/share/grafx2/scripts/pal_db_FillColorCube.lua index e2596118..c4996f4a 100644 --- a/share/grafx2/scripts/pal_db_FillColorCube.lua +++ b/share/grafx2/scripts/pal_db_FillColorCube.lua @@ -4,6 +4,13 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- -- Create a palette by continously filling the greatest void in the RGB color-cube -- diff --git a/share/grafx2/scripts/pal_db_InvertedRGB.lua b/share/grafx2/scripts/pal_db_InvertedRGB.lua index d007027c..4a8f5838 100644 --- a/share/grafx2/scripts/pal_db_InvertedRGB.lua +++ b/share/grafx2/scripts/pal_db_InvertedRGB.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html diff --git a/share/grafx2/scripts/pal_db_Set3bit.lua b/share/grafx2/scripts/pal_db_Set3bit.lua index b6de8a56..21112a5d 100644 --- a/share/grafx2/scripts/pal_db_Set3bit.lua +++ b/share/grafx2/scripts/pal_db_Set3bit.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- Generate palette of all colors possible with a given number of shades for each channel -- 2 shades = 1 bit / channel = 3 bit palette = 2^3 colors = 8 colors diff --git a/share/grafx2/scripts/pal_db_Set6bit.lua b/share/grafx2/scripts/pal_db_Set6bit.lua index b4ded345..ad7a24cb 100644 --- a/share/grafx2/scripts/pal_db_Set6bit.lua +++ b/share/grafx2/scripts/pal_db_Set6bit.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- Generate palette of all colors possible with a given number of shades for each channel -- 2 shades = 1 bit / channel = 3 bit palette = 2^3 colors = 8 colors diff --git a/share/grafx2/scripts/pal_db_SetC64Palette.lua b/share/grafx2/scripts/pal_db_SetC64Palette.lua index 21e1ad74..0f77c7e3 100644 --- a/share/grafx2/scripts/pal_db_SetC64Palette.lua +++ b/share/grafx2/scripts/pal_db_SetC64Palette.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + OK,clean = inputbox("C64 Palette:", "Remove old palette", 0, 0,1,0 ); diff --git a/share/grafx2/scripts/pal_db_ShiftHue.lua b/share/grafx2/scripts/pal_db_ShiftHue.lua index bcb02e13..986e98cf 100644 --- a/share/grafx2/scripts/pal_db_ShiftHue.lua +++ b/share/grafx2/scripts/pal_db_ShiftHue.lua @@ -2,19 +2,19 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html --Shift_degrees = 45 ---ok, w, h, xflip, yflip = inputbox("Modify brush", --- "Width", w, 1,100,0, --- "Height", h, 1,100,0, --- "X-Flip", 0, 0, 1,0, --- "Y-Flip", 0, 0, 1,0 ---); - OK,Shift_degrees = inputbox("Shift Hue v0.9","Degrees", 45, 0,360,3); diff --git a/share/grafx2/scripts/pic_db_Pic2isometric.lua b/share/grafx2/scripts/pic_db_Pic2isometric.lua index 2d1a625a..8002b816 100644 --- a/share/grafx2/scripts/pic_db_Pic2isometric.lua +++ b/share/grafx2/scripts/pic_db_Pic2isometric.lua @@ -4,6 +4,14 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + + -- Color 0 is assumed to be the background -- diff --git a/share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua b/share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua index feaabfe5..1853e3de 100644 --- a/share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua +++ b/share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua @@ -4,6 +4,13 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html -- diff --git a/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua b/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua index 9dddacfd..3aeb78a3 100644 --- a/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua +++ b/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua @@ -4,6 +4,13 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html -- diff --git a/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua b/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua index 3b2798b9..9f784c9e 100644 --- a/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua +++ b/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua @@ -4,6 +4,13 @@ -- Email: dawnbringer@hem.utfors.se -- MSN: annassar@hotmail.com -- +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html -- diff --git a/share/grafx2/scripts/scn_db_RemapImage2RGB.lua b/share/grafx2/scripts/scn_db_RemapImage2RGB.lua index 56eb59c3..1d87bea6 100644 --- a/share/grafx2/scripts/scn_db_RemapImage2RGB.lua +++ b/share/grafx2/scripts/scn_db_RemapImage2RGB.lua @@ -2,7 +2,12 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ - +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See -- Set Palette (to a predefined one) diff --git a/share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua b/share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua index b7f31414..f59048ec 100644 --- a/share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua +++ b/share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua @@ -2,6 +2,13 @@ --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + power = 0.615 diff --git a/share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua b/share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua index f5ca97ed..20a71599 100644 --- a/share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua +++ b/share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua @@ -1,6 +1,14 @@ --SCENE: Remap pic to 3bit, LineEDdith. (Same line simple error-diffusion dither) --by Richard Fhager --http://hem.fyristorg.com/dawnbringer/ + +-- Copyright 2010 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + -- -- Just a demonstration. -- diff --git a/src/factory.c b/src/factory.c index bb26a621..fe7c4779 100644 --- a/src/factory.c +++ b/src/factory.c @@ -999,9 +999,15 @@ void Button_Brush_Factory(void) // For debug only // luaL_openlibs(L); - + luaopen_base(L); + //luaopen_package(L); // crashes on Windows, for unknown reason + luaopen_table(L); + //luaopen_io(L); // crashes on Windows, for unknown reason + //luaopen_os(L); + //luaopen_string(L); luaopen_math(L); + //luaopen_debug(L); strcat(scriptdir, selected_script);