Colour pinstripe/Display: Difference between revisions
Content deleted Content added
m →{{header|Quackery}}: fast graphics |
SqrtNegInf (talk | contribs) m →{{header|Perl}}: future-proof for 5.36, tidy code |
||
Line 1,476:
=={{header|Perl}}==
<syntaxhighlight lang="perl">
use
use GD
my %colors = (
my $image = new GD::Image( 320 , 240 ) ;▼
"magenta" => [255,
my($height, $width) = (240, 320);
my @paintcolors ;▼
foreach my $color ( keys %colors ) {▼
my $paintcolor = $image->colorAllocate( @{$colors{ $color }} ) ; ▼
my($startx, $starty, $run, $colorindex) = (0) x 4;
}
my $startx = 0 ;▼
▲my $barheight = 240 / 4 ;
my $colorindex = 0 ;▼
while ( $run < 4 ) {
my $barwidth = $run + 1
while ( $startx + $barwidth <
$image->filledRectangle( $startx
$startx + $barwidth,
$
$paintcolors[ $colorindex
$colorindex++;
$
$
}▼
$run++;
open ( DISPLAY , ">" , "pinstripes.png" ) || die ;▼
binmode DISPLAY ;▼
print DISPLAY $image->png ;▼
close DISPLAY ;</syntaxhighlight>▼
=={{header|Phix}}==
|