September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,19 +0,0 @@
|
|||
SW_MAXIMIZE = 3
|
||||
SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
|
||||
VDU 26
|
||||
|
||||
W% = @vdu%!208 / 4
|
||||
H% = @vdu%!212 * 2
|
||||
|
||||
COLOUR 1,9
|
||||
COLOUR 2,10
|
||||
COLOUR 3,12
|
||||
COLOUR 4,13
|
||||
COLOUR 5,14
|
||||
COLOUR 6,11
|
||||
COLOUR 7,15
|
||||
|
||||
FOR C% = 0 TO 7
|
||||
GCOL C%
|
||||
RECTANGLE FILL C%*W%, 0, W%, H%
|
||||
NEXT
|
||||
|
|
@ -8,10 +8,8 @@ Locate ,, 0 '' turn cursor off
|
|||
For clr As UInteger = 0 To 15
|
||||
Color 0, clr
|
||||
For row As Integer = 1 to 25
|
||||
For col As UInteger = 1 To 5
|
||||
Locate row, clr * 5 + 1
|
||||
Print Space(5);
|
||||
Next col
|
||||
Locate row, clr * 5 + 1
|
||||
Print Space(5);
|
||||
Next row
|
||||
Next clr
|
||||
|
||||
|
|
|
|||
19
Task/Colour-bars-Display/Gambas/colour-bars-display.gambas
Normal file
19
Task/Colour-bars-Display/Gambas/colour-bars-display.gambas
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
25
Task/Colour-bars-Display/Kotlin/colour-bars-display.kotlin
Normal file
25
Task/Colour-bars-Display/Kotlin/colour-bars-display.kotlin
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import java.awt.Color
|
||||
import java.awt.Graphics
|
||||
import javax.swing.JFrame
|
||||
|
||||
class ColorFrame(width: Int, height: Int): JFrame() {
|
||||
init {
|
||||
defaultCloseOperation = EXIT_ON_CLOSE
|
||||
setSize(width, height)
|
||||
isVisible = true
|
||||
}
|
||||
|
||||
override fun paint(g: Graphics) {
|
||||
val colors = listOf(Color.black, Color.red, Color.green, Color.blue,
|
||||
Color.pink, Color.cyan, Color.yellow, Color.white)
|
||||
val size = colors.size
|
||||
for (i in 0 until size) {
|
||||
g.color = colors[i]
|
||||
g.fillRect(width / size * i, 0, width / size, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
ColorFrame(400, 400)
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
nomainwin
|
||||
colors$="black red green blue pink cyan yellow white"
|
||||
WindowWidth=DisplayWidth:WindowHeight=DisplayHeight
|
||||
UpperLeftX=1:UpperLeftY=1
|
||||
barWidth=DisplayWidth/8
|
||||
graphicbox #main.g, 0,0,DisplayWidth,DisplayHeight
|
||||
open "" for window_popup as #main
|
||||
#main "trapclose [quit]"
|
||||
#main.g "down; setfocus; when characterInput [quit]"
|
||||
#main.g "when leftButtonUp [quit]"
|
||||
#main.g "size ";barWidth
|
||||
|
||||
for x = barWidth/2 to DisplayWidth step barWidth
|
||||
i=i+1
|
||||
if i>8 then i=1
|
||||
col$=word$(colors$,i)
|
||||
#main.g "color ";col$;"; line ";x;" 0 ";x;" ";DisplayHeight
|
||||
next
|
||||
wait
|
||||
[quit] close #main:end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
10 MODE 0:BORDER 23
|
||||
20 FOR x=0 TO 15
|
||||
30 ORIGIN x*40,0
|
||||
40 GRAPHICS PEN x
|
||||
50 FOR z=0 TO 39 STEP 4:MOVE z,0:DRAW z,400:NEXT
|
||||
60 NEXT
|
||||
70 CALL &bb06 ' wait for key press
|
||||
2
Task/Colour-bars-Display/Maple/colour-bars-display.maple
Normal file
2
Task/Colour-bars-Display/Maple/colour-bars-display.maple
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
with(plottools):
|
||||
plots:-display([rectangle([0, 0], [.3, 2.1], color = black), rectangle([.3, 0], [.6, 2.1], color = red), rectangle([.6, 0], [.9, 2.1], color = green), rectangle([.9, 0], [1.2, 2.1], color = magenta), rectangle([1.2, 0], [1.5, 2.1], color = cyan), rectangle([1.5, 0], [1.8, 2.1], color = white), rectangle([1.8, 0], [2.1, 2.1], color = yellow)])
|
||||
|
|
@ -11,7 +11,7 @@ my @colors = map -> $r, $g, $b { Buf.new: |(($r, $g, $b) xx $HOR div 8) },
|
|||
255,255, 0,
|
||||
255,255,255;
|
||||
|
||||
my $PPM = open "colorbars.ppm", :w, :bin or die "Can't create colorbars.ppm: $!";
|
||||
my $PPM = open "colorbars.ppm", :w or die "Can't create colorbars.ppm: $!";
|
||||
|
||||
$PPM.print: qq:to/EOH/;
|
||||
P6
|
||||
|
|
|
|||
66
Task/Colour-bars-Display/Phix/colour-bars-display.phix
Normal file
66
Task/Colour-bars-Display/Phix/colour-bars-display.phix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
--
|
||||
-- demo\rosetta\Colour_bars.exw
|
||||
--
|
||||
include pGUI.e
|
||||
|
||||
constant colours = {CD_BLACK, CD_RED, CD_GREEN, CD_MAGENTA, CD_CYAN, CD_YELLOW, CD_WHITE}
|
||||
|
||||
Ihandle dlg, canvas
|
||||
cdCanvas cddbuffer, cdcanvas
|
||||
|
||||
function redraw_cb(Ihandle /*ih*/, integer /*posx*/, integer /*posy*/)
|
||||
cdCanvasActivate(cddbuffer)
|
||||
integer {width, height} = IupGetIntInt(canvas, "DRAWSIZE")
|
||||
integer x = 0, lc = length(colours)
|
||||
for i=1 to lc do
|
||||
integer w = floor((width-x)/(lc-i+1))
|
||||
cdCanvasSetForeground(cddbuffer, colours[i])
|
||||
cdCanvasBox(cddbuffer, x, x+w, 0, height)
|
||||
x += w
|
||||
end for
|
||||
cdCanvasFlush(cddbuffer)
|
||||
return IUP_DEFAULT
|
||||
end function
|
||||
|
||||
function map_cb(Ihandle ih)
|
||||
cdcanvas = cdCreateCanvas(CD_IUP, ih)
|
||||
cddbuffer = cdCreateCanvas(CD_DBUFFER, cdcanvas)
|
||||
return IUP_DEFAULT
|
||||
end function
|
||||
|
||||
function unmap_cb(Ihandle /*ih*/)
|
||||
cdKillCanvas(cddbuffer)
|
||||
cdKillCanvas(cdcanvas)
|
||||
return IUP_DEFAULT
|
||||
end function
|
||||
|
||||
function esc_close(Ihandle /*ih*/, atom c)
|
||||
if c=K_ESC then return IUP_CLOSE end if
|
||||
return IUP_CONTINUE
|
||||
end function
|
||||
|
||||
procedure main()
|
||||
IupOpen()
|
||||
|
||||
canvas = IupCanvas(NULL)
|
||||
IupSetAttribute(canvas, "RASTERSIZE", "600x400") -- initial size
|
||||
|
||||
IupSetCallback(canvas, "MAP_CB", Icallback("map_cb"))
|
||||
IupSetCallback(canvas, "UNMAP_CB", Icallback("unmap_cb"))
|
||||
|
||||
dlg = IupDialog(canvas)
|
||||
IupSetAttribute(dlg, "TITLE", "Colour bars")
|
||||
IupSetCallback(canvas, "ACTION", Icallback("redraw_cb"))
|
||||
IupSetCallback(dlg, "K_ANY", Icallback("esc_close"))
|
||||
|
||||
IupMap(dlg)
|
||||
IupSetAttribute(canvas, "RASTERSIZE", NULL) -- release the minimum limitation
|
||||
|
||||
IupShowXY(dlg,IUP_CENTER,IUP_CENTER)
|
||||
|
||||
IupMainLoop()
|
||||
|
||||
IupClose()
|
||||
end procedure
|
||||
|
||||
main()
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
Dim color(7)
|
||||
color(0) = RGB($00, $00, $00) ;black
|
||||
color(1) = RGB($FF, $00, $00) ;red
|
||||
color(2) = RGB($00, $FF, $00) ;green
|
||||
color(3) = RGB($00, $00, $FF) ;blue
|
||||
color(4) = RGB($FF, $00, $FF) ;magenta
|
||||
color(5) = RGB($00, $FF, $FF) ;cyan
|
||||
color(6) = RGB($FF, $FF, $00) ;yellow
|
||||
color(7) = RGB($FF, $FF, $FF) ;white
|
||||
|
||||
If Not InitKeyboard(): End: EndIf ;can't init keyboard
|
||||
If Not InitSprite(): End: EndIf ;can't init sprite/screen library
|
||||
If Not ExamineDesktops(): End: EndIf ;can't retrieve information about desktop
|
||||
|
||||
height = DesktopHeight(0)
|
||||
width = DesktopWidth(0)
|
||||
depth = DesktopDepth(0)
|
||||
If OpenScreen(width, height, depth, "Press ENTER to exit")
|
||||
StartDrawing(ScreenOutput())
|
||||
For c = 0 To 7
|
||||
Box((width * c) / 8, 0, width / 8, height, color(c))
|
||||
Next
|
||||
StopDrawing()
|
||||
FlipBuffers()
|
||||
|
||||
Repeat
|
||||
Delay(10)
|
||||
ExamineKeyboard()
|
||||
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Return)
|
||||
CloseScreen()
|
||||
EndIf
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
DataSection
|
||||
;Black, Red, Green, Blue, Magenta, Cyan, Yellow, White
|
||||
Data.i 0, 12, 10, 9, 13, 11, 14, 15
|
||||
EndDataSection
|
||||
|
||||
Dim colors(7)
|
||||
For c = 0 To 7
|
||||
Read.i colors(c)
|
||||
Next
|
||||
|
||||
If OpenConsole()
|
||||
;The console display is 80 columns wide by 25 rows
|
||||
For r = 0 To 24
|
||||
For c = 0 To 7
|
||||
ConsoleColor(colors(c), colors(c))
|
||||
Print(Space(80 / 8))
|
||||
Next
|
||||
Next
|
||||
EnableGraphicalConsole(1)
|
||||
ConsoleLocate(0, 0)
|
||||
|
||||
ConsoleTitle("Press ENTER to exit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
colors$ = "black,red,green,blue,magenta,cyan,yellow,white"
|
||||
html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=4><tr height=70>"
|
||||
for i = 1 to 8
|
||||
html "<td width=20 bgcolor='";word$(colors$,i,",");"'</td>"
|
||||
next i
|
||||
html "</tr></table>"
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
include c:\cxpl\codes; \intrinsic code declarations
|
||||
int W, X0, X1, Y, C;
|
||||
[SetVid($13); \320x200x8 graphics
|
||||
W:= 320/8; \width of color bar (pixels)
|
||||
for C:= 0 to 8-1 do
|
||||
[X0:= W*C; X1:= X0+W-1;
|
||||
for Y:= 0 to 200-1 do
|
||||
[Move(X0, Y); Line(X1, Y, C)];
|
||||
];
|
||||
C:= ChIn(1); \wait for keystroke
|
||||
SetVid(3); \restore normal text mode
|
||||
]
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
10 REM The ZX Spectrum display is 32 columns wide, so we have 8 columns of 4 spaces
|
||||
20 FOR r=0 TO 20: REM There are 21 rows
|
||||
30 FOR c=0 TO 7: REM We use the native colour sequence here
|
||||
40 PAPER c: REM set the background colour for the spaces to be printed
|
||||
50 PRINT " ";: REM four spaces, the semicolon prevents newline
|
||||
60 NEXT c
|
||||
70 REM at this point the cursor has wrapped, so we don't need a newline
|
||||
80 NEXT r
|
||||
Loading…
Add table
Add a link
Reference in a new issue