RosettaCodeData/Task/Colour-bars-Display/Icon/colour-bars-display-1.icon
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

37 lines
1.1 KiB
Text

link graphics,printf
procedure main() # generalized colour bars
DrawTestCard(Simple_TestCard())
WDone()
end
procedure DrawTestCard(TC)
size := sprintf("size=%d,%d",TC.width,TC.height)
&window := TC.window := open(TC.id,"g","bg=black",size) |
stop("Unable to open window")
every R := TC.bands[r := 1 to *TC.bands -1] do
every C := R.bars[c := 1 to *R.bars - 1] do {
Fg(R.bars[c].colour)
FillRectangle( C.left, R.top,
R.bars[c+1].left-C.left, TC.bands[r+1].top-R.top )
}
return TC
end
record testcard(window,id,width,height,bands)
record band(top,bars)
record bar(left,colour)
procedure Simple_TestCard() #: return structure simple testcard
return testcard(,"Simple Test Card",width := 800,height := 600,
[ band( 1, [ bar( 1, "black"),
bar(114, "red"),
bar(228, "green"),
bar(342, "blue"),
bar(456, "magenta"),
bar(570, "cyan"),
bar(684, "yellow"),
bar(width) ] ),
band(height) ])
end