Greyscale bars/Display: Difference between revisions

Content added Content deleted
Line 319: Line 319:
return app.exec( ) ;
return app.exec( ) ;
}</lang>
}</lang>

=={{header|Euler Math Toolbox}}==

<lang Euler Math Toolbox>
>function grayscale(y1,y2,n,direction=1) ...
$ loop 0 to n-1;
$ s=#/(n-1); barcolor(rgb(s,s,s));
$ if direction==1 then plotbar(#/n,y1,1/n,y2-y1);
$ else plotbar(1-(#+1)/n,y1,1/n,y2-y1);
$ endif;
$ end;
$endfunction
>function grayscales () ...
$ aspect(2); barstyle("#");
$ window(0,0,1023,1023); margin(0); setplot(0,1,0,1);
$ clg;
$ hold on;
$ grayscale(3/4,1,8,1);
$ grayscale(1/2,3/4,14,-1);
$ grayscale(1/4,1/2,32,1);
$ grayscale(0,1/4,64,-1);
$ hold off;
$endfunction
>grayscales:
</lang>



=={{header|Haskell}}==
=={{header|Haskell}}==
Line 381: Line 407:
"*+.9876543210zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCA"
"*+.9876543210zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCA"
]</lang>
]</lang>

=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==
This procedure uses code from the [[Colour_bars/Display|Colour bars/Display task]], specifically the: ''DrawTestCard'' procedure and ''testcard'', ''band'', and ''bar''
This procedure uses code from the [[Colour_bars/Display|Colour bars/Display task]], specifically the: ''DrawTestCard'' procedure and ''testcard'', ''band'', and ''bar''