Color wheel: Difference between revisions
→{{header|Ring}}
No edit summary |
|||
Line 905:
=={{header|Ring}}==
[https://kepfeltoltes.zapto.org/public/
<lang ring>
load "stdlib.ring"
load "guilib.ring"
paint = null
new qapp { win1 = new qwidget()
{
label1 = new
exec()▼
}▼
func draw▼
p1 = new qpicture()▼
}
▲func draw
p1 = new
begin(p1)
▲ colorWheel()
▲ endpaint()
▲ }
▲ label1 { setpicture(p1) show() }
func colorWheel()
pi = 3.14
radius =
x = win1.width()
y = win1.height()
for i=1 to x
for j=1 to y
color = new qcolor()
h = (atan2(i-radius,j-radius)+pi)/(2*pi)
s = sqrt(pow(i-radius,2)+pow(j-radius,2))/radius
v = 1
if s < = 1 and h < = 1
color.setHsvF(h,s,v,1)
pen1 = new qpen() { setcolor(color) setwidth(5) }
ok
next
next
|