Colour pinstripe/Printer: Difference between revisions
→{{header|Go}}: Amended to now work on both Windows and Unix based systems.
(→{{header|Go}}: Tweaked drawing parameters to produce 1 inch bands when printing on A4 paper.) |
(→{{header|Go}}: Amended to now work on both Windows and Unix based systems.) |
||
Line 58:
=={{header|Go}}==
{{libheader|Go Graphics}}
<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.
Line 67 ⟶ 66:
"log"
"os/exec"
"runtime"
)
Line 96:
dc := gg.NewContext(842, 595)
pinstripe(dc)
dc.SavePNG(fileName)
cmd := exec.Command("mspaint", "/pt", "color_pinstripe.png")▼
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
} else {
cmd = exec.Command("lp", fileName)
}
if err := cmd.Run(); err != nil {
log.Fatal(err)
}
}</lang>
|