Colour pinstripe/Printer: Difference between revisions
m
syntax highlighting fixup automation
(Colour pinstripe/Printer in FreeBASIC) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 11:
=={{header|Ada}}==
{{libheader|APDF}}
<
with PDF_Out;
Line 93:
end;
Doc.Close;
end Color_Pinstripe_Printer;</
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
This program first displays a Print Dialogue so the printer can be selected.
<
_LOGPIXELSY = 90
Line 140:
pitch% += 1
NEXT y%
VDU 2,1,12,3</
=={{header|FreeBASIC}}==
<
#ifdef __FB_WIN32__
exename = "mspaint.exe /pt"
Line 177:
If result = -1 Then Print "Error running "; exename : Sleep
End If
End</
Line 184:
<br>
The code for this task is basically the same as for [[Colour_pinstripe/Display#Go]] except that the drawing parameters have been tweaked to produce 1 inch bands when printing on A4 paper and some code has been added to dump the image to the default printer.
<
import (
Line 231:
log.Fatal(err)
}
}</
=={{header|Julia}}==
<syntaxhighlight lang="julia">
using Colors, FileIO
Line 270:
colorstripepng("temp.png")
run(`print temp.png`) # the run statement may need to be set up for the installed device
</syntaxhighlight>
=={{header|Nim}}==
Line 277:
The code for drawing is the same that in the task Colour_pinstripe/Display but the context is different. We have chosen to display a dialog to give the user a way to choose the destination (which may be a printer or a file). Instead of the “draw” signal, we have to process the “begin_print” signal to set the number of pages and the “draw_page” signal to render the page.
<
const Colors = [[0.0, 0.0, 0.0], [255.0, 0.0, 0.0],
Line 329:
let app = newApplication(Application, "Rosetta.ColorPinstripe")
discard app.connect("activate", activate)
discard app.run()</
=={{header|Phix}}==
<!--<syntaxhighlight lang
See the print_cb function of [[Colour_pinstripe/Display#Phix]] and the final comments of that entry.
=={{header|PicoLisp}}==
<
# Using circular lists for an endless supply of colors
Line 360:
(zero I)
(inc 'Step) ) ) )
(page) ) )</
=={{header|Python}}==
<syntaxhighlight lang="python">
from turtle import *
from PIL import Image
Line 443:
subprocess.run(["mspaint", "/pt", "striped.jpg"])
</syntaxhighlight>
=={{header|Racket}}==
Line 450:
only drawing onto a printer device context now.
<syntaxhighlight lang="racket">
#lang racket/gui
Line 472:
(send* dc (end-page) (end-doc))
</syntaxhighlight>
=={{header|Raku}}==
Line 479:
Note that Raku 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.
<syntaxhighlight lang="raku"
my $filename = './Color-pinstripe-printer-perl6.png';
Line 535:
# Uncomment next line if you actually want to print it
#run('lp', $filename)</
See [https://github.com/thundergnat/rc/blob/master/img/Color-pinstripe-printer-perl6.png Color-pinstripe-printer-perl6.png] (offsite png image)
Line 541:
This code assumes that the page's printable area is 8.5"×11".
{{libheader|Tk}}
<
# Allocate a temporary drawing surface
canvas .c
Line 556:
exec lp - << [.c postscript -height $y -width $x -pageheight $y -pagewidth $x]
# Explicit exit; no GUI desired
exit</
=={{header|Wren}}==
Line 563:
<br>
This reuses the plug-in from the [[Pinstripe/Printer#Wren]] task to enable DOME to print to the default printer.
<
import "dome" for Window
import "plugin" for Plugin
Line 620:
}
var Game = Main.new()</
{{omit from|AWK}}
|