summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2021-01-29 20:46:13 -0600
committercheapie <no-email-for-you@example.com>2021-01-29 20:46:13 -0600
commit813ada878ea0d284ec9000ad6ee5ec665383bcee (patch)
tree73de4a18a9cabc6ebd6687eb925e8065b8fed9ac
parent5c2cb60815157dd7d739631ab75451b5fc458df6 (diff)
downloaddigistuff-813ada878ea0d284ec9000ad6ee5ec665383bcee.tar
digistuff-813ada878ea0d284ec9000ad6ee5ec665383bcee.tar.gz
digistuff-813ada878ea0d284ec9000ad6ee5ec665383bcee.tar.bz2
digistuff-813ada878ea0d284ec9000ad6ee5ec665383bcee.tar.xz
digistuff-813ada878ea0d284ec9000ad6ee5ec665383bcee.zip
Rename "tohsv" and "torgb" operations to allow for possible future color space additions
-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
-------------