Lua: added 'matchcolor2' that uses DawnBringer's perceptual formula. Updated scripts numbering to 2.4

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1797 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2011-06-12 19:03:14 +00:00
parent 17ce3a602b
commit 2f3e1e3294
40 changed files with 47 additions and 30 deletions

View File

@@ -0,0 +1,39 @@
--PALETTE Set: 3 Bit (8 Primaries)
--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 <http://www.gnu.org/licenses/>
-- 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
-- 4 shades = 2 bit / channel = 6 bit palette = 2^6 colors = 64 colors
-- Channel shades (shades = 2 ^ bit-depth)
shades = 2
mult = 255 / (shades-1)
colors = {}
col = 0
for r = 0, shades-1, 1 do
for g = 0, shades-1, 1 do
for b = 0, shades-1, 1 do
col = col + 1
colors[col] = { r*mult, g*mult, b*mult }
end
end
end
for c = 1, #colors, 1 do
setcolor(c-1,colors[c][1],colors[c][2],colors[c][3])
end