Lua: finished inputbox with negative and decimal inputs. Added to the repository more than 20(!) new scripts by DawnBringer
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1357 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
31
scripts/bru_db_ColorSphere.lua
Normal file
31
scripts/bru_db_ColorSphere.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--BRUSH Scene: Sphere of pencolor v1.0
|
||||
--by Richard Fhager
|
||||
--http://hem.fyristorg.com/dawnbringer/
|
||||
|
||||
-- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project
|
||||
--http://goto.glocalnet.net/richard_fhager/evalion/evalion.html
|
||||
|
||||
|
||||
w, h = getbrushsize()
|
||||
|
||||
rp,gp,bp = getcolor(getforecolor())
|
||||
|
||||
for y = 0, h - 1, 1 do
|
||||
for x = 0, w - 1, 1 do
|
||||
|
||||
-- Fractionalize image dimensions
|
||||
ox = x / w;
|
||||
oy = y / h;
|
||||
|
||||
-- Sphere
|
||||
X = 0.5; Y = 0.5; Rd = 0.5
|
||||
a = math.sqrt(math.max(0,Rd*Rd - ((X-ox)*(X-ox)+(Y-oy)*(Y-oy)))) * 1/Rd
|
||||
|
||||
r = rp * a
|
||||
g = gp * a
|
||||
b = bp * a
|
||||
|
||||
putbrushpixel(x, y, matchcolor(r,g,b));
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user