Pinstripe/Printer: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(→‎{{header|Perl 6}}: Add a Perl 6 example)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 149:
</lang>
 
=={{header|Perl 6Phix}}==
See the print_cb function of [[Colour_pinstripe/Display#Phix]] and the final comments of that entry.
 
=={{header|PicoLisp}}==
 
<lang PicoLisp>(load "@lib/ps.l")
 
(call 'lpr
(pdf "pinstripes"
(a4) # 595 x 842 dots
(for X 595
(gray (if (bit? 1 X) 0 100)
(vline X 0 842) ) )
(page) ) )</lang>
 
=={{header|Racket}}==
The drawing code is exactly the same code as [[Pinstripe/Display#Racket]], only
drawing onto a printer device context now.
<lang Racket>
#lang racket/gui
 
(define parts 4)
 
(define dc (new printer-dc%))
(send* dc (start-doc "Pinstripe") (start-page))
 
(define-values [W H] (send dc get-size))
(send dc set-pen "black" 0 'solid)
(send dc set-brush "black" 'solid)
(define H* (round (/ H parts)))
(for ([row parts])
(define Y (* row H*))
(for ([X (in-range 0 W (* (add1 row) 2))])
(send dc draw-rectangle X Y (add1 row) H*)))
 
(send* dc (end-page) (end-doc))
</lang>
 
=={{header|PhixRaku}}==
(formerly Perl 6)
{{works with|Rakudo|2020.01}}
Note that Perl 6 does not attempt to be a printer driver. This example allows users to specify the dpi and paper size, then generates an image and passes it to the default printer. Defaults to 300 dpi and US letter paper.
Line 210 ⟶ 249:
 
See [https://github.com/thundergnat/rc/blob/master/img/Pinstripe-printer-perl6.png Pinstripe-printer-perl6.png] (offsite png image)
 
=={{header|Phix}}==
See the print_cb function of [[Colour_pinstripe/Display#Phix]] and the final comments of that entry.
 
=={{header|PicoLisp}}==
 
<lang PicoLisp>(load "@lib/ps.l")
 
(call 'lpr
(pdf "pinstripes"
(a4) # 595 x 842 dots
(for X 595
(gray (if (bit? 1 X) 0 100)
(vline X 0 842) ) )
(page) ) )</lang>
 
=={{header|Racket}}==
The drawing code is exactly the same code as [[Pinstripe/Display#Racket]], only
drawing onto a printer device context now.
<lang Racket>
#lang racket/gui
 
(define parts 4)
 
(define dc (new printer-dc%))
(send* dc (start-doc "Pinstripe") (start-page))
 
(define-values [W H] (send dc get-size))
(send dc set-pen "black" 0 'solid)
(send dc set-brush "black" 'solid)
(define H* (round (/ H parts)))
(for ([row parts])
(define Y (* row H*))
(for ([X (in-range 0 W (* (add1 row) 2))])
(send dc draw-rectangle X Y (add1 row) H*)))
 
(send* dc (end-page) (end-doc))
</lang>
 
=={{header|Tcl}}==
10,333

edits