Colour pinstripe/Display: Difference between revisions

Improve Uxntal version with suggestions from #uxn IRC channel
m (→‎{{header|Phix}}: added syntax colouring, marked p2js compatible)
(Improve Uxntal version with suggestions from #uxn IRC channel)
 
(21 intermediate revisions by 13 users not shown)
Line 18:
{{works with|https://skilldrick.github.io/easy6502/ Easy6502}}
Output can be seen by copying and pasting this code into the code editor, then clicking "Assemble," then "Run."
<langsyntaxhighlight lang="6502asm">define color $00
define looptemp $01
 
Line 113:
bcc loop_4wide
 
brk ;program end</langsyntaxhighlight>
 
=={{header|Action!}}==
<langsyntaxhighlight Actionlang="action!">PROC Main()
BYTE
i,
Line 164:
DO UNTIL CH#$FF OD
CH=$FF
RETURN</langsyntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Colour_pinstripe_display.png Screenshot from Atari 8-bit computer]
 
=={{header|ActionScript}}==
<syntaxhighlight lang="actionscript3">
<lang ActionScript3>
package {
Line 225:
 
}
</syntaxhighlight>
</lang>
 
=={{header|Ada}}==
{{libheader|SDLAda}}
<langsyntaxhighlight Adalang="ada">with SDL.Video.Windows.Makers;
with SDL.Video.Renderers.Makers;
with SDL.Video.Palettes;
Line 302:
Window.Finalize;
SDL.Finalise;
end Colour_Pinstripe_Display;</langsyntaxhighlight>
 
=={{header|ARM Assembly}}==
Line 310:
This uses the Game Boy Advance's bitmap screen modes; no pre-defined tilemaps are needed.
 
<langsyntaxhighlight ARMlang="arm Assemblyassembly"> .org 0x08000000 ;cartridge ROM begins here
 
b ProgramStart ;branch around the cartridge header
Line 399:
.word 0b0111111111100000 ;cyan
.word 0b0000001111111111 ;yellow
.word 0x7FFF ;white</langsyntaxhighlight>
 
{{out}}
Line 410:
Requires the GDI+ standard library: http://www.autohotkey.com/forum/viewtopic.php?t=32238<br/>
It is worth noting that this fills the whole screen; press Esc to exit.
<langsyntaxhighlight AHKlang="ahk">h := A_ScreenHeight
w := A_ScreenWidth
pToken := gdip_Startup()
Line 452:
Exit:
Gdip_Shutdown(pToken)
ExitApp</langsyntaxhighlight>
 
=={{header|BBC BASIC}}==
==={{header|BASIC256}}===
{{trans|Yabasic}}
<syntaxhighlight lang="basic256">w = 640 : h = 480
graphsize w, h
 
dim k = {black, red, green, blue, purple, cyan, yellow, white}
h /= 4
 
for i = 1 to 4
col = 0
y = (i-1) * h
for x = 1 to w step i
if col mod 8 = 0 then col = 0
colour k[col]
rect (x, y, x + i, y + h)
col += 1
next x
next i</syntaxhighlight>
 
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
<langsyntaxhighlight lang="bbcbasic"> SW_MAXIMIZE = 3
SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
VDU 26
Line 480 ⟶ 500:
NEXT
NEXT P%
</syntaxhighlight>
</lang>
 
=={{header|Befunge}}==
Line 488 ⟶ 508:
The dimensions of the image are specified by the first two values on the stack: 1366 (<tt>"%":*3-</tt>) by 768 (<tt>"`"8*</tt>).
 
<langsyntaxhighlight lang="befunge">"%":*3-"`"8*>4/::8%00p8/10p4*\55+"3P",,,:.\.5v
5+:,1vv\%2:%8/-g025:\-1_$$55+,\:v1+*8g01g00_@>
024,.<>2/:2%\2/...1+\:>^<:\0:\-1_$20g1-:20p^1p</langsyntaxhighlight>
 
=={{header|C}}==
Line 496 ⟶ 516:
The following code uses the BGI graphics library of Borland's Turbo C.
 
<syntaxhighlight lang="c">
<lang C>
#include<graphics.h>
#include<conio.h>
Line 525 ⟶ 545:
return 0;
}
</syntaxhighlight>
</lang>
 
=={{header|C++}}==
[[File:clr_pinstripe_cpp.png|300px]]
<langsyntaxhighlight lang="cpp">
#include <windows.h>
 
Line 650 ⟶ 670:
}
//--------------------------------------------------------------------------------------------------
</syntaxhighlight>
</lang>
 
=={{header|Common Lisp}}==
Line 656 ⟶ 676:
which causes the line caps to make the edges between regions to be a bit ragged. I mention
a couple of alternatives there which I'm too lazy to implement right now.
<langsyntaxhighlight lang="lisp">(in-package :cg-user)
 
;;; We only need a bitmap pane - nothing fancy
Line 690 ⟶ 710:
(draw-line win
(make-position xpos top)
(make-position xpos bottom)))))))</langsyntaxhighlight>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
[[File:DelphiColorStripes.png|frame|none]]
 
<syntaxhighlight lang="Delphi">
procedure DrawColorStripes(Image: TImage; Colors: array of TColor; 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
Image.Canvas.Pen.Color:=Colors[X mod Length(Colors)];
X2:=X * PenWidth;
Image.Canvas.MoveTo(X2,Top);
Image.Canvas.LineTo(X2,Bottom);
end;
end;
 
 
var Colors: array [0..7] of TColor = (clBlack, clRed, clGreen, clBlue, clFuchsia, clAqua, clYellow, clWhite);
 
procedure ShowColorStripes(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
DrawColorStripes(Image,Colors,I+1,SHeight*I,SHeight*(I+1));
end;
end;
 
 
</syntaxhighlight>
{{out}}
<pre>
Elapsed Time: 20.167 ms.
 
</pre>
 
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=PU3LCoMwELznK+bYB5VNsdA99EtCThpBtKTYIPr3ncXQwzKPndmdQsQLASIC5YhyRMmVnEitxOiGvGBk1qNktA5Al2fTRncjrN8YueD+MM8KG33Bt6QPF+zVjK2PA8xMgRir9c5rYmuvckldYfM4+H95MrjCnxnvPZ62bFzjfg== Run it]
<syntaxhighlight>
k[] = [ 000 900 090 009 909 099 990 999 ]
for i = 1 to 4
col = 1
y = 100 - i * 25
for x = 0 step i to 100 - i
color k[col]
move x y
rect i 25
col = (col + 1) mod1 8
.
.
</syntaxhighlight>
 
=={{header|Factor}}==
<langsyntaxhighlight lang="factor">USING: accessors arrays colors.constants kernel locals math
math.ranges opengl sequences ui ui.gadgets ui.render ;
 
Line 730 ⟶ 811:
bands [1,b] [ draw-pinstripe ] with each ;
 
<pinstripe> "Color pinstripe" open-window</langsyntaxhighlight>
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">' version 14-03-2017
' compile with: fbc -s console
' or compile with: fbc -s gui
Line 758 ⟶ 839:
'Print : Print "hit any key to end program"
Sleep
End</langsyntaxhighlight>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
 
void local fn DoIt
long c = 0, x, y, w = 1
CFArrayRef colors = @[fn ColorBlack,fn ColorRed,
fn ColorGreen,fn ColorBlue,fn ColorMagenta,
fn ColorCyan,fn ColorYellow,fn ColorWhite]
window 1,, (0,0,384,240), NSWindowStyleMaskBorderless
pen -1
for y = 0 to 180 step 60
for x = 0 to 384 - w step w
rect fill (x,y,w,60), colors[c]
c++
if ( c >= len(colors) ) then c = 0
next
w++
next
end fn
 
fn DoIt
 
HandleEvents
</syntaxhighlight>
 
[[File:ColorPinstripeDisplayFB.png]]
 
=={{header|Gambas}}==
<langsyntaxhighlight lang="gambas">'WARNING this takes a time to display
 
Public Sub Form_Open()
Line 788 ⟶ 899:
 
End
</syntaxhighlight>
</lang>
'''[http://www.cogier.com/gambas/colour_pinstripe.png Click to see output image]'''
 
Line 794 ⟶ 905:
{{libheader|Go Graphics}}
{{trans|Java}}
<langsyntaxhighlight lang="go">package main
 
import "github.com/fogleman/gg"
Line 826 ⟶ 937:
pinstripe(dc)
dc.SavePNG("color_pinstripe.png")
}</langsyntaxhighlight>
 
{{out}}
Line 836 ⟶ 947:
This is a modified version of the [[Pinstripe/Display]] solution. A shrunken screenshot is included.
 
<langsyntaxhighlight Iconlang="icon">link graphics,numbers,printf
procedure main() # pinstripe
Line 865 ⟶ 976:
}
WDone()
end</langsyntaxhighlight>
 
[[File:Pinstripe_Colour_unicon.jpeg]]
Line 875 ⟶ 986:
 
=={{header|J}}==
<langsyntaxhighlight lang="j"> load 'viewmat'
size=. 2{.".wd'qm' NB. J6
size=. getscreenwh_jgtk_ '' NB. J7
'rgb'viewmat (4<.@%~{:size)# ({.size) $&> 1 2 3 4#&.> <256#.255*#:i.8</langsyntaxhighlight>
 
=={{header|Java}}==
{{works with|Java|8}}
<langsyntaxhighlight lang="java">import java.awt.*;
import static java.awt.Color.*;
import javax.swing.*;
Line 919 ⟶ 1,030:
});
}
}</langsyntaxhighlight>
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">using Gtk, Graphics, Colors
 
function drawline(ctx, p1, p2, color, width)
Line 963 ⟶ 1,074:
signal_connect(endit, win, :destroy)
wait(cond)
</syntaxhighlight>
</lang>
 
=={{header|Kotlin}}==
{{trans|Java}}
<langsyntaxhighlight lang="scala">// version 1.1.0
 
import java.awt.*
Line 1,008 ⟶ 1,119:
f.isVisible = true
}
}</langsyntaxhighlight>
 
=={{header|Lua}}==
{{libheader|nw}}
{{libheader|cairo}}
<syntaxhighlight lang="lua">local nw = require("nw")
local app = nw:app()
local cw, ch = 320, 240
local win = app:window(cw, ch, "Color Pinstripe", false)
local colors = {{0,0,0}, {1,0,0}, {0,1,0}, {0,0,1}, {1,0,1}, {0,1,1}, {1,1,0}, {1,1,1}}
local unpack = unpack or table.unpack -- polyfill 5.2 vs 5.3
function win:repaint()
local cr = win:bitmap():cairo()
local ystride = ch/4
for y = 0, ch-1, ystride do
local i, xstride = 1, y/ystride+1
for x = 0, cw-1, xstride do
cr:rectangle(x, y, xstride, ystride)
cr:rgb(unpack(colors[i]))
cr:fill()
i = (i % #colors) + 1
end
end
end
win:show()
app:run()</syntaxhighlight>
 
=={{header|M2000 Interpreter}}==
Line 1,020 ⟶ 1,156:
We use a thread to move the layer above console (and inside console form), when we push any mouse button (only in console window). Program ends when we close the modal opened window.
 
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module Checkit {
Window 16, 14000,12000;
Line 1,070 ⟶ 1,206:
Checkit
 
</syntaxhighlight>
</lang>
 
=={{header|Maple}}==
<syntaxhighlight lang="maple">
<lang Maple>
colors := [yellow, black, red, green, magenta, cyan, white]:
plots:-display( [
Line 1,079 ⟶ 1,215:
seq( plot([1+i/10,y,y=4..5], color=colors[i mod 7 + 1],thickness=2), i = 1..500),seq( plot([1+i/10,y,y=3..4], color=colors[i mod 7 + 1],thickness=3), i = 1..500),seq( plot([1+i/10,y,y=2..3], color=colors[i mod 7 + 1],thickness=4,size=[interface(screenwidth)*20,interface(screenheight)*32]), i = 1..500)],
axes=none);
</syntaxhighlight>
</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">color[y_] := {Black, Red, Green, Blue, Magenta, Cyan, Yellow,
White}[[Mod[y, 8] + 1]];
Graphics[Join[{Thickness[1/408]},
Line 1,092 ⟶ 1,228:
Range[136]], {Thickness[1/102]},
Flatten[{color[#], Line[{{4 # - 2, 102}, {4 # - 2, 1}}]} & /@
Range[102]]], ImageSize -> {408, 408}]</langsyntaxhighlight>
{{out}}
See [https://www.dropbox.com/s/tg4zk4jkddkok8w/Mathematica_Pinstripes_Colored.png?dl=0 here].
 
=={{header|MIPS Assembly}}==
This isn't perfect, as the edges are cut off due to overscan. But this is as close as I could get:
<syntaxhighlight lang="mips">.include "\SrcAll\Header.asm"
.include "\SrcAll\BasicMacros.asm"
.include "\SrcALL\AdvancedMacros.asm"
.include "\SrcALL\MemoryMap.asm"
 
.definelabel VRAMBASE,0xA0100008 ;the extra 8 accounts for overscan
.definelabel VRAMSIZE,0x12C00 ;320x240(decimal)
 
;;;;;;;;;;;;;;;;;;;;;;;;;
 
main:
la $a0,VRAMBASE
la $a1,colors
li $t1,0x4B00/8
 
LOOP1:
lh $t0,($a1)
sh $t0,($a0)
 
lh $t0,2($a1)
sh $t0,2($a0)
lh $t0,4($a1)
sh $t0,4($a0)
lh $t0,6($a1)
sh $t0,6($a0)
lh $t0,8($a1)
sh $t0,8($a0)
lh $t0,10($a1)
sh $t0,10($a0)
lh $t0,12($a1)
sh $t0,12($a0)
lh $t0,14($a1)
sh $t0,14($a0)
addiu $a0,16
subiu $t1,1
bnez $t1,LOOP1
nop
li $t1,0x4B00/16
LOOP2:
lh $t0,($a1)
sh $t0,($a0)
sh $t0,2($a0)
lh $t0,2($a1)
sh $t0,4($a0)
sh $t0,6($a0)
lh $t0,4($a1)
sh $t0,8($a0)
sh $t0,10($a0)
lh $t0,6($a1)
sh $t0,12($a0)
sh $t0,14($a0)
 
lh $t0,8($a1)
sh $t0,16($a0)
sh $t0,18($a0)
lh $t0,10($a1)
sh $t0,20($a0)
sh $t0,22($a0)
lh $t0,12($a1)
sh $t0,24($a0)
sh $t0,26($a0)
lh $t0,14($a1)
sh $t0,28($a0)
sh $t0,30($a0)
addiu $a0,32
subiu $t1,1
bnez $t1,LOOP2
nop
li $t1,0x4B00/32
LOOP3:
lh $t0,0($a1)
sh $t0,0($a0)
sh $t0,2($a0)
sh $t0,4($a0)
lh $t0,2($a1)
sh $t0,6($a0)
sh $t0,8($a0)
sh $t0,10($a0)
lh $t0,4($a1)
sh $t0,12($a0)
sh $t0,14($a0)
sh $t0,16($a0)
lh $t0,8($a1)
sh $t0,18($a0)
sh $t0,20($a0)
sh $t0,22($a0)
lh $t0,10($a1)
sh $t0,24($a0)
sh $t0,26($a0)
sh $t0,28($a0)
lh $t0,12($a1)
sh $t0,30($a0)
sh $t0,32($a0)
sh $t0,34($a0)
lh $t0,14($a1)
sh $t0,36($a0)
sh $t0,38($a0)
sh $t0,40($a0)
lh $t0,0($a1)
sh $t0,42($a0)
sh $t0,44($a0)
sh $t0,46($a0)
lh $t0,2($a1)
sh $t0,48($a0)
sh $t0,50($a0)
sh $t0,52($a0)
lh $t0,4($a1)
sh $t0,54($a0)
sh $t0,56($a0)
sh $t0,58($a0)
lh $t0,6($a1)
sh $t0,60($a0)
sh $t0,62($a0)
addiu $a0,64
subiu $t1,1
bnez $t1,LOOP3
nop
li $t1,0x4B00/32
LOOP4:
lh $t0,0($a1)
sh $t0,0($a0)
sh $t0,2($a0)
sh $t0,4($a0)
sh $t0,6($a0)
lh $t0,2($a1)
sh $t0,8($a0)
sh $t0,10($a0)
sh $t0,12($a0)
sh $t0,14($a0)
lh $t0,4($a1)
sh $t0,16($a0)
sh $t0,18($a0)
sh $t0,20($a0)
sh $t0,22($a0)
lh $t0,6($a1)
sh $t0,24($a0)
sh $t0,26($a0)
sh $t0,28($a0)
sh $t0,30($a0)
 
lh $t0,8($a1)
sh $t0,32($a0)
sh $t0,34($a0)
sh $t0,36($a0)
sh $t0,38($a0)
lh $t0,10($a1)
sh $t0,40($a0)
sh $t0,42($a0)
sh $t0,44($a0)
sh $t0,46($a0)
lh $t0,12($a1)
sh $t0,48($a0)
sh $t0,50($a0)
sh $t0,52($a0)
sh $t0,54($a0)
lh $t0,14($a1)
sh $t0,56($a0)
sh $t0,58($a0)
sh $t0,60($a0)
sh $t0,62($a0)
 
addiu $a0,64
subiu $t1,1
bnez $t1,LOOP4
nop
shutdown:
nop ;project 64 will throw an error and end the program if I don't have a NOP here. Real hardware doesn't care.
b shutdown
nop
colors:
;colors are approximate because I'm not sure how the bit patterns work.
.halfword 0x0000,0xf000,0x0f00,0x00f0,0xf0f0,0x7fff,0xff00,0xffff
.include "\SrcN64\Footer.asm"</syntaxhighlight>
 
{{out}}
[[https://ibb.co/y4gg97Z Output of Nintendo 64 emulator]]
 
=={{header|Nim}}==
{{libheader|gintro}}
<langsyntaxhighlight Nimlang="nim">import gintro/[glib, gobject, gtk, gio, cairo]
 
const
Line 1,160 ⟶ 1,512:
let app = newApplication(Application, "Rosetta.ColorPinstripe")
discard app.connect("activate", activate)
discard app.run()</langsyntaxhighlight>
 
=={{header|OCaml}}==
 
<langsyntaxhighlight lang="ocaml">open Graphics
 
let () =
Line 1,180 ⟶ 1,532:
done
done;
ignore(read_key())</langsyntaxhighlight>
 
run with:
Line 1,186 ⟶ 1,538:
 
=={{header|Perl}}==
<syntaxhighlight lang="perl">use strict;
<lang Perl>#!/usr/bin/perl -w
use strict warnings;
use GD ;
 
my %colors = (
my $image = new GD::Image( 320 , 240 ) ;
my"white" %colors => ([255,255,255], "whitered" => [ 255 , 255 0, 255 0] , "redgreen" => [255 , 0,255, 0], "blue" => [ 0, ] 0,255],
"magenta" => [255, 0,255], "greenyellow" => [255,255, 0 0], 255"cyan" , 0=> ][ 0,255,255], "blueblack" => [ 0 0, 0 0, 255 0] , );
 
"magenta" => [ 255 , 0 , 255 ] , "yellow" => [ 255 , 255 , 0 ] ,
my($height, $width) = (240, 320);
"cyan" => [ 0 , 255 , 255 ] , "black" => [ 0 , 0 , 0 ] ) ;
my $image = GD::Image->new( $width , $height );
my @paintcolors ;
 
foreach my $color ( keys %colors ) {
my @paintcolors;
my $paintcolor = $image->colorAllocate( @{$colors{ $color }} ) ;
my $barheight = $height / 4;
push @paintcolors, $paintcolor ;
my($startx, $starty, $run, $colorindex) = (0) x 4;
 
for my $color ( sort keys %colors ) {
push @paintcolors, $image->colorAllocate( @{$colors{ $color }} );
}
 
my $startx = 0 ;
my $starty = 0 ;
my $run = 0 ;
my $barheight = 240 / 4 ;
my $colorindex = 0 ;
while ( $run < 4 ) {
my $barwidth = $run + 1 ;
while ( $startx + $barwidth < 320$width ) {
$image->filledRectangle( $startx , $starty , $startx + $barwidth ,
$startx + $barwidth,
$starty + $barheight - 1 , $paintcolors[ $colorindex % 8 ] ) ;
$startxstarty += $barwidthbarheight - ;1,
$paintcolors[ $colorindex++ % 8 ] );
$startx += $barwidth;
}
$colorindex++;
$starty += $barheight ;
$startx = 0 ;}
$colorindexstarty = 0 += $barheight;
$run++startx = 0;
$colorindex = 0;
}
$run++;
open ( DISPLAY , ">" , "pinstripes.png" ) || die ;
}
binmode DISPLAY ;
 
print DISPLAY $image->png ;
open ( DISPLAY , '>' , 'pinstripes.png' ) or die;
close DISPLAY ;</lang>
binmode DISPLAY;
print DISPLAY $image->png;
close DISPLAY;</syntaxhighlight>
 
=={{header|Phix}}==
{{libheader|Phix/pGUI}}
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Colour_pinstripe.exw
Line 1,314 ⟶ 1,669:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</langsyntaxhighlight>-->
Simply change constant colours to {CD_BLACK, CD_WHITE} for the monochrome tasks (as redirected here).
 
Line 1,324 ⟶ 1,679:
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">(de *Colors # Black Red Green Blue Magenta Cyan Yellow White
((0 0 0) (255 0 0) (0 255 0) (0 0 255)
(255 0 255) (0 255 255) (255 255 0) (255 255 255) .) )
Line 1,341 ⟶ 1,696:
(prinl (length (car Ppm)) " " (length Ppm))
(prinl 255)
(for Y Ppm (for X Y (apply wr X))) ) )</langsyntaxhighlight>
 
=={{header|Plain English}}==
<langsyntaxhighlight lang="plainenglish">To run:
Start up.
Clear the screen.
Line 1,383 ⟶ 1,738:
Add 1 pixel to the color pinstripe's width.
Move the color pinstripe's box down the color pinstripe's box's height.
Draw the color pinstripe.</langsyntaxhighlight>
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">;Create a Pinstripe image with a pattern of vertical stripe colors
Procedure PinstripeDisplay(width, height, Array psColors(1), numColors = 0)
Protected x, imgID, psHeight = height / 4, psWidth = 1, psTop, horzBand, curColor
Line 1,428 ⟶ 1,783:
While WaitWindowEvent() <> #PB_Event_CloseWindow
Wend
EndIf</langsyntaxhighlight>
 
=={{header|Python}}==
<syntaxhighlight lang="python">
<lang Python>
from turtle import *
 
Line 1,466 ⟶ 1,821:
notused = input("Hit enter to continue: ")
</syntaxhighlight>
</lang>
 
=={{header|QBasic}}==
{{works with|QBasic|1.1}}
{{trans|BASIC256}}
<syntaxhighlight lang="qbasic">SCREEN 12
w = 640: h = 480
 
h = h / 4
y2 = h - 1
 
FOR i = 1 TO 4
col = 0
y = (i - 1) * h
FOR x = 1 TO w STEP i
IF col MOD 15 = 0 THEN col = 0
LINE (x, y)-(x + i, y + h), col, BF
col = col + 1
NEXT x
NEXT i</syntaxhighlight>
 
=={{header|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 0 0 ] is red ( --> n n n )
[ 0 255 0 ] is green ( --> n n n )
[ 0 0 255 ] is blue ( --> n n n )
[ 255 0 255 ] is magenta ( --> n n n )
[ 0 255 255 ] is cyan ( --> n n n )
[ 255 255 0 ] is yellow ( --> n n n )
[ 255 255 255 ] is white ( --> n n n )
 
[ [] swap
' [ black red
green blue
magenta cyan
yellow 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 colour pinstripe.png|thumb|center]]
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">
<lang Racket>
#lang racket/gui
 
Line 1,500 ⟶ 1,936:
 
(void (new full-frame%))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku" perl6line>my ($x,$y) = 1280, 720;
 
my @colors = map -> $r, $g, $b { [$r, $g, $b] },
Line 1,532 ⟶ 1,968:
}
 
$img.close;</langsyntaxhighlight>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
# Project : Colour pinstripe/Display
 
Line 1,599 ⟶ 2,035:
}
label1 { setpicture(p1) show() }
</syntaxhighlight>
</lang>
 
See image:
Line 1,607 ⟶ 2,043:
=={{header|Scala}}==
===Java Swing Interoperability===
<langsyntaxhighlight Scalalang="scala">import java.awt.Color._
import java.awt._
 
Line 1,645 ⟶ 2,081:
)
 
}</langsyntaxhighlight>
 
=={{header|Sidef}}==
{{trans|Perl}}
<langsyntaxhighlight lang="ruby">require('GD')
 
func pinstripes(width = 1280, height = 720) {
Line 1,678 ⟶ 2,114:
}
 
File('pinstripes.png').write(pinstripes().png, :raw)</langsyntaxhighlight>
 
=={{header|SmileBASIC}}==
<langsyntaxhighlight lang="smilebasic">FOR I=1 TO 4
COLIDX=0
YTOP=(I-1)*60
Line 1,702 ⟶ 2,138:
DATA 0,255,255
DATA 255,255,0
DATA 255,255,255</langsyntaxhighlight>
 
=={{header|Tcl}}==
{{libheader|Tk}}
<langsyntaxhighlight lang="tcl">package require Tcl 8.5
package require Tk 8.5
Line 1,722 ⟶ 2,158:
}
incr y $dy
}</langsyntaxhighlight>
 
=={{header|True BASIC}}==
<syntaxhighlight lang="qbasic">LET w = 640
LET h = 480
SET WINDOW 0, w, 0, h
 
LET h = h/4
LET y2 = h-1
 
FOR i = 1 to 4
LET col = 0
LET y = (i-1)*h
FOR x = 1 to w step i
IF remainder(col,15) = 0 then LET col = 0
SET COLOR col
BOX AREA x, x+i, y, y+h
LET col = col+1
NEXT x
NEXT i
END</syntaxhighlight>
 
=={{header|Uxntal}}==
<syntaxhighlight lang="uxntal">( uxnasm color-pinstripe.tal color-pinstripe.rom && uxnemu color-pinstripe.rom )
 
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
 
|0100
( set theme )
#0f00 .System/r DEO2
#00f0 .System/g DEO2
#000f .System/b DEO2
 
( store screen width )
.Screen/width DEI2 ,draw-layer/width STR2
( store a quarter of the screen height )
.Screen/height DEI2 #02 SFT2 ,&quarter-height STR2
 
( draw the four stripe layers )
#00
&loop ( -- )
( update y coordinate )
#00 OVR [ LIT2 &quarter-height $2 ] MUL2 .Screen/y DEO2
( draw a layer )
INCk draw-layer
( do it four times )
INC DUP #04 LTH ?&loop
POP BRK
 
@draw-layer ( step -: )
( extend step to short, create counter )
#00 SWP #0000
&loop ( -- )
( update x coordinate )
MUL2k .Screen/x DEO2
( fill a region )
DUP #03 AND #80 ORA .Screen/pixel DEO
( loop until the end of the screen )
INC2 MUL2k [ LIT2 &width $2 ] LTH2 ?&loop
POP2 POP2 JMP2r</syntaxhighlight>
[[File:Colour pinstripe-Display in Uxntal.png|thumb|none|alt=Uxntal implementation of Colour pinstripe/display in an emulator.|Running in an emulator.]]
 
=={{header|Visual Basic .NET}}==
<langsyntaxhighlight lang="vbnet">Public Class Main
Inherits System.Windows.Forms.Form
Public Sub New()
Line 1,743 ⟶ 2,240:
Next
End Sub
End Class</langsyntaxhighlight>
 
=={{header|Wren}}==
{{trans|Go}}
{{libheader|DOME}}
<langsyntaxhighlight ecmascriptlang="wren">import "graphics" for Canvas, Color
import "dome" for Window
 
Line 1,789 ⟶ 2,286:
 
static draw(dt) {}
}</langsyntaxhighlight>
 
=={{header|XPL0}}==
[[File:PinsXPL0.gif|right]]
<langsyntaxhighlight XPL0lang="xpl0">code ChIn=7, Point=41, SetVid=45;
int X, Y, W, C;
[SetVid($13); \set 320x200 graphics mode in 256 colors
Line 1,806 ⟶ 2,303:
X:= ChIn(1); \wait for keystroke
SetVid(3); \restore normal text mode display
]</langsyntaxhighlight>
 
=={{header|Yabasic}}==
{{trans|SmileBASIC}}
<langsyntaxhighlight Yabasiclang="yabasic">w = 640 : h = 480
open window w, h
h4 = h/4
Line 1,835 ⟶ 2,332:
DATA 255,255,0
DATA 255,255,255
</syntaxhighlight>
</lang>
 
{{omit from|AWK}}
57

edits