mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-02 12:33:07 +00:00
Calc true NTSC color wheel values for RGB
This commit is contained in:
parent
480b98e817
commit
331c5c2dea
@ -73,12 +73,20 @@ def luv2rgb(l, u, v)#3 // l = fix 1.7, u, v = fix s.15; return fix 0.8 * 3
|
||||
end
|
||||
|
||||
def calcChroma(angle)#0
|
||||
var r, g, b
|
||||
var l, r, g, b
|
||||
byte i
|
||||
|
||||
l = 256 - contrast
|
||||
for i = 0 to 3
|
||||
// Calculate and NTSC RGB for this DHGR pixel
|
||||
r, g, b = luv2rgb(256 - contrast, cos(angle), sin(angle))
|
||||
// According to what I could find out about the NTSC color wheel:
|
||||
// Red maxes at 103.5 degrees
|
||||
// Green maxes at 240.7 degrees
|
||||
// Blue maxes at 347.1 degrees
|
||||
r = max(0, l + (cos(angle - 104) >> 7))
|
||||
g = max(0, l + (cos(angle - 241) >> 7))
|
||||
b = max(0, l + (cos(angle - 347) >> 7))
|
||||
//r, g, b = luv2rgb(256 - contrast, cos(angle), sin(angle))
|
||||
ntscChroma[i*3 + RED] = (r + 2) >> 2
|
||||
ntscChroma[i*3 + GRN] = (g + 2) >> 2
|
||||
ntscChroma[i*3 + BLU] = (b + 2) >> 2
|
||||
|
Loading…
Reference in New Issue
Block a user