Colour bars/Display: Difference between revisions
→{{header|AmigaBASIC}}: add screenshot
(→{{header|AmigaBASIC}}: add screenshot) |
|||
(24 intermediate revisions by 9 users not shown) | |||
Line 316:
=={{header|BASIC}}==
==={{header|AmigaBASIC}}===
[[File:Amigabasic color bars.png|thumb|Output]]
<syntaxhighlight lang="amigabasic">SCREEN 1,320,200,5,1
WINDOW 2,"Color bars",(0,10)-(297,186),15,1
Line 357 ⟶ 356:
</syntaxhighlight>
==={{header|
The sequence of colors.
<syntaxhighlight lang="basic">
100 rem Colour bars/Display
110 graphics 0 : graphics cls
120 for i = 0 to 7
130 read r,g,b
140 graphics color r,g,b
150 for j = 0 to 79
160 x = i*80+j
170 graphics moveto x,0
180 graphics lineto x,399
190 next j
200 next i
500 data 0,0,0 : rem black
510 data 100,0,0 : rem red
520 data 0,100,0 : rem green
530 data 0,0,100 : rem blue
540 data 100,0,100 : rem magenta
550 data 0,100,100 : rem cyan
560 data 100,100,0 : rem yellow
570 data 100,100,100 : rem white
</syntaxhighlight>
==={{header|Commodore BASIC}}===
This task achieved only on Commodore computers with color capabilities. The example below tested as-is in VICE on the following machines:
* Commodore 64
Line 365 ⟶ 387:
* Commodore CBM-II (with VIC-II video)
* Commodore SX-64
It will also work well on the VIC-20 if you either omit line 310 or comment (REM) it out as the VIC-20 has only an eight-color palette.
Line 392 ⟶ 413:
310 data 129,149,150,151,152,153,154,155
320 data 0:rem data terminato</syntaxhighlight>
==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
' Draw the color bars on an 80 x 25 console using the system palette of 16 colors
' i.e. 5 columns per color
Width 80, 25
Shell "cls"
Locate ,, 0 '' turn cursor off
For clr As UInteger = 0 To 15
Color 0, clr
For row As Integer = 1 to 25
Locate row, clr * 5 + 1
Print Space(5);
Next row
Next clr
Sleep
' restore default settings
Locate ,, 1 '' turn cursor on
Color 7, 0 '' white text on black background</syntaxhighlight>
==={{header|FutureBasic}}===
[[File:ColorBarsDisplayFB300.png|right]]
<syntaxhighlight lang="futurebasic">
void local fn DoIt
long index, x = 0
CFArrayRef colors = @[fn ColorBlack,fn ColorRed,
fn ColorGreen,fn ColorBlue,fn ColorMagenta,
fn ColorCyan,fn ColorYellow,fn ColorWhite]
window 1, @"Color bars/Display", (0,0,480,270), NSWindowStyleMaskTitled
pen -1
for index = 0 to len(colors) - 1
rect fill (x,0,60,270), colors[index]
x += 60
next
end fn
fn DoIt
HandleEvents
</syntaxhighlight>
==={{header|Gambas}}===
<syntaxhighlight lang="gambas">Public Sub Form_Open()
Dim iColour As Integer[] = [Color.Black, Color.red, Color.Green, Color.Magenta, Color.Cyan, Color.Yellow, Color.white]
Dim hPanel As Panel
Dim siCount As Short
With Me
.Arrangement = Arrange.Horizontal
.Height = 300
.Width = 400
End With
For siCount = 0 To 6
hpanel = New Panel(Me)
hpanel.Expand = True
hpanel.H = 500
HPanel.Background = iColour[siCount]
Next
End</syntaxhighlight>
==={{header|IS-BASIC}}===
<syntaxhighlight lang="is-basic">100 GRAPHICS LORES 16
110 SET PALETTE BLACK,RED,GREEN,BLUE,MAGENTA,CYAN,YELLOW,WHITE
120 FOR I=1 TO 7
130 CALL BAR(I)
140 NEXT
150 DEF BAR(C)
160 SET INK C
170 PLOT C*160,0;C*160,719;C*160+152,719;C*160+152,0;C*160,0
180 PLOT C*160+16,16,PAINT
190 END DEF</syntaxhighlight>
==={{header|Liberty BASIC}}===
Line 417 ⟶ 515:
==={{header|Locomotive Basic}}===
[[File:CPC color bars.png|thumb|right]]
Show the default MODE 0 palette (includes two blinking colors at the end):
<syntaxhighlight lang="locobasic">10 MODE 0:BORDER 23
20 FOR x=0 TO 15
Line 498 ⟶ 593:
[[File:ColorBarRunBasic.png]]
==={{header|SmileBASIC}}===
<syntaxhighlight lang="smilebasic">FOR I=0 TO 7
READ R,G,B
GFILL I*50,0,I*50+49,239,RGB(R,G,B)
NEXT
REPEAT UNTIL BUTTON(0) AND #B
DATA 0,0,0
DATA 255,0,0
DATA 0,255,0
DATA 0,0,255
DATA 255,0,255
DATA 0,255,255
DATA 255,255,0
DATA 255,255,255</syntaxhighlight>
==={{header|TI Basic}}===
Line 833 ⟶ 944:
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=TYyxCoAwDET3fsWNKqjpmMEvKZ1KhUK1UER/34uTQ7i7l0tSqyFiQ4CIQDmiHFF6pacyKzW6hz3PxoqaTyS7dHvrKMZxtR8GzHBnsXz5aHfGgwlDwQw/Qoz2nC5SvnWLewE= Run it]
<syntaxhighlight lang="text">
col[] = [ 000 900 090 009 909 099 990 999 ]
for i
rect w 100
.
</syntaxhighlight>
=={{header|Factor}}==
Line 938 ⟶ 1,051:
CR .( Done. Type BARS to run)
</syntaxhighlight>
=={{header|Go}}==
Line 1,067 ⟶ 1,114:
where attrs = map color2attr colors
nBars = length colors
colors = [black, brightRed, brightGreen, brightBlue, brightMagenta, brightCyan, brightYellow, brightWhite]
color2attr c = Attr Default Default (SetTo c)
main :: IO ()
main = do
cfg <- standardIOConfig
Line 1,085 ⟶ 1,133:
showBars bounds
shutdown vty</syntaxhighlight>
[[File:Haskell_Colourbars_A_0.png|700px]]
Graphical version using SFML.
Line 1,452 ⟶ 1,502:
=={{header|Perl}}==
<syntaxhighlight lang="perl">
use
use GD
my %colors = (
white => [255,255,255], red
magenta => [255, 0,255],
my $
my $
my $
for my $rgb ( values %colors ) {
$image->filledRectangle( $start * $barwidth , 0 , $start * $barwidth +
$barwidth - 1 , 99 , $
$start++ ;
}
open ( DISPLAY , ">" , "
binmode DISPLAY
print DISPLAY $image->png
close DISPLAY
=={{header|Phix}}==
Line 1,964 ⟶ 2,014:
%f'colorbars.png'.open('>:raw').print(image.png);</syntaxhighlight>
=={{header|Tcl}}==
Line 2,022 ⟶ 2,056:
tput sgr0 # reset</syntaxhighlight>
=={{header|Uxntal}}==
<syntaxhighlight lang="uxntal">( uxnasm color-bars.tal color-bars.rom && uxnemu color-bars.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 4 color theme
rgb
color0: 000 - black
color1: f00 - red
color2: 0f0 - green
color3: 00f - blue )
#0f00 .System/r DEO2
#00f0 .System/g DEO2
#000f .System/b DEO2
( store bars width )
.Screen/width DEI2 #0004 DIV2 ,&quarter STR2
( set starting position )
#0000 .Screen/y DEO2
( draw bars )
#00
&loop
#00 OVR [ LIT2 &quarter $2 ] MUL2
.Screen/x DEO2
DUP #80 ORA .Screen/pixel DEO
INC DUP #04 NEQ ?&loop
BRK</syntaxhighlight>
[[File:Color-bars.png|alt=Color bars task implemented in Uxntal.|thumb|Color bars task implemented in Uxntal.|none]]
=={{header|Wren}}==
{{trans|Go}}
{{libheader|DOME}}
<syntaxhighlight lang="
import "dome" for Window
Line 2,077 ⟶ 2,142:
{{omit from|Axe}}
{{omit from|GUISS}}
{{omit from|Minimal BASIC}}
[[Category:Test card]]
|