RosettaCodeData/Task/Pinstripe-Printer/BBC-BASIC/pinstripe-printer.basic

38 lines
1.1 KiB
Plaintext

PD_RETURNDC = 256
_LOGPIXELSY = 90
DIM pd{lStructSize%, hwndOwner%, hDevMode%, hDevNames%, \
\ hdc%, flags%, nFromPage{l&,h&}, nToPage{l&,h&}, \
\ nMinPage{l&,h&}, nMaxPage{l&,h&}, nCopies{l&,h&}, \
\ hInstance%, lCustData%, lpfnPrintHook%, lpfnSetupHook%, \
\ lpPrintTemplateName%, lpSetupTemplateName%, \
\ hPrintTemplate%, hSetupTemplate%}
pd.lStructSize% = DIM(pd{})
pd.hwndOwner% = @hwnd%
pd.flags% = PD_RETURNDC
SYS "PrintDlg", pd{} TO ok%
IF ok%=0 THEN QUIT
SYS "DeleteDC", @prthdc%
@prthdc% = pd.hdc%
*MARGINS 0,0,0,0
dx% = @vdu%!236-@vdu%!232
dy% = @vdu%!244-@vdu%!240
SYS "GetDeviceCaps", @prthdc%, _LOGPIXELSY TO dpi%
DIM rc{l%,t%,r%,b%}
SYS "CreateSolidBrush", 0 TO brush%
VDU 2,1,32,3
pitch% = 2
FOR y% = 0 TO dy% STEP dpi%
FOR x% = 0 TO dx%-pitch% STEP pitch%
rc.l% = x% : rc.r% = x% + pitch%/2
rc.t% = y% : rc.b% = y% + dpi%
SYS "FillRect", @prthdc%, rc{}, brush%
NEXT
pitch% += 2
NEXT y%
VDU 2,1,12,3