The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.



The pinstripes should either follow the system palette sequence,   or a sequence that includes:

black,   red,   green,   blue,   magenta,   cyan,   yellow,   and   white:

   after filling the top quarter, switch to a wider 2 pixel wide vertical pinstripe pattern,
   halfway down the display, switch to 3 pixel wide vertical pinstripe,
   finally to a 4 pixels wide vertical pinstripe for the last quarter of the display.


See also

   display black and white 
   print colour


 
# Project : Colour pinstripe/Display
 
load "guilib.ring"
 
paint = null
 
new qapp 
        {
        win1 = new qwidget() {
                  setwindowtitle("archimedean spiral")
                  setgeometry(100,100,500,600)
                  label1 = new qlabel(win1) {
                              setgeometry(10,10,400,400)
                              settext("")
                  }
                  new qpushbutton(win1) {
                          setgeometry(150,500,100,30)
                          settext("draw")
                          setclickevent("draw()")
                  }
                  show()
        }
        exec()
        }
 
func draw
        p1 = new qpicture()
               color = new qcolor() {
               setrgb(0,0,255,255)
        }
        pen = new qpen() {
                 setcolor(color)
                 setwidth(1)
        }
        paint = new qpainter() {
                  begin(p1)
                  setpen(pen)
        w = 100
        h = 100
        color = list(8)
        color[1] = [0 ,0, 0]
        color[2] = [255, 0, 0]
        color[3] = [0, 255, 0]
        color[4] = [0, 0, 255]
        color[5] = [255, 0, 255]
        color[6] = [0, 255, 255]
        color[7] = [255, 255, 0]
        color[8] = [255, 255, 255]
        y = h*4
        for p = 1 to 4
             y = y - h
             for x = 0 to w step 4*p
                  col = random(7) + 1
                  color2 = new qcolor()
                  color2.setrgb(color[col][1],color[col][2],color[col][3],255)
                  mybrush = new qbrush() {setstyle(1) setcolor(color2)}
                  setbrush(mybrush)
                  paint.drawrect(x, y, 2*p, h)
             next
        next 
        endpaint()
        }
        label1 { setpicture(p1) show() }
 