tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
6
Task/Pinstripe-Display/0DESCRIPTION
Normal file
6
Task/Pinstripe-Display/0DESCRIPTION
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[[File:Pinstripe-mono-unicon.gif|thumb|right|Sample image]]
|
||||
The task is to demonstrate the creation of a series of 1 pixel wide vertical pinstripes across the entire width of the display. The pinstripes should alternate one pixel white, one pixel black.
|
||||
|
||||
Quarter of the way down the display, we can switch to a wider 2 pixel wide vertical pinstripe pattern, alternating two pixels white, two pixels black. Half way down the display, we switch to 3 pixels wide, and for the lower quarter of the display we use 4 pixels.
|
||||
|
||||
c.f. [[Colour_pinstripe/Display]]
|
||||
2
Task/Pinstripe-Display/1META.yaml
Normal file
2
Task/Pinstripe-Display/1META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
note: Test card
|
||||
40
Task/Pinstripe-Display/AutoHotkey/pinstripe-display.ahk
Normal file
40
Task/Pinstripe-Display/AutoHotkey/pinstripe-display.ahk
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
h := A_ScreenHeight
|
||||
w := A_ScreenWidth
|
||||
pToken := Gdip_Startup()
|
||||
hdc := CreateCompatibleDC()
|
||||
hbm := CreateDIBSection(w, h)
|
||||
obm := SelectObject(hdc, hbm)
|
||||
G := Gdip_GraphicsFromHDC(hdc)
|
||||
|
||||
OnExit, Exit
|
||||
|
||||
Gui -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
|
||||
Gui Show, NA
|
||||
hwnd := WinExist()
|
||||
|
||||
pBrushB := Gdip_BrushCreateSolid(0xFF000000)
|
||||
pBrushW := Gdip_BrushCreateSolid(0xFFFFFFFF)
|
||||
Loop 4
|
||||
{
|
||||
n := A_Index
|
||||
Loop % w
|
||||
BorW := A_Index & 1 ? "B" : "W"
|
||||
,Gdip_FillRectangle(G, pBrush%BorW%
|
||||
, A_Index*n-n, (n-1)*h/4, n, h/4)
|
||||
}
|
||||
|
||||
UpdateLayeredWindow(hwnd, hdc, 0, 0, W, H)
|
||||
|
||||
Gdip_DeleteBrush(pBrushB)
|
||||
Gdip_DeleteBrush(pBrushW)
|
||||
|
||||
SelectObject(hdc, obm)
|
||||
DeleteObject(hbm)
|
||||
DeleteDC(hdc)
|
||||
Gdip_DeleteGraphics(G)
|
||||
Return
|
||||
|
||||
Escape::
|
||||
Exit:
|
||||
Gdip_Shutdown(pToken)
|
||||
ExitApp
|
||||
25
Task/Pinstripe-Display/BBC-BASIC/pinstripe-display.bbc
Normal file
25
Task/Pinstripe-Display/BBC-BASIC/pinstripe-display.bbc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
GWL_STYLE = -16
|
||||
HWND_TOPMOST = -1
|
||||
WS_VISIBLE = &10000000
|
||||
WS_CLIPCHILDREN = &2000000
|
||||
WS_CLIPSIBLINGS = &4000000
|
||||
|
||||
SYS "GetSystemMetrics", 0 TO xscreen%
|
||||
SYS "GetSystemMetrics", 1 TO yscreen%
|
||||
SYS "SetWindowLong", @hwnd%, GWL_STYLE, WS_VISIBLE + \
|
||||
\ WS_CLIPCHILDREN + WS_CLIPSIBLINGS
|
||||
SYS "SetWindowPos", @hwnd%, HWND_TOPMOST, 0, 0, xscreen%, yscreen%, 0
|
||||
VDU 26
|
||||
|
||||
FOR X% = 0 TO xscreen%*4-4 STEP 4
|
||||
RECTANGLE FILL X%,yscreen%*3/2,2,yscreen%/2
|
||||
NEXT
|
||||
FOR X% = 0 TO xscreen%*4-8 STEP 8
|
||||
RECTANGLE FILL X%,yscreen%*2/2,4,yscreen%/2
|
||||
NEXT
|
||||
FOR X% = 0 TO xscreen%*4-12 STEP 12
|
||||
RECTANGLE FILL X%,yscreen%*1/2,6,yscreen%/2
|
||||
NEXT
|
||||
FOR X% = 0 TO xscreen%*4-16 STEP 16
|
||||
RECTANGLE FILL X%,yscreen%*0/2,8,yscreen%/2
|
||||
NEXT
|
||||
23
Task/Pinstripe-Display/Icon/pinstripe-display.icon
Normal file
23
Task/Pinstripe-Display/Icon/pinstripe-display.icon
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
link graphics
|
||||
|
||||
procedure main() # pinstripe
|
||||
|
||||
WOpen("canvas=hidden") # hide for query
|
||||
height := WAttrib("displayheight") - 45 # adjust for ...
|
||||
width := WAttrib("displaywidth") - 20 # ... window 7 borders
|
||||
WClose(&window)
|
||||
|
||||
W := WOpen("size="||width||","||height,"bg=black","fg=white") |
|
||||
stop("Unable to open window")
|
||||
|
||||
maxbands := 4 # bands to draw
|
||||
bandheight := height / maxbands # height of each band
|
||||
every bands := 1 to maxbands do { # for each band
|
||||
top := 1 + bandheight * (bands-1) # .. top of band
|
||||
step := 2^bands # .. number of steps (width)
|
||||
lines := step / 2 # .. number (width) of stripes
|
||||
every c := 1 to width by step & l := 0 to lines-1 do
|
||||
DrawLine(c+l,top,c+l,top+bandheight-1)
|
||||
}
|
||||
WDone(W) # q to exit
|
||||
end
|
||||
4
Task/Pinstripe-Display/J/pinstripe-display.j
Normal file
4
Task/Pinstripe-Display/J/pinstripe-display.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
load'viewmat'
|
||||
size=.2{.".wd'qm' NB. J6
|
||||
size=. getscreenwh_jgtk_ '' NB. J7
|
||||
'rgb'viewmat- (4<.@%~{:size)# ({.size) $&> 1 2 3 4#&.> <0 1
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
10 MODE 2 ' finest resolution
|
||||
20 sh=400 ' screen height
|
||||
30 sw=640 ' screen width
|
||||
40 INK 0,26 ' white ink for background pen (0)
|
||||
50 INK 1,0 ' black ink for foreground pen (1)
|
||||
60 FOR sn=1 TO 4 ' four sections
|
||||
70 bh=INT (sh/4) ' bar height
|
||||
80 bb=(4-sn)*bh ' bar baseline
|
||||
90 dw=0 ' currently drawn bar width
|
||||
100 dc=0 ' current drawing colour
|
||||
110 FOR l=0 TO sw -1 ' pan width for each section
|
||||
120 PLOT l,bb,dc
|
||||
130 DRAWR 0,bh-1,dc ' subtract 1 pixel (already plotted)
|
||||
140 dw=dw+1
|
||||
150 ' section number corresponds to maximum bar width
|
||||
160 ' change bar colour, if maximum bar width exceeded
|
||||
170 IF dw>sn THEN dw=0:dc=dc+1 ' next colour
|
||||
180 IF dc>1 THEN dc=0
|
||||
190 NEXT l
|
||||
200 NEXT sn
|
||||
14
Task/Pinstripe-Display/PicoLisp/pinstripe-display.l
Normal file
14
Task/Pinstripe-Display/PicoLisp/pinstripe-display.l
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(let Pbm # Create PBM of 384 x 288 pixels
|
||||
(make
|
||||
(for N 4
|
||||
(let
|
||||
(C 0
|
||||
L (make
|
||||
(do (/ 384 N)
|
||||
(do N (link C))
|
||||
(setq C (x| 1 C)) ) ) )
|
||||
(do 72 (link L)) ) ) )
|
||||
(out '(display) # Pipe to ImageMagick
|
||||
(prinl "P1")
|
||||
(prinl (length (car Pbm)) " " (length Pbm))
|
||||
(mapc prinl Pbm) ) )
|
||||
30
Task/Pinstripe-Display/PureBasic/pinstripe-display.purebasic
Normal file
30
Task/Pinstripe-Display/PureBasic/pinstripe-display.purebasic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#White = $FFFFFF ;color
|
||||
|
||||
;Create a Pinstripe image
|
||||
Procedure PinstripeDisplay(width, height)
|
||||
Protected x, imgID, psHeight = height / 4, psWidth = 1, psTop, horzBand
|
||||
imgID = CreateImage(#PB_Any, width, height)
|
||||
If imgID
|
||||
StartDrawing(ImageOutput(imgID))
|
||||
Repeat
|
||||
x = 0
|
||||
Repeat
|
||||
Box(x, psTop, psWidth, psHeight, #White)
|
||||
x + 2 * psWidth
|
||||
Until x >= width
|
||||
psWidth + 1
|
||||
horzBand + 1
|
||||
psTop = horzBand * height / 4 ;move to the top of next horizontal band of image
|
||||
Until psTop >= height
|
||||
StopDrawing()
|
||||
EndIf
|
||||
ProcedureReturn imgID
|
||||
EndProcedure
|
||||
|
||||
;Open a window and display the pinstripe
|
||||
If OpenWindow(0, 0, 0, 1, 1,"PureBasic Pinstripe", #PB_Window_Maximize | #PB_Window_SystemMenu)
|
||||
PicID = PinstripeDisplay(WindowWidth(0), WindowHeight(0))
|
||||
ImageGadget(0, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(PicID))
|
||||
While WaitWindowEvent() <> #PB_Event_CloseWindow
|
||||
Wend
|
||||
EndIf
|
||||
17
Task/Pinstripe-Display/Tcl/pinstripe-display.tcl
Normal file
17
Task/Pinstripe-Display/Tcl/pinstripe-display.tcl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package require Tcl 8.5
|
||||
package require Tk 8.5
|
||||
|
||||
wm attributes . -fullscreen 1
|
||||
pack [canvas .c -highlightthick 0] -fill both -expand 1
|
||||
set colors {black white}
|
||||
|
||||
set dy [expr {[winfo screenheight .c]/4}]
|
||||
set y 0
|
||||
foreach dx {1 2 3 4} {
|
||||
for {set x 0} {$x < [winfo screenwidth .c]} {incr x $dx} {
|
||||
.c create rectangle $x $y [expr {$x+$dx}] [expr {$y+$dy}] \
|
||||
-fill [lindex $colors 0] -outline {}
|
||||
set colors [list {*}[lrange $colors 1 end] [lindex $colors 0]]
|
||||
}
|
||||
incr y $dy
|
||||
}
|
||||
14
Task/Pinstripe-Display/XPL0/pinstripe-display.xpl0
Normal file
14
Task/Pinstripe-Display/XPL0/pinstripe-display.xpl0
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
include c:\cxpl\codes; \include 'code' declarations
|
||||
int X, Y, W, C;
|
||||
[SetVid($13); \320x200x8 graphics
|
||||
for Y:= 0 to 200-1 do \for all the scan lines...
|
||||
[W:= Y/50 + 1; \width of stripe = 1, 2, 3, 4
|
||||
C:= 0; \set color to black so first pixel becomes white
|
||||
for X:= 0 to 320-1 do \for all the pixels on a scan line...
|
||||
[if rem(X/W) = 0 then C:= C xor $0F; \alternate B&W
|
||||
Point(X, Y, C); \set pixel at X,Y to color C
|
||||
];
|
||||
];
|
||||
X:= ChIn(1); \wait for keystroke
|
||||
SetVid(3); \restore normal text display
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue