Pinstripe/Display: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
m (bold important info and format the task)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 179:
Gdip_Shutdown(pToken)
ExitApp</lang>
 
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
Line 247 ⟶ 248:
closegraph();
return 0;
}
</lang>
 
=={{header|C sharp}}==
 
Using System.Drawing, and writing the output to a file.
 
<lang csharp>
using System.Drawing;
 
public class Pinstripe
{
static void Main(string[] args)
{
var pinstripe = MakePinstripeImage(1366, 768);
pinstripe.Save("pinstripe.png");
}
 
public static Bitmap MakePinstripeImage(int width, int height)
{
var image = new Bitmap(width, height);
var quarterHeight = height / 4;
for (var y = 0; y < height; y++)
{
var stripeWidth = (y / quarterHeight) + 1;
for (var x = 0; x < width; x++)
{
var color = ((x / stripeWidth) % 2) == 0 ? Color.White : Color.Black;
image.SetPixel(x, y, color);
}
}
return image;
}
}
</lang>
Line 372 ⟶ 409:
</lang>
 
=={{header|C sharp}}==
 
Using System.Drawing, and writing the output to a file.
 
<lang csharp>
using System.Drawing;
 
public class Pinstripe
{
static void Main(string[] args)
{
var pinstripe = MakePinstripeImage(1366, 768);
pinstripe.Save("pinstripe.png");
}
 
public static Bitmap MakePinstripeImage(int width, int height)
{
var image = new Bitmap(width, height);
var quarterHeight = height / 4;
for (var y = 0; y < height; y++)
{
var stripeWidth = (y / quarterHeight) + 1;
for (var x = 0; x < width; x++)
{
var color = ((x / stripeWidth) % 2) == 0 ? Color.White : Color.Black;
image.SetPixel(x, y, color);
}
}
return image;
}
}
</lang>
=={{header|FreeBASIC}}==
<lang freebasic>' version 14-03-2017
Line 763 ⟶ 765:
$img->write(file => 'pinstripes-bw.png');</lang>
[https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/pinstripes-bw.png Pinstripes] (offsite image)
 
=={{header|Perl 6}}==
{{Works with|rakudo|2018.10}}
<lang perl6>my ($x,$y) = 1280,720;
my @colors = 0, 1;
 
spurt "pinstripes.pgm", qq:to/EOH/ orelse .die;
P5
# pinstripes.pgm
$x $y
1
EOH
 
my $img = open "pinstripes.pgm", :a, :bin orelse .die;
 
my $vzones = $y div 4;
for 1..4 -> $w {
my $stripes = ceiling $x / $w / +@colors;
my $line = Buf.new: (flat((@colors Xxx $w) xx $stripes).Array).splice(0,$x); # DH change 2015-12-20
$img.write: $line for ^$vzones;
}
 
$img.close;</lang>
 
=={{header|Phix}}==
Line 897 ⟶ 876:
 
</lang>
 
 
 
=={{header|Racket}}==
Line 931 ⟶ 908:
(void (new full-frame%))
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
{{Works with|rakudo|2018.10}}
<lang perl6>my ($x,$y) = 1280,720;
my @colors = 0, 1;
 
spurt "pinstripes.pgm", qq:to/EOH/ orelse .die;
P5
# pinstripes.pgm
$x $y
1
EOH
 
my $img = open "pinstripes.pgm", :a, :bin orelse .die;
 
my $vzones = $y div 4;
for 1..4 -> $w {
my $stripes = ceiling $x / $w / +@colors;
my $line = Buf.new: (flat((@colors Xxx $w) xx $stripes).Array).splice(0,$x); # DH change 2015-12-20
$img.write: $line for ^$vzones;
}
 
$img.close;</lang>
 
=={{header|Ring}}==
Line 1,039 ⟶ 1,040:
 
}</lang>
 
=={{header|Sinclair ZX81 BASIC}}==
Requires at least 2k of RAM. (Why? Because the whole screen is in use: we have no separate video RAM, so the 1k model runs out of memory trying to plot the bottom quarter of the display.)
10,333

edits