Jump to content

Colour pinstripe/Printer: Difference between revisions

→‎Tcl: Added implementation
m ({{omit from|GUISS}})
(→‎Tcl: Added implementation)
Line 1:
{{task}}[[Category:Test card]][[Category:Printer]]
{{task}}
The task is to create 1 point wide colour vertical pinstripes with a sufficient number of pinstripes to span the entire width of the colour graphics printer. The pinstripes should alternate between each individual cartridge ink and ink pair and black and white pinstripes should be included. A typical pinstripe sequence woud be black, red, green, blue, magenta, cyan, yellow, white.
 
The task is to create 1 point wide colour vertical pinstripes with a sufficient number of pinstripes to span the entire width of the colour graphics printer. The pinstripes should alternate between each individual cartridge ink and ink pair and black and white pinstripes should be included. A typical pinstripe sequence woud be black, red, green, blue, magenta,cyan, yellow, white.
 
After the first inch of printing, we switch to a wider 2 pixel wide vertical pinstripe pattern. and to 3 point wide vertical for the next inch, and then 4 point wide, etc. This trend continues for the entire length of the page (or for 12 inches of run length in the case of a printer using continuous roll stationery). After printing the test pattern the page is ejected (or the test pattern is rolled clear of the printer enclosure, in the case of continuous roll printers).
Line 35 ⟶ 34:
(inc 'Step) ) ) )
(page) ) )</lang>
 
=={{header|Tcl}}==
This code assumes that the page's printable area is 8.5"×11".
{{libheader|Tk}}
<lang tcl>package require Tk
# Allocate a temporary drawing surface
canvas .c
# The cycle of colors we want to use
set colors {black red green blue magenta cyan yellow white}
# Draw the output we want
for {set y 0;set dx 1} {$y < 11*72} {incr y 72;incr dx} {
for {set x 0;set c 0} {$x < 8.5*72} {incr x $dx;incr c} {
.c create rectangle $x $y [expr {$x+$dx+1}] [expr {$y+73}] \
-fill [lindex $colors [expr {$c%[llength $colors]}]] -outline {}
}
}
# Send postscript to default printer, scaled 1 pixel -> 1 point
exec lp - << [.c postscript -height $y -width $x -pageheight $y -pagewidth $x]
# Explicit exit; no GUI desired
exit</lang>
 
{{omit from|GUISS}}
{{omit from|Lotus 123 Macro Scripting}}
 
[[Category:Test card]]
[[Category:Printer]]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.