Greyscale bars/Display: Difference between revisions
no edit summary
m (changed iShade rounding mode due to shading errors at some bar ends; aligned equal signs in assignment groups) |
No edit summary |
||
Line 124:
Gtk.Main.Main;
end Greyscale;
</lang>
=={{header|Amazing Hopper}}==
{{trans|AWK}}
Version: hopper-FLOW!
<lang Amazing Hopper>
#include <flow.h>
#include <flow-term.h>
#define SPACE(_T_,_N_) REPLICATE( " ", {_T_}DIV-INTO(_N_) )
DEF-MAIN(argv,argc)
CLR-SCR
GOSUB( Print Grey Scale )
END
RUTINES
DEF-FUN( Print Grey Scale )
SET( nrcolors, 8 )
SET( direction, 1 )
MSET( quarter, color )
LOCATE( 0, 0 )
FOR( LT?( quarter, 4 ), ++quarter )
SET( height, 0 )
FOR( LT?( height, 5 ), ++height )
SET( width, 0 )
FOR( LT?( width, nrcolors ), ++width )
LET( color := CEIL( MUL( width, DIV( 255, SUB(nrcolors,1) ) ) ) )
WHEN( NOT( MOD( direction, 2 ) ) ){
LET( color := SUB( 255, color ) )
}
PRN( COLOR-RGBB( color, color, color) SPACE( 128, nrcolors ) )
NEXT
PRNL("\OFF")
NEXT
nrcolors*=2
++direction
NEXT
RET
</lang>
|