Colour pinstripe/Printer: Difference between revisions

m
syntax highlighting fixup automation
(Colour pinstripe/Printer in FreeBASIC)
m (syntax highlighting fixup automation)
Line 11:
=={{header|Ada}}==
{{libheader|APDF}}
<langsyntaxhighlight Adalang="ada">with Ada.Text_IO;
 
with PDF_Out;
Line 93:
end;
Doc.Close;
end Color_Pinstripe_Printer;</langsyntaxhighlight>
 
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
This program first displays a Print Dialogue so the printer can be selected.
<langsyntaxhighlight lang="bbcbasic"> PD_RETURNDC = 256
_LOGPIXELSY = 90
Line 140:
pitch% += 1
NEXT y%
VDU 2,1,12,3</langsyntaxhighlight>
 
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">Dim As String exename
#ifdef __FB_WIN32__
exename = "mspaint.exe /pt"
Line 177:
If result = -1 Then Print "Error running "; exename : Sleep
End If
End</langsyntaxhighlight>
 
 
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.
<langsyntaxhighlight lang="go">package main
import (
Line 231:
log.Fatal(err)
}
}</langsyntaxhighlight>
 
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">
<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>
</lang>
 
=={{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.
 
<langsyntaxhighlight Nimlang="nim">import gintro/[glib, gobject, gtk, gio, cairo]
 
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()</langsyntaxhighlight>
 
=={{header|Phix}}==
<!--<syntaxhighlight lang Phix="phix">(phixonline)--><!--</langsyntaxhighlight>-->
See the print_cb function of [[Colour_pinstripe/Display#Phix]] and the final comments of that entry.
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">(load "@lib/ps.l")
 
# Using circular lists for an endless supply of colors
Line 360:
(zero I)
(inc 'Step) ) ) )
(page) ) )</langsyntaxhighlight>
 
=={{header|Python}}==
<syntaxhighlight lang="python">
<lang Python>
from turtle import *
from PIL import Image
Line 443:
subprocess.run(["mspaint", "/pt", "striped.jpg"])
</syntaxhighlight>
</lang>
 
=={{header|Racket}}==
Line 450:
only drawing onto a printer device context now.
 
<syntaxhighlight lang="racket">
<lang Racket>
#lang racket/gui
 
Line 472:
 
(send* dc (end-page) (end-doc))
</syntaxhighlight>
</lang>
 
=={{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" perl6line>unit sub MAIN ($dpi = 300, $size = 'letter');
 
my $filename = './Color-pinstripe-printer-perl6.png';
Line 535:
 
# Uncomment next line if you actually want to print it
#run('lp', $filename)</langsyntaxhighlight>
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}}
<langsyntaxhighlight lang="tcl">package require 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</langsyntaxhighlight>
 
=={{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.
<langsyntaxhighlight lang="ecmascript">import "graphics" for Canvas, Color, ImageData
import "dome" for Window
import "plugin" for Plugin
Line 620:
}
 
var Game = Main.new()</langsyntaxhighlight>
 
{{omit from|AWK}}
10,327

edits