Color wheel: Difference between revisions
→{{header|Ring}}
Line 908:
<lang ring>
# Project : Color Wheel
# Date : 2021/09/09
# Author : Gal Zsolt (CalmoSoft), Bert Mariani
# Email : calmosoft@gmail.com
load "stdlib.ring"
load "guilib.ring"
paint = null
xWidth = 300
yHeight = 300
MyApp = new qapp
setwindowtitle("Color wheel")
### daVinci paints the MonaLisa on the Canvas
MonaLisa = new qPixMap2( xWidth, yHeight)
{
#endpaint() ### This will Stop the Painting. For Animation comment it out
▲ setgeometry(540,140,400,400)
settext("")▼
▲ }
▲ show()
▲ }
▲ }
▲ paint = new qpainter() {
}▼
ColorWheel()
}
func colorWheel()
pi = 3.14
radius = 150
x =
y =
for i = 1 to x
for j = 1 to y
color = new qcolor() { setrgb(255,255,255,255) }
pen1 = new qpen() { setcolor(color) setwidth(5) }
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) }
▲ paint.setPen(pen1)
▲ paint.drawPoint(i,j)
ok
daVinci.setPen(pen1)
daVinci.drawPoint(i,j)
next
Canvas.setPixMap(MonaLisa) ### Need this setPixMap to display imageLabel
MyApp.ProcessEvents() ### <<< EXEC the Draw
next
</lang>
|