28 lines
685 B
Text
28 lines
685 B
Text
Declare Sub PaintCanvas
|
|
|
|
Create Form as Qform
|
|
Caption = "Rosetta Greyscale"
|
|
Center
|
|
create Canv as QCanvas
|
|
align = 5
|
|
onPaint = PaintCanvas
|
|
end create
|
|
end create
|
|
|
|
Sub PaintCanvas
|
|
NumRows = 4 'Change for number of rows
|
|
for curbar = 0 to NumRows-1
|
|
Bars = 2^(curbar+3)
|
|
for x = 0 to (Bars -1)
|
|
x1=Canv.Width/Bars*x
|
|
y1=Canv.Height/NumRows*CurBar
|
|
x2=Canv.Width/Bars*(x+1)
|
|
y2=Canv.Height/NumRows*(CurBar+1)
|
|
c=(255/(Bars-1))*x
|
|
c=iif(curbar mod 2, 255-c, c)
|
|
Canv.FillRect(x1, y1, x2, y2, rgb(c, c, c))
|
|
next x
|
|
next curbar
|
|
end sub
|
|
|
|
Form.showmodal
|