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:
32
scripts/pal_db_Set3bit.lua
Normal file
32
scripts/pal_db_Set3bit.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--PALETTE Set: 3 Bit (8 Primaries)
|
||||
--by Richard Fhager
|
||||
--http://hem.fyristorg.com/dawnbringer/
|
||||
|
||||
|
||||
-- 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
|
||||
Reference in New Issue
Block a user