Colour pinstripe/Display: Difference between revisions
Content deleted Content added
→{{header|Lua}}: added Lua solution |
Thundergnat (talk | contribs) m syntax highlighting fixup automation |
||
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."
<
define looptemp $01
Line 113:
bcc loop_4wide
brk ;program end</
=={{header|Action!}}==
<
BYTE
i,
Line 164:
DO UNTIL CH#$FF OD
CH=$FF
RETURN</
{{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">
package {
Line 225:
}
</syntaxhighlight>
=={{header|Ada}}==
{{libheader|SDLAda}}
<
with SDL.Video.Renderers.Makers;
with SDL.Video.Palettes;
Line 302:
Window.Finalize;
SDL.Finalise;
end Colour_Pinstripe_Display;</
=={{header|ARM Assembly}}==
Line 310:
This uses the Game Boy Advance's bitmap screen modes; no pre-defined tilemaps are needed.
<
b ProgramStart ;branch around the cartridge header
Line 399:
.word 0b0111111111100000 ;cyan
.word 0b0000001111111111 ;yellow
.word 0x7FFF ;white</
{{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.
<
w := A_ScreenWidth
pToken := gdip_Startup()
Line 452:
Exit:
Gdip_Shutdown(pToken)
ExitApp</
=={{header|BASIC256}}==
{{trans|Yabasic}}
<
graphsize w, h
Line 471:
col += 1
next x
next i</
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<
SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
VDU 26
Line 499:
NEXT
NEXT P%
</syntaxhighlight>
=={{header|Befunge}}==
Line 507:
The dimensions of the image are specified by the first two values on the stack: 1366 (<tt>"%":*3-</tt>) by 768 (<tt>"`"8*</tt>).
<
5+:,1vv\%2:%8/-g025:\-1_$$55+,\:v1+*8g01g00_@>
024,.<>2/:2%\2/...1+\:>^<:\0:\-1_$20g1-:20p^1p</
=={{header|C}}==
Line 515:
The following code uses the BGI graphics library of Borland's Turbo C.
<syntaxhighlight lang="c">
#include<graphics.h>
#include<conio.h>
Line 544:
return 0;
}
</syntaxhighlight>
=={{header|C++}}==
[[File:clr_pinstripe_cpp.png|300px]]
<
#include <windows.h>
Line 669:
}
//--------------------------------------------------------------------------------------------------
</syntaxhighlight>
=={{header|Common Lisp}}==
Line 675:
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.
<
;;; We only need a bitmap pane - nothing fancy
Line 709:
(draw-line win
(make-position xpos top)
(make-position xpos bottom)))))))</
=={{header|Factor}}==
<
math.ranges opengl sequences ui ui.gadgets ui.render ;
Line 749:
bands [1,b] [ draw-pinstripe ] with each ;
<pinstripe> "Color pinstripe" open-window</
=={{header|FreeBASIC}}==
<
' compile with: fbc -s console
' or compile with: fbc -s gui
Line 777:
'Print : Print "hit any key to end program"
Sleep
End</
=={{header|Gambas}}==
<
Public Sub Form_Open()
Line 807:
End
</syntaxhighlight>
'''[http://www.cogier.com/gambas/colour_pinstripe.png Click to see output image]'''
Line 813:
{{libheader|Go Graphics}}
{{trans|Java}}
<
import "github.com/fogleman/gg"
Line 845:
pinstripe(dc)
dc.SavePNG("color_pinstripe.png")
}</
{{out}}
Line 855:
This is a modified version of the [[Pinstripe/Display]] solution. A shrunken screenshot is included.
<
procedure main() # pinstripe
Line 884:
}
WDone()
end</
[[File:Pinstripe_Colour_unicon.jpeg]]
Line 894:
=={{header|J}}==
<
size=. 2{.".wd'qm' NB. J6
size=. getscreenwh_jgtk_ '' NB. J7
'rgb'viewmat (4<.@%~{:size)# ({.size) $&> 1 2 3 4#&.> <256#.255*#:i.8</
=={{header|Java}}==
{{works with|Java|8}}
<
import static java.awt.Color.*;
import javax.swing.*;
Line 938:
});
}
}</
=={{header|Julia}}==
<
function drawline(ctx, p1, p2, color, width)
Line 982:
signal_connect(endit, win, :destroy)
wait(cond)
</syntaxhighlight>
=={{header|Kotlin}}==
{{trans|Java}}
<
import java.awt.*
Line 1,027:
f.isVisible = true
}
}</
=={{header|Lua}}==
{{libheader|nw}}
{{libheader|cairo}}
<
local app = nw:app()
local cw, ch = 320, 240
Line 1,052:
end
win:show()
app:run()</
=={{header|M2000 Interpreter}}==
Line 1,064:
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">
Module Checkit {
Window 16, 14000,12000;
Line 1,114:
Checkit
</syntaxhighlight>
=={{header|Maple}}==
<syntaxhighlight lang="maple">
colors := [yellow, black, red, green, magenta, cyan, white]:
plots:-display( [
Line 1,123:
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>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
White}[[Mod[y, 8] + 1]];
Graphics[Join[{Thickness[1/408]},
Line 1,136:
Range[136]], {Thickness[1/102]},
Flatten[{color[#], Line[{{4 # - 2, 102}, {4 # - 2, 1}}]} & /@
Range[102]]], ImageSize -> {408, 408}]</
{{out}}
See [https://www.dropbox.com/s/tg4zk4jkddkok8w/Mathematica_Pinstripes_Colored.png?dl=0 here].
Line 1,142:
=={{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:
<
.include "\SrcAll\BasicMacros.asm"
.include "\SrcALL\AdvancedMacros.asm"
Line 1,351:
;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"</
{{out}}
Line 1,358:
=={{header|Nim}}==
{{libheader|gintro}}
<
const
Line 1,420:
let app = newApplication(Application, "Rosetta.ColorPinstripe")
discard app.connect("activate", activate)
discard app.run()</
=={{header|OCaml}}==
<
let () =
Line 1,440:
done
done;
ignore(read_key())</
run with:
Line 1,446:
=={{header|Perl}}==
<
use strict ;
use GD ;
Line 1,481:
binmode DISPLAY ;
print DISPLAY $image->png ;
close DISPLAY ;</
=={{header|Phix}}==
{{libheader|Phix/pGUI}}
<!--<
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Colour_pinstripe.exw
Line 1,574:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</
Simply change constant colours to {CD_BLACK, CD_WHITE} for the monochrome tasks (as redirected here).
Line 1,584:
=={{header|PicoLisp}}==
<
((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,601:
(prinl (length (car Ppm)) " " (length Ppm))
(prinl 255)
(for Y Ppm (for X Y (apply wr X))) ) )</
=={{header|Plain English}}==
<
Start up.
Clear the screen.
Line 1,643:
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.</
=={{header|PureBasic}}==
<
Procedure PinstripeDisplay(width, height, Array psColors(1), numColors = 0)
Protected x, imgID, psHeight = height / 4, psWidth = 1, psTop, horzBand, curColor
Line 1,688:
While WaitWindowEvent() <> #PB_Event_CloseWindow
Wend
EndIf</
=={{header|Python}}==
<syntaxhighlight lang="python">
from turtle import *
Line 1,726:
notused = input("Hit enter to continue: ")
</syntaxhighlight>
=={{header|QBasic}}==
{{works with|QBasic|1.1}}
{{trans|BASIC256}}
<
w = 640: h = 480
Line 1,745:
col = col + 1
NEXT x
NEXT i</
=={{header|Racket}}==
<syntaxhighlight lang="racket">
#lang racket/gui
Line 1,779:
(void (new full-frame%))
</syntaxhighlight>
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku"
my @colors = map -> $r, $g, $b { [$r, $g, $b] },
Line 1,811:
}
$img.close;</
=={{header|Ring}}==
<
# Project : Colour pinstripe/Display
Line 1,878:
}
label1 { setpicture(p1) show() }
</syntaxhighlight>
See image:
Line 1,886:
=={{header|Scala}}==
===Java Swing Interoperability===
<
import java.awt._
Line 1,924:
)
}</
=={{header|Sidef}}==
{{trans|Perl}}
<
func pinstripes(width = 1280, height = 720) {
Line 1,957:
}
File('pinstripes.png').write(pinstripes().png, :raw)</
=={{header|SmileBASIC}}==
<
COLIDX=0
YTOP=(I-1)*60
Line 1,981:
DATA 0,255,255
DATA 255,255,0
DATA 255,255,255</
=={{header|Tcl}}==
{{libheader|Tk}}
<
package require Tk 8.5
Line 2,001:
}
incr y $dy
}</
=={{header|True BASIC}}==
<
LET h = 480
SET WINDOW 0, w, 0, h
Line 2,021:
NEXT x
NEXT i
END</
=={{header|Visual Basic .NET}}==
<
Inherits System.Windows.Forms.Form
Public Sub New()
Line 2,042:
Next
End Sub
End Class</
=={{header|Wren}}==
{{trans|Go}}
{{libheader|DOME}}
<
import "dome" for Window
Line 2,088:
static draw(dt) {}
}</
=={{header|XPL0}}==
[[File:PinsXPL0.gif|right]]
<
int X, Y, W, C;
[SetVid($13); \set 320x200 graphics mode in 256 colors
Line 2,105:
X:= ChIn(1); \wait for keystroke
SetVid(3); \restore normal text mode display
]</
=={{header|Yabasic}}==
{{trans|SmileBASIC}}
<
open window w, h
h4 = h/4
Line 2,134:
DATA 255,255,0
DATA 255,255,255
</syntaxhighlight>
{{omit from|AWK}}
|