Notifications
Clear all

[Closed] convert HSV to RGB

is it some sort of challenge to write your own function to convert HSV to RGB? OK. Here is my version:


  fn HSV_to_RGB hsv = 
  (
  	hsv /= 255
  	h = hsv.x*6
  	i = h as integer
  	k = if (mod i 2) == 1 then (h-i) else (1-h+i)
  	m = hsv.z*(1-hsv.y)
  	n = hsv.z*(1-hsv.y*k)
  	case i of
  	(
  			1: [n, hsv.z, m]*255
  			2: [m, hsv.z, n]*255
  			3: [m, n, hsv.z]*255
  			4: [n, m, hsv.z]*255
  			5: [hsv.z, m, n]*255
  	  default: [hsv.z, n, m]*255
  	)
  )
  HSV_to_RGB [108,90,210]
  

Well what else am I supposed to with 850 lines of blendmode functions from an outdated compositing script? They were lonely.

Page 2 / 2