RosettaCodeData/Task/Greyscale-bars-Display/Frink/greyscale-bars-display.frink
2020-02-17 23:21:07 -08:00

21 lines
572 B
Text

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[640,480,1] // 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
}
}