Pinstripe/Printer: Difference between revisions

no edit summary
m ({{omit from|GUISS}})
No edit summary
Line 7:
 
Optionally, on systems where the printer resolution cannot be determined, it is permissible to prompt the user for printer resolution, and to calculate point size based on user input, enabling fractional point sizes to be used.
 
=={{header|Liberty BASIC}}==
Draws the pattern in a window onto a large graphic box, then dumps to the printer.
<lang lb>
nomainwin
 
'paperW = 8.5 ' for US letter paper
'paperH = 11
 
paperW = 8.2677165 ' for A4 paper
paperH = 11.6929134
 
dpi= 300
 
prompt "Enter your printer DPI" +chr$( 13) + "(300 is OK for laser one, 360 likely for inkjet)"; dpi
 
w = paperW *dpi 'pixel size of paper
h = paperH *dpi
 
graphicbox #main.gr, 0, 0, 300, 300 'picture could be bigger
 
open "Pinstripe/Printer" for window as #main
 
#main "trapclose [quit]"
#main.gr "autoresize" 'now we can maximize window with picture
#main.gr "down"
#main.gr "horizscrollbar on 0 "; w -300 'so we can scroll it
#main.gr "vertscrollbar on 0 "; h -300
#main.gr "place 0 0"
#main.gr "color white"
#main.gr "boxfilled "; w; " ";h
#main.gr "color black"
#main.gr "backcolor black"
 
for i = 0 to int( paperH)
ww = i + 1
yy =( i + 1) * dpi
if yy > h then yy = h
for x = ww to w step ww * 2 'start with white strip
x1 = x + ww
if x1 >= w then x1 = w
#main.gr "place "; x; " "; i * dpi
#main.gr "boxfilled "; x1; " "; yy
next
next
 
#main.gr "flush"
#main.gr "print "; w
 
wait
[quit]
close #main
end
</lang>
 
 
Anonymous user