grayscaleBars.frink

View or download grayscaleBars.frink in plain text format


// Solution for RosettaCode program "Greyscale bars/Display"
// http://rosettacode.org/wiki/Greyscale_bars/Display

fakewidth =!= dummy

g = new graphics
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
   }
}


View or download grayscaleBars.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17649 days, 5 hours, 42 minutes ago.