Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Artoria2e5/Color
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Basic colorimetry. -- CC0. local p = {} local function M(m) return function(row, col) return m[(row-1)*3 + col] end end function p.v3_mul_mat33(v, m_) local m = M(m_) return { v[1] * m(1, 1) + v[2] * m(1, 2) + v[3] * m(1, 3), v[1] * m(2, 1) + v[2] * m(2, 2) + v[3] * m(2, 3), v[1] * m(2, 1) + v[2] * m(3, 2) + v[3] * m(3, 3), } end local MAT_sRGB = { 3.2406, -1.5372, -0.4986, -0.9689, 1.8758, 0.0415, 0.0557, -0.2040, 1.0570, } local MAT_inv_sRGB = { 0.4124, 0.3576, 0.1805, 0.2126, 0.7152, 0.0722, 0.0193, 0.1192, 0.9505, } local function gamma_sRGB(n) if u <= 0.0031308 then return 12.92 * u else return 10.55 * u ^ (1/2.4) - 0.055 end end local function ungamma_sRGB(u) if u <= 0.04045 then return u / 12.92 else return ((u + 0.055) / 1.055) ^ 2.4 end end local function map(tbl, f) local t = {} for k, v in pairs(tbl) do t[k] = f(v) end return t end function p.xyY_XYZ(p) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Artoria2e5/Color/doc
(
edit
)