Color wheel: Difference between revisions

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
}{
paint win1 = new qpainterqwidget() {
setwindowtitle("Color wheel")
setgeometry(540500,140150,400xWidth,400yHeight)
}
}
Canvas paint.setPen= new qlabel(pen1win1)
show() {
### daVinci paints the MonaLisa on the Canvas
MonaLisa = new qPixMap2( xWidth, yHeight)
 
new qapp { win1 daVinci = new qwidgetqpainter()
{
setwindowtitle("Color wheel" begin(MonaLisa)
#endpaint() ### This will Stop the Painting. For Animation comment it out
setgeometry(540,140,400,400)
label1 = new qlabel(win1) { }
setgeometry(30,30,320,320)
settext("")
}
show()
}
draw()
exec()
}
 
paint.drawPoint setPixMap(i,jMonaLisa)
func draw
p1 = new qpicture() }
paint = new qpainter() {
begin(p1)
colorWheel()
endpaint()
}
label1 { setpicture(p1) show() }
 
draw show()
exec() }
ColorWheel()
settext exec("")
}
func colorWheel()
pi = 3.14
radius = 150
x = win1.width()xWidth
y = win1.height()yHeight
}
 
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>
2,468

edits