// Solution for RosettaCode program "Greyscale bars/Display" // http://rosettacode.org/wiki/Greyscale_bars/Display fakewidth =!= dummy g = new graphics g.antialiased[false] drawBars[g, 0, 1, 0, 1/4, 8] drawBars[g, 1, 0, 1/4, 1/2, 16] drawBars[g, 0, 1, 1/2, 3/4, 32] drawBars[g, 1, 0, 3/4, 1, 64] g.show[100 percent] // No portable fullscreen mode; user must maximize window. drawBars[g is graphics, leftColor, rightColor, top, bottom, steps] := { colorStep = (rightColor - leftColor) / steps color = leftColor for i=0 to steps-1 { g.color[color, color, color] g.fillRectSides[i/dummy/steps, top, (i+1)/dummy/steps, bottom] color = color + colorStep } }