Colour bars/Display: Difference between revisions
Content added Content deleted
(Dialects of BASIC moved to the BASIC section.) |
|||
Line 316: | Line 316: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
==={{header|AmigaBASIC}}=== |
==={{header|AmigaBASIC}}=== |
||
<syntaxhighlight lang="amigabasic">SCREEN 1,320,200,5,1 |
<syntaxhighlight lang="amigabasic">SCREEN 1,320,200,5,1 |
||
WINDOW 2,"Color bars",(0,10)-(297,186),15,1 |
WINDOW 2,"Color bars",(0,10)-(297,186),15,1 |
||
Line 358: | Line 356: | ||
==={{header|Commodore BASIC}}=== |
==={{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: |
This task achieved only on Commodore computers with color capabilities. The example below tested as-is in VICE on the following machines: |
||
* Commodore 64 |
* Commodore 64 |
||
Line 365: | Line 362: | ||
* Commodore CBM-II (with VIC-II video) |
* Commodore CBM-II (with VIC-II video) |
||
* Commodore SX-64 |
* 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. |
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: | Line 388: | ||
310 data 129,149,150,151,152,153,154,155 |
310 data 129,149,150,151,152,153,154,155 |
||
320 data 0:rem data terminato</syntaxhighlight> |
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|Liberty BASIC}}=== |
==={{header|Liberty BASIC}}=== |
||
Line 417: | Line 478: | ||
==={{header|Locomotive Basic}}=== |
==={{header|Locomotive Basic}}=== |
||
[[File:CPC color bars.png|thumb|right]] |
[[File:CPC color bars.png|thumb|right]] |
||
Show the default MODE 0 palette (includes two blinking colors at the end): |
Show the default MODE 0 palette (includes two blinking colors at the end): |
||
<syntaxhighlight lang="locobasic">10 MODE 0:BORDER 23 |
<syntaxhighlight lang="locobasic">10 MODE 0:BORDER 23 |
||
20 FOR x=0 TO 15 |
20 FOR x=0 TO 15 |
||
Line 498: | Line 556: | ||
[[File:ColorBarRunBasic.png]] |
[[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}}=== |
==={{header|TI Basic}}=== |
||
Line 938: | Line 1,012: | ||
CR .( Done. Type BARS to run) |
CR .( Done. Type BARS to run) |
||
</syntaxhighlight> |
</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|Go}}== |
=={{header|Go}}== |
||
Line 1,963: | Line 1,972: | ||
%f'colorbars.png'.open('>:raw').print(image.png);</syntaxhighlight> |
%f'colorbars.png'.open('>:raw').print(image.png);</syntaxhighlight> |
||
=={{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|Tcl}}== |
=={{header|Tcl}}== |
||
Line 2,076: | Line 2,069: | ||
{{omit from|Axe}} |
{{omit from|Axe}} |
||
{{omit from|GUISS}} |
{{omit from|GUISS}} |
||
{{omit from|Minimal BASIC}} |
|||
[[Category:Test card]] |
[[Category:Test card]] |