summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpu.lua12
-rw-r--r--gpu.txt4
2 files changed, 8 insertions, 8 deletions
diff --git a/gpu.lua b/gpu.lua
index 2775ddc..87ff6ea 100644
--- a/gpu.lua
+++ b/gpu.lua
@@ -16,7 +16,7 @@ local function implodebits(input)
return output
end
-local function tohsv(r,g,b)
+local function rgbtohsv(r,g,b)
r = r/255
g = g/255
b = b/255
@@ -44,7 +44,7 @@ local function tohsv(r,g,b)
return math.floor(hue*255),math.floor(sat*255),math.floor(max*255)
end
-local function torgb(h,s,v)
+local function hsvtorgb(h,s,v)
h = h/255*360
s = s/255
v = v/255
@@ -159,10 +159,10 @@ local function blend(src,dst,mode,transparent)
return string.format("%02X%02X%02X",r,g,b)
elseif op == "and" or op == "or" or op == "xor" or op == "xnor" or op == "not" or op == "nand" or op == "nor" then
return bitwiseblend(srcr,dstr,srcg,dstg,srcb,dstb,op)
- elseif op == "tohsv" then
- return string.format("%02X%02X%02X",tohsv(srcr,srcg,srcb))
- elseif op == "torgb" then
- return string.format("%02X%02X%02X",torgb(srcr,srcg,srcb))
+ elseif op == "tohsv" or op == "rgbtohsv" then
+ return string.format("%02X%02X%02X",rgbtohsv(srcr,srcg,srcb))
+ elseif op == "torgb" or op == "hsvtorgb" then
+ return string.format("%02X%02X%02X",hsvtorgb(srcr,srcg,srcb))
else
return src
end
diff --git a/gpu.txt b/gpu.txt
index 7fccdbd..98df39d 100644
--- a/gpu.txt
+++ b/gpu.txt
@@ -92,8 +92,8 @@ nor: Perform a bitwise NOR of the source and destination and write the result to
xor: Perform a bitwise XOR of the source and destination and write the result to the destination.
xnor: Perform a bitwise XNOR of the source and destination and write the result to the destination.
not: Perform a bitwise NOT of the source and write the result to the destination.
-tohsv: Convert the source from the RGB color system to the HSV color system and write the result to the destination, storing hue as "red", saturation as "green", and value as "blue".
-torgb: Convert the source from the HSV color system to the RGB color system, reading hue from the red channel, saturation from the green channel, and value from the blue channel, and write the result to the destination.
+rgbtohsv: Convert the source from the RGB color system to the HSV color system and write the result to the destination, storing hue as "red", saturation as "green", and value as "blue".
+hsvtorgb: Convert the source from the HSV color system to the RGB color system, reading hue from the red channel, saturation from the green channel, and value from the blue channel, and write the result to the destination.
Command: load
-------------