RosettaCodeData/Task/Colour-pinstripe-Printer/FreeBASIC/colour-pinstripe-printer.basic
2023-07-01 13:44:08 -04:00

34 lines
776 B
Text

Dim As String exename
#ifdef __FB_WIN32__
exename = "mspaint.exe /pt"
#endif
#ifdef __FB_LINUX__
exename = "lp -o media=A4 "
#endif
Dim As Uinteger ps, col, h, w, x, y1, y2
' (A4) # 595 x 842 dots
w = 842 : h = 595
' create display size window, 8bit color (palette), no frame
Screenres w, h, 8,, 8
h \= 7 : y2 = h -1
For ps = 1 To 7
col = 0
For x = 0 To (w - ps -1) Step ps
Line (x, y1) - (x + ps -1, y2), col, bf
col = (col +1) And 255
Next x
y1 += h : y2 += h
Next ps
Dim As String filename = "color_pinstripe.bmp"
If Bsave(filename, 0) <> 0 Then
Cls: Print "Error saving: "; fileName : Sleep
Else
Dim As Integer result = Exec(exename, filename)
If result = -1 Then Print "Error running "; exename : Sleep
End If
End