Pinstripe/Display: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (syntax highlighting fixup automation)
m (→‎{{header|Wren}}: Changed to Wren S/H)
(5 intermediate revisions by 3 users not shown)
Line 643:
//--------------------------------------------------------------------------------------------------
</syntaxhighlight>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
 
 
<syntaxhighlight lang="Delphi">
 
procedure DrawVerticalStripes(Image: TImage; PenWidth,Top,Bottom: integer);
{Draw vertical stripes across full width of image}
{Top/Bottom Control the position of the band of stripes}
{PenWidth controls width of the line drawn}
var X,X2,Y: integer;
begin
Image.Canvas.Pen.Width:=PenWidth;
for X:=0 to (Image.Width div PenWidth)-1 do
begin
if (X mod 2)=0 then Image.Canvas.Pen.Color:=clWhite
else Image.Canvas.Pen.Color:=clBlack;
X2:=X * PenWidth;
Image.Canvas.MoveTo(X2,Top);
Image.Canvas.LineTo(X2,Bottom);
end;
end;
 
procedure ShowVerticalStripes(Image: TImage);
{Draw all four bands of stripes}
var SHeight: integer;
var I: integer;
begin
SHeight:=Image.Height div 4;
for I:=0 to 4-1 do
begin
DrawVerticalStripes(Image,I+1,SHeight*I,SHeight*(I+1));
end;
end;
 
 
</syntaxhighlight>
{{out}}
[[File:DelphiPinstripes.png|thumb|none]]
<pre>
Elapsed Time: 26.113 ms.
</pre>
 
=={{header|FreeBASIC}}==
Line 886 ⟶ 930:
}
}</syntaxhighlight>
 
=={{header|Lambdatalk}}==
Using HTML+CSS
<syntaxhighlight lang="scheme">
{def window
{lambda {:w :h}
div
{@ style="position:relative;
top:0; left:0;
width::wpx; height::hpx;
background:#eee;"}}}
-> window
 
{def rec
{lambda {:x :y :w :h :c}
{div
{@ style="position:absolute;
top::ypx; left::xpx;
width::wpx; height::hpx;
background::c;"}}}}
-> rec
 
{def row
{lambda {:w :h :k}
{S.map {{lambda {:dx :dy :h :i}
{rec :i :dy :dx :h #000}
{rec {+ :i :dx} :dy :dx :h #fff}
} {pow 2 :k} {* :k {/ :w 8}} {/ :h 4}}
{S.serie 0 {- :w 1} {pow 2 {+ :k 1}}}}}}
-> row
 
{def WIDTH 512}
-> WIDTH
{def HEIGHT 256}
-> HEIGHT
 
{{window {WIDTH} {WIDTH}}
{S.map {row {WIDTH} {HEIGHT}}
0 1 2 3}}
</syntaxhighlight>
Output visible in http://lambdaway.free.fr/lambdawalks/?view=color_bar_display
 
=={{header|Liberty BASIC}}==
Line 1,176 ⟶ 1,261:
 
</syntaxhighlight>
 
=={{header|Quackery}}==
 
Adapted from [[Colour pinstripe/Display#Quackery]].
 
<syntaxhighlight lang="Quackery"> [ $ "turtleduck.qky" loadfile ] now!
 
[ 1280 ] is width ( --> n )
[ 720 ] is height ( --> n )
 
[ 0 0 0 ] is black ( --> n n n )
[ 255 255 255 ] is white ( --> n n n )
 
[ [] swap
' [ black white ]
witheach
[ over times
[ dip swap tuck
nested join
unrot ]
drop ]
drop ] is colours ( n --> [ )
 
[ behead
dup dip
[ nested join ] ] is nextcolour ( [ --> [ [ )
 
[ nextcolour colour
-1 4 turn
height n->v
4 n->v v/ 2dup walk
-v fly
1 4 turn
1 n->v fly ] is stripe ( [ --> [ )
 
[ turtle
50 frames
width n->v 2 1 v/ fly
-1 4 turn
height n->v 2 1 v/ fly
-1 4 turn
4 times
[ i^ 1+ colours
width times stripe
drop
width n->v -v fly
-1 4 turn
height n->v
4 n->v v/ fly
1 4 turn ]
1 frames ] is pinstripes ( --> )</syntaxhighlight>
 
{{out}}
 
[[File:Quackery pinstripes.png|thumb|center]]
 
=={{header|Racket}}==
Line 1,380 ⟶ 1,520:
{{trans|Go}}
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, Color
import "dome" for Window
 
9,485

edits