September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
27
Task/Pinstripe-Display/FreeBASIC/pinstripe-display.freebasic
Normal file
27
Task/Pinstripe-Display/FreeBASIC/pinstripe-display.freebasic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
' version 14-03-2017
|
||||
' compile with: fbc -s console
|
||||
' or compile with: fbc -s gui
|
||||
|
||||
Dim As UInteger ps, col, h, w, x, y1, y2
|
||||
ScreenInfo w, h
|
||||
|
||||
' create display size window, 8bit color (palette), no frame
|
||||
ScreenRes w, h, 8,, 8
|
||||
' vga palette black = 0 and white = 15
|
||||
|
||||
h = h \ 4 : y2 = h -1
|
||||
|
||||
For ps = 1 To 4
|
||||
col = 0
|
||||
For x = 0 To (w - ps -1) Step ps
|
||||
Line (x, y1) - (x + ps -1, y2), col, bf
|
||||
col = 15 - col ' col alternate between 0 (black) and 15 (white)
|
||||
Next
|
||||
y1 += h : y2 += h
|
||||
Next
|
||||
|
||||
' empty keyboard buffer
|
||||
While InKey <> "" : Wend
|
||||
'Print : Print "hit any key to end program"
|
||||
Sleep
|
||||
End
|
||||
28
Task/Pinstripe-Display/Gambas/pinstripe-display.gambas
Normal file
28
Task/Pinstripe-Display/Gambas/pinstripe-display.gambas
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'WARNING this takes a time to display
|
||||
'Use the 'gb.qt4' component
|
||||
|
||||
Public Sub Form_Open()
|
||||
Dim iColour As Integer[] = [Color.Black, Color.white]
|
||||
Dim hPanel As Panel
|
||||
Dim siCount, siCounter, siSet As Short
|
||||
|
||||
With Me
|
||||
.Arrangement = Arrange.Row
|
||||
.Border = False
|
||||
.Height = Desktop.Height
|
||||
.Width = Desktop.Width
|
||||
.Fullscreen = True
|
||||
End With
|
||||
|
||||
For siCounter = 1 To 4
|
||||
For siCount = 1 To Desktop.Width Step siCounter
|
||||
hpanel = New Panel(Me)
|
||||
hpanel.Width = siCounter
|
||||
hpanel.Height = Desktop.Height / 4
|
||||
HPanel.Background = iColour[siSet]
|
||||
Inc siSet
|
||||
If siSet > 1 Then siSet = 0
|
||||
Next
|
||||
Next
|
||||
|
||||
End
|
||||
41
Task/Pinstripe-Display/Kotlin/pinstripe-display.kotlin
Normal file
41
Task/Pinstripe-Display/Kotlin/pinstripe-display.kotlin
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// version 1.1.0
|
||||
|
||||
import java.awt.*
|
||||
import javax.swing.*
|
||||
|
||||
class ColourPinstripeDisplay(): JPanel() {
|
||||
private companion object {
|
||||
val palette = arrayOf(Color.white, Color.black)
|
||||
}
|
||||
|
||||
private val bands = 4
|
||||
|
||||
init {
|
||||
preferredSize = Dimension(900, 600)
|
||||
}
|
||||
|
||||
protected override fun paintComponent(g: Graphics) {
|
||||
super.paintComponent(g)
|
||||
for (b in 1..bands) {
|
||||
var colIndex = 0
|
||||
val h = height / bands
|
||||
for (x in 0 until width step b) {
|
||||
g.color = palette[colIndex % palette.size]
|
||||
g.fillRect(x, (b - 1) * h, b, h)
|
||||
colIndex++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
SwingUtilities.invokeLater {
|
||||
val f = JFrame()
|
||||
f.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
|
||||
f.title = "PinstripeDisplay"
|
||||
f.add(ColourPinstripeDisplay(), BorderLayout.CENTER)
|
||||
f.pack()
|
||||
f.setLocationRelativeTo(null)
|
||||
f.setVisible(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -3,20 +3,20 @@ my $VERT = 720;
|
|||
|
||||
my @colors = 0, 1;
|
||||
|
||||
my $PPM = open "pinstripes.pgm", :w, :bin or die "Can't create pinstripes.ppm: $!";
|
||||
|
||||
$PPM.print: qq:to/EOH/;
|
||||
spurt "pinstripes.pgm", qq:to/EOH/;
|
||||
P5
|
||||
# pinstripes.pgm
|
||||
$HOR $VERT
|
||||
1
|
||||
EOH
|
||||
|
||||
my $PGM = open "pinstripes.pgm", :a, :bin or die "Can't append to pinstripes.pgm: $!";
|
||||
|
||||
my $vzones = $VERT div 4;
|
||||
for 1..4 -> $w {
|
||||
my $hzones = ceiling $HOR / $w / +@colors;
|
||||
my $line = Buf.new: (flat((@colors Xxx $w) xx $hzones).Array).splice(0,$HOR);
|
||||
$PPM.write: $line for ^$vzones;
|
||||
$PGM.write: $line for ^$vzones;
|
||||
}
|
||||
|
||||
$PPM.close;
|
||||
$PGM.close;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue