You are on page 1of 16

Printed 28/05/2014

Copyright 2001 by BUSS Ltd. All rights resered.


Simpleplot 2-16 under Microsoft 32-bit Windows
and FTN95 ser !uide
BUSS Ltd.
!oe"ber 2001
S"nopsis
#his do$%"ent $oers the %se o& Si"pleplot ersion 2'1( %nder )i$roso&t *indo+s
,-/!#/2000/.P /nd the S/l&ord 0tn,5 $o"piler.
1el/ted do$%"ents in$l%de the S#M$%&$%'T (eference manual )*t+ edition, /nd
the do$%"ent Simpleplot 2-16 under Microsoft 32-bit Windows and Ftn9-.95
#nstallation !uide.
/ontents
10 #NT('1/T#'N00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
20 !&TT#N! ST2(T&100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
2.1 *2134!5 012) A 62S B2.................................................................................................... 2
2.2 C17A#4!5 A P1287C# US4!5 PLA#2........................................................................................ 2
2.9 1U!!4!5 :2U1 APPL4CA#42!.................................................................................................. 9
30 W#N1'WS (&!#ST(3 &NT(#&S000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
9.1 1754S#1: PA#;...................................................................................................................... 4
9.2 1754S#1: 7!#147S................................................................................................................. 4
40 /'M$#%#N! S3ST&M (&ST(#/T#'NS000000000000000000000000000000000000000000000000000000000000000000000000000000000006
4.1 A15U)7!#S #2 S4)PL7PL2#.................................................................................................. (
4.2 17S71<76 LU!S.................................................................................................................... (
50 $2SS#N! 12T2 T' T5& S#M$%&$%'T-W#N1'WS #NT&(F2/&0000000000000000000000000000000000006
5.1 P176704!76 C2!S#A!#S= #:P7S= A!6 2PC267S..................................................................... >
5.2 7.A)PL7S............................................................................................................................ 10
5.2.1 Suppressing the "Printing" box...........................................................................................10
5.2.2 Filling the screen with a Simpleplot window......................................................................10
5.2.3 A stepb!step guide to inter"acing to #lear$in%.............................................................11
5.2.& #learwinSimpleplot source program................................................................................12
60 S#M$%&$%'T-W#N1'WS #NT&(F2/&00000000000000000000000000000000000000000000000000000000000000000000000000000000015
(.1 02!#S? ................................................................................................................................ 15
(.2 467!#40:4!5 )2US7 BU##2!S?............................................................................................. 15
60 S#M$%&$%'T M2$S0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016
Printed 28/05/2014
Copyright 2001 by BUSS Ltd. All rights resered.
User 5%ide ' 0tn,5
1. Introduction
S4)PL7PL2# lets yo% prod%$e gr/phi$s?
in / +indo+ +ith / #ontinue b%tton bet+een &r/"es
on / *indo+s s%pported printer
into / *indo+s 6ei$e 4ndependent Bit"/p @64BA
into / *indo+s )et/&ile
into / Port/ble !et+orB 5r/phi$s @.P!5A &ile
into / gig @.gi&A &ile
/ll &ro" / di/log bo-= /nd +itho%t the need to per&or" /ny C*indo+s progr/""ingD.
2. Getting started
2.1 Working from a DOS box
#o $o"pile= linB /nd r%n / progr/" +hi$h %ses the Si"pleplot libr/ry &ro" / 62S
bo-?
E 0#!,5 '!Program
E SL4!3
L2 '!Program.2B8
L2 F*indo+sFSyste"FSi"pleplot0tn,5.dll
04L7 '!Program.e-e
E '!Program.7.7
2.2 Creating a project using Pato
1e"e"ber to in$l%de the &ile F*indo+sFSyste"FSi"pleplot0tn,5.dll in yo%r proGe$t.
:o% /re re$o""ended to in$l%de the &tn,5 inter&/$e &ile spmodule0mod or
spmodule0f9- &ro" the Si"pleplot dire$tory.
2 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
2.! "unning #our appication
#he S4)PL7PL2# dei$e drier syste" b%ilds o%tp%t options into / "en%. #he
"en%= /nd site n/"es /nd site n%"bers +ithin it= "/y be $on&ig%red @see Appendi- 6
o& the S('P)*P)+, SupplementA. An /ppli$/tion "/y no"in/te / drier option by
$/lling @Site-ameA or @i.e/-oA
4& the progr/" h/s not spe$i&ied /n o%tp%t option= the %ser is pro"pted by / pop'%p
di/log bo-. #his di/log /lso /llo+s the %ser to sele$t +hi$h printer is %sed i& the
*4!62*SHP14!#71 option is sele$ted.
#he Simpleplot'Windows inter&/$e s%pplies the &ollo+ing options?
6ei$e I Site n/"e 6ei$e des$ription
59(0 *4!62* 6r/+ into Si"pleplot *indo+
59(1 *4!62*SHP14!#71 2%tp%t dire$tly to printer
59(2 *4!62*SH64B Si"pleplot *indo+ J 6ei$e 4ndependent Bit"/p
@.B)PA
59(9 *4!62*SH)7#A04L7 Si"pleplot *indo+ /nd *indo+s )et/&ile@.*)0A
59(4 *4!62*SH67071176 Si"pleplot *indo+ ' only %pd/te on 7nd P/ge
59(5 *4!62*SH64BH2!L: 2%tp%t to .B)P &ile
59(( *4!62*SH*)0H2!L: 2%tp%t to .*)0 &ile
59(> *4!62*SHP!5 2%tp%t to *indo+ /nd .P!5 &ile
59(8 *4!62*SHP!5H2!L: 2%tp%t to .P!5 &ile
59(, *4!62*SH540 2%tp%t to *indo+ /nd .gi& &ile
59>0 *4!62*SH540H2!L: 2%tp%t to .gi& &ile
#he W#N1'WS71#8 /nd W#N1'WS71#87'N%3 options o%tp%t the gr/phi$s to
/ 6ei$e 4ndependent Bit"/p &ile @$/lled dnn.b"p by de&/%ltA.
#he W#N1'WS7M&T2F#%&9 /nd W#N1'WS7WMF7'N%3 options o%tp%t the
gr/phi$s to / *indo+s )et/&ile @$/lled dnn.+"& by de&/%ltA.
#he W#N1'WS7$N!9 /nd W#N1'WS7$N!7'N%3 options o%tp%t / B)P
i"/ge to / Port/ble !et+orB 5r/phi$s &ile @$/lled dnn.png by de&/%ltA. #his option h/s
been deeloped /t BUSS %sing p%bli$ do"/in so&t+/re libpng ersion 1.05 &ro" the
P!5 deelop"ent gro%p.
#he W#N1'WS7!#F9 /nd W#N1'WS7!#F7'N%3 options o%tp%t /n i"/ge to /
540 &ile @$/lled dnn.gi& by de&/%ltA. To e:ercise t+is option "ou must be in
possession of a ;alid licence a<reement wit+ nis"s w+o own t+e
$atent on t+e underl"in< encodin< on w+ic+ !#F ima<es are built0
2%tp%t &ro" the 64B= )et/&ile= png= /nd gi& options $/n dire$ted to / %ser de&ined
&ilen/"e by .
@4= 9= 9= "ilename0
spe$i&ies th/t &ile'b/sed gr/phi$s o%tp%t is to be sent to "ilename +hi$h sho%ld be / &%ll
&ile spe$i&i$/tion @e.g. C:\\ADIR\\AFILE.WMFA. A di&&erent &ile sho%ld be
registered be&ore the st/rt o& e/$h p/ge i& yo% do not +/nt the &ile to be oer+ritten.
28/05/2014 9
User 5%ide ' 0tn,5
!. Windo$s "egistr# %ntries
!.1 "egistr# pat&
#he Si"pleplot'*indo+s inter&/$e %ses entries in the &ile registry syste" %nder the Bey
5=&37%'/2%7M2/5#N&>S'FTW2(&>8SS %td>
!.2 "egistr# entries
#he &ollo+ing s%b'Beys $ontrol di&&erent /spe$ts o& S4)PL7PL2# so&t+/re?
57!71AL ' syste" &iles
64A5 K&ilen/"eE spe$i&ies the destin/tion o& S4)PL7PL2# di/gnosti$s. 4&
there is no 64A5 entry= di/gnosti$s /re sent to the &ile
)7SSA57S.#.#.
;71S;7: K&ilen/"eE points to the S4)PL7PL2# ;ershey d/t/ &ile
$ont/ining so&t+/re &onts /nd "/rBers. #his is %s%/lly inst/lled in the
dire$tory
)7!U ' &/$ilities &or )7!U $on&ig%r/tion? @See Appendi- 6 o& S%pple"entA
C2!045 K&ilen/"eE points to / )7!U $on&ig%r/tion &ile.
AU.HC2!045 Kte-tE $ont/ins te-t to be re/d on the /%-ili/ry
$on&ig%r/tion $h/nnel.
0or e-/"ple= setting the AU.HC2!045 Bey to C670AUL# *4!62*D
$/%ses gr/phi$s o%tp%t to be sent to / +indo+ +itho%t displ/ying / dei$e
option "en% i& no spe$i&i$ dei$e is sele$ted by progr/".
*4!62*S #o spe$i&y det/iled $ontrol oer the rendering o& gr/phi$s
*46#; KintegerE Controls the +idth o& the S4)PL7PL2# gr/phi$s
+indo+ in pi-els. 4& there is no *46#; entry= the +idth de&/%lts to 9/4
o& the +idth o& the s$reen.
;745;# KintegerE Controls the height o& the S4)PL7PL2# gr/phi$s
+indo+ in pi-els. 4& there is no ;745;# entry= the height de&/%lts to 9/4
o& the height o& the s$reen.
!C2L1SKintegerEControls the n%"ber o& $olo%rs //il/ble to the
S4)PL7PL2# gr/phi$s +indo+ on p/lette b/sed dei$es. By de&/%lt the
entire p/lette +ill be //il/ble.
*4!62*H)4!H#7.#H*46#;KintegerE$ontrols the "ini"%" te-t
+idth @in pi-elsA %sed by the S4)PL7PL2# gr/phi$s +indo+. #he
de&/%lt o& 9 pi-els is %nre/d/ble b%t /ppro-i"/tes to s"/ll te-t on
printers.
*4!62*H)4!H#7.#H;745;#KintegerE$ontrols the "ini"%" te-t
height @in pi-elsA %sed by the S4)PL7PL2# gr/phi$s +indo+. #he
de&/%lt o& 5 pi-els is %nre/d/ble b%t /ppro-i"/tes to s"/ll te-t on
printers.
*4!62*HSUBHS:SH02!#Kboole/nE$ontrols +hether the syste" &ont is
%sed /s the de&/%lt &ont @&ont 0A by the S4)PL7PL2# gr/phi$s +indo+.
4& the /l%e is !2 the syste" &ont +ill be %sed= i& the /l%e is :7S then
&ont 1 @/ Co%rier looB'/liBeA +ill be %sed. #he de&/%lt is :7S.
4 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
*4!62*HSCAL7KstringE$ontrols +hether the physi$/l s$/ling o& the
*indo+ is tr%e to the physi$/l dei$e @P;:S4CALA or s$/led /$$ording to
Llogi$/l in$hesL @L254CALA. 4& no entry is present= the drier de&/%lts to
P;:S4CAL. 2ne o& L254CAL= P;:S4CAL @the de&/%ltA.
P14!#71H)4!H#7.#H*46#;KintegerE$ontrols the "ini"%" printer
te-t +idth in pi-els @de&/%lt 9A.
P14!#71H)4!H#7.#H;745;#KintegerE$ontrols the "ini"%" printer
te-t height in pi-els @de&/%lt 5A.
P14!#71HSUBHS:SH02!#Kboole/nE$ontrols +hether the syste" &ont is
%sed /s the de&/%lt &ont @&ont 0A &or the printer. 4& the /l%e is !2 the
syste" &ont is %sed= i& the /l%e is :7S then &ont 1 @/ Co%rier looB'/liBeA
+ill be %sed. #he de&/%lt is :7S.
P14!#71H)A154!HL70#KintegerEsets the printer le&t "/rgin. So"e
printer driers in$orre$tly st/te their print/ble /re/. #he de&/%lt is 5 %nitsM
see P14!#71H)A154!HU!4#S belo+.
P14!#71H)A154!HB2##2)KintegerEsets the printer botto" "/rgin.
So"e printer driers in$orre$tly st/te their print/ble /re/. #he de&/%lt is 5
%nitsM see P14!#71H)A154!HU!4#S belo+.
P14!#71H)A154!H145;#KintegerEsets the printer right "/rgin. So"e
printer driers in$orre$tly st/te their print/ble /re/. #he de&/%lt is 5 %nitsM
see P14!#71H)A154!HU!4#S belo+.
P14!#71H)A154!H#2PKintegerEsets the printer top "/rgin. So"e
printer driers in$orre$tly st/te their print/ble /re/. #he de&/%lt is 5 %nitsM
see P14!#71H)A154!HU!4#S belo+.
P14!#71H)A154!HU!4#SKstringEsets the %nits %sed &or spe$i&i$/tion
o& printer "/rgins. 2ne o& P24!#S= P4.7LS= )) @the de&/%ltA.
P14!#71HL4!7H7.C7SSKintegerESo"e printers render lines thi$Ber th/n
reN%ested. #his $/n be d%e to seer/l re/sons= &or e-/"ple= Posts$ript
Oro%nding errorP or inB spre/ding= /nd $/n res%lt in h/t$hed sh/ding /re/s
/ppe/ring solid. :o% $/n spe$i&y ho+ "/ny e-tr/ pi-els +ider th/n
reN%ested lines /re rendered. #he de&/%lt is 0 pi-els.
P14!#71H04LLHC2L1SKintegerEControls the n%"ber o& $olo%rs
//il/ble &or solid &ill on printers. By de&/%lt S4)PL7PL2# %ses 25(
$olo%rs @in$l%ding b/$Bgro%ndA &or solid &ill on /ll printers. #his /$tion
re&le$ts the obsered $/p/bility o& "/ny "ono$hro"e printer driers.
64SABL7HUS71HAB21#KintegerESele$tiely inhibits S4)PL7PL2#
&ro" iss%ing / QU4# "ess/ge +hile dr/+ing gr/phi$s. #he integer
/rg%"ent spe$i&ied +hi$h QU4# "ess/ge is inhibited= /nd is the s%" o&?
1. #o grey o%t the C/n$el b%tton on / S4)PL7PL2# gr/phi$s +indo+
2. #o inhibit the C/n$el option on the S4)PL7PL2# LPrintingL +indo+=
indi$/ting the $%rrent p/ge n%"ber
#his $o""/nd $/n be %sed to preent /n /ppli$/tion &ro" /borting %nder %ser $ontrol
+hile gr/phi$s /re being prod%$ed. #he de&/%lt o& 0 en/bles the C/n$el options in both
the gr/phi$s +indo+ /nd the LPrintingL +indo+.
28/05/2014 5
User 5%ide ' 0tn,5
'. Compiing s#stem restrictions
'.1 (rguments to Simpepot
#he Si"pleplot libr/ry is $o"piled %sing 4 byte integers /nd 4 byte re/ls. 4& yo% %se
di&&erent siRed /ri/bles= yo% "%st be s%re th/t /ri/bles p/ssed to Si"pleplot /re
$orre$tly spe$i&ied.
'.2 "eser)ed *+,s
Si"pleplot reseres the logi$/l %nit n%"bers @LU!sA 80 to 10,. See t/ble 1. :o%
sho%ld not %se these logi$/l %nit n%"bers bet+een opening /nd $losing Si"pleplot.
#/ble 1 0#!,5 LU!s
4#:P7 Ch/nnel Se$tion S4)PL7.4!4 entry 6e&/%lt LU!
1 6i/gnosti$s 57!71AL 64A5 )7SSA57S.#.# '
8 S$r/t$h &ile ' ' ' ,9
, ;ershey &ont &ile 57!71AL ;71S;7: ' ,4
10 S$r/t$h &ile ' ' ' ,0
' )/p d/t/ &iles 57!71AL )APH4!67.
)APHP2L4#4CAL
' ,1
Note: 0or 4#:P7 see SUB12U#4!7 42C;A!.
( S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
-. Passing data to t&e Simpepot.Windo$s interface
By de&/%lt= the Si"pleplot'*indo+s 4nter&/$e h/ndles gr/phi$s o%tp%t independently
o& the /ppli$/tion. #he Si"pleplot S%bro%tine 666A#A $o""%ni$/tes in&or"/tion
&ro" the /ppli$/tion to $ontrol the Si"pleplot *indo+s inter&/$e. 6/t/ "%st be p/ssed
be&ore the drier is opened /nd +ill re"/in e&&e$tie %ntil the drier is $losed. #he
drier is opened eery ti"e 67<!2 or 67<!A) is $/lled= /nd $losed be&ore opening
/nother dei$e or /&ter 7!6PL#..
S%bro%tine 666A#A $/n be %sed to dr/+ into / Cle/r*inS +indo+= or to $ontrol the
det/iled /ppe/r/n$e o& o%tp%t sent to / printer= 64B @.B)P &ileA= or *indo+s )et/&ile.
#he d/t/ /re held in /n /rr/y o& ite"s o& type
S4)PL7H*4!62*SH6A#AHS#1UC#H# de&ined belo+. 7/$h ite" in the /rr/y
$onsists o& /n 2pCode /nd the /ddress o& 2pCode spe$i&i$ d/t/?
#he /rr/y /nd /ll d/t/ re&eren$ed by iPtr in the /rr/y "%st be SA<7d /s st/ti$
/ri/bles= sin$e they /re not /n/lysed %ntil /n /tte"pt is ne-t "/de to open / dei$e.
#he l/st 2pCode in the /rr/y is /l+/ys S4)PL7H*4!62*SH7!6HL4S#
-.1 Predefined constants/ t#pes/ and OpCodes
sp"od%le."od is deried &ro" sp"od%le.&,0= /nd $ont/ins de&initions o& the $%rrently
//il/ble 2pCodes= /nd so"e %se&%l $onst/nt /l%es /nd types?
constants
4!#7571= PA1A)7#71 ?? J
S4)PL7H*4!62*SH*4!62* T 1= S4)PL7H*4!62*SHP14!#71 T 2= J
S4)PL7H*4!62*SH64B T 4= S4)PL7H*4!62*SH)7#A04L7 T 8
4!#7571= PA1A)7#71 ?? J
S4)PL7HP71C7!# T 0= S4)PL7HP4.7LS T 1= S4)PL7H)) T 2
T3$&s
#:P7 S4)PL7H*4!62*SH6A#AHS#1UC#H#
4!#7571 ?? i2p$ U Corresponds to CSS long int
4!#7571 ?? iPtr U Address o& 2pCode spe$i&i$ d/t/
7!6 #:P7 S4)PL7H*4!62*SH6A#AHS#1UC#H#
#:P7 S4)PL7H*4!62*SH;6CH6A#AH#
4!#7571 ?? h6C U dei$e $onte-t h/ndle
4!#7571 ?? i*idth= i;eight U plotting /re/
7!6 #:P7 S4)PL7H*4!62*SH;6CH6A#AH#
#:P7 S4)PL7H*4!62*SHS4V7H#
4!#7571 ?? iUnits U S4)PL7HP71C7!#= ...HP4.7LS= ...H))
4!#7571 ?? i*idth= i;eight= i6epth
7!6 #:P7 S4)PL7H*4!62*SHS4V7H#
#:P7 S4)PL7H*4!62*SH21454!H#
4!#7571 ?? iUnits U S4)PL7HP71C7!#= ...HP4.7LS= ...H))
4!#7571 ?? i.= i:
7!6 #:P7 S4)PL7H*4!62*SH21454!H#
28/05/2014 >
User 5%ide ' 0tn,5
'p/odes
' S#M$%&7W#N1'WS7&N17%#ST is /l+/ys the l/st entry in the list. #he iPtr
"e"ber o& the 2pCode is not re&eren$ed.
' S#M$%&7W#N1'WS7S&T7W#N1'W7N2M& spe$i&ies the n/"e o& the
gr/phi$s +indo+. #he iPtr "e"ber o& the 2pCode gies the /ddress o& / Rero
ter"in/ted string $ont/ining the reN%ired te-t. #his t/Bes e&&e$t only i& / *indo+ is
$re/ted.
' S#M$%&7W#N1'WS7S&T751/71#M #he iPtr "e"ber o& the 2pCode
points to / str%$t%re o& type S4)PL7H*4!62*SH;6CH6A#AH#. #he str%$t%re
$ont/ins the h/ndle to the dei$e $onte-t /nd its di"ensions.
S4)PL7H*4!62*SHS7#H;6CH64) is %sed to p/ss det/ils /bo%t / Cle/r*inS
*indo+ to Si"pleplotH
' S#M$%&7W#N1'WS7S&T75$2%&TT& #he iPtr "e"ber o& the 2pCode
points to the h/ndle o& the p/lette sele$ted into the 6ei$e Conte-t spe$i&ied by
S4)PL7H*4!62*SHS7#H;6CH64). #he p/lette is only reN%ired by S$reen
)odes th/t /re p/lette b/sed @typi$/lly 25( $olo%r "odesA
- S#M$%&7W#N1'WS7W#N1'W7S#?& #he iPtr "e"ber o& the 2pCode
points to / str%$t%re o& type S4)PL7H*4!62*SHS4V7H#= spe$i&ying the
di"ensions o& the gr/phi$s /re/= /nd option/lly the depth o& .B)P /nd .P!5 &iles. #he
str%$t%re de&ines the %nits in +hi$h the +indo+ siRe is gien. By de&/%lt Si"pleplot
%ses >5W o& the s$reen +idth /nd height= /nd the &%ll /re/ /ddressed by the *indo+s
printer drier. #he /re/ %sed &or / +indo+ is /lso %sed &or / 64B /nd / *indo+s
)et/&ile. #he de&/%lt /re/ "/y /lso be /ltered by the Beys widt+ /nd +ei<+t spe$i&ied
in the registry syste" in
;37:HL2CALH)AC;4!7FS20#*A17FBUSS LtdFF*4!62*S #he di"ensions
oerride /ny /l%es set in the registry syste". Units /re gien /s?
S4)PL7HP71C7!# U 6i"ensions /s W /ge o& S$reen
S4)PL7HP4.7LS U 6i"ensions in s$reen pi-els
S4)PL7H)) U 6i"ensions in ""
.B)P /nd .P!5 &iles /re stored in the depth spe$i&ied by i6epth +hi$h "%st be 0= 8= or
24.
' S#M$%&7W#N1'WS7&N28%&7$(#NT#N!7W#N1'W 7n/bles/inhibits /
Printing bo- +hen o%tp%tting to Printer= 64B or *indo+s )et/&ile. #he iPtr "e"ber
o& the 2pCode gies the /ddress o& / st/ti$ 4!#7571 /ri/ble giing the bit'+ise 21
o&?
S4)PL7H*4!62*SH*4!62*= S4)PL7H*4!62*SHP14!#71=
S4)PL7H*4!62*SH64B= S4)PL7H*4!62*SH)7#A04L7
A Printing bo- is displ/yed +hen o%tp%tting to *4!62*SHP14!#71=
*4!62*SH64BH2!L: or *4!62*SH*)0H2!L:. #he printing bo- is
inhibited by setting the /ppropri/te bit to 0.
' S#M$%&7W#N1'WS7S&T7WMF7(&S
sets the dpi &or / )et/&ile +hen *4!62*SH*)0H2!L: is sele$ted. #he iPtr
"e"ber o& the 2pCode points to /n integer giing the n%"ber o& dots per in$h. #he
de&/%lt resol%tion o& / *indo+s )et/&ile is 1440 dpi. :o% "/y /lso set the "et/&ile
di"ensions by S4)PL7H*4!62*SH*4!62*HS4V7 +hen yo% set the resol%tion.
' S#M$%&7W#N1'WS7W#N1'W7'(#!#N Spe$i&ies the origin o& /
Si"pleplot $re/ted *indo+ . #he iPtr "e"ber o& the 2pCode gies the /ddress o& /
st/ti$ d/t/ str%$t%re o& type S4)PL7H*4!62*SH21454!H#. 6e&/%lt is &or
*indo+s to position the Si"pleplot *indo+ +here it &eels liBe.
8 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
- S#M$%&7W#N1'WS7!#F7M#N#M#?&7$2%. Spe$i&ies +hether to "ini"iRe
the siRe o& the 540 p/lette on the b/sis o& only $ont/ining $olo%rs in$l%ded in the
i"/ge. #he res%lting 540 &iles /re s"/ller= b%t /t the e-pense o& slightly "ore ti"e to
gener/te. #he iPtr "e"ber o& the 2pCode points to / st/ti$ integer set /s 0 to not
"ini"iRe @de&/%ltA= 1 to "ini"iRe.
- S#M$%&7W#N1'WS7!#F7T(2NS$2(&N/37/'%( spe$i&ies / $olo%r to
be rendered /s transparent0 #he $olo%r is spe$i&ied /s / 4'byte he- n%"ber. #he iPtr
"e"ber o& the 2pCode points to / st/ti$ integer. #he top byte sho%ld be 0 i& /ny
$olo%r is to be$o"e tr/nsp/rent. #he ne-t 9 bytes gie the 15B $o"ponents o& the
tr/nsp/rent $olo%r.
- S#M$%&7W#N1'WS7!#F72N#M7M'1& spe$i&ies +hether / single 540 &ile
is to $ont/in /n /ni"/tion seN%en$e. #he iPtr "e"ber o& the 2pCode points to / st/ti$
integer set /s 0 &or no /ni"/tion= 1 &or /ni"/tion seN%en$e +ith s%$$essie &r/"es
$le/ring the b/$Bgro%nd= 2 &or /ni"/tion seN%en$e +ith s%$$essie &r/"es oerl/ying
preio%s &r/"es.
- S#M$%&7W#N1'WS7!#F72N#M7%''$ spe$i&ies +hether /n /ni"/tion &ile
sho%ld loop. #he iPtr "e"ber o& the 2pCode points to / st/ti$ integer set /s '1 &or no
loopingM 0 &or looping inde&initely= E 0 &or I iter/tions.
- S#M$%&7W#N1'WS7!#F72N#M71&%23 spe$i&ies the del/y bet+een
&r/"es in / /ni"/tion seN%en$e in 100ths o& / se$ond. #he iPtr "e"ber o& the 2pCode
points to / st/ti$ integer set /s 0 &or no del/y
28/05/2014 ,
User 5%ide ' 0tn,5
-.2 %xampes
-.2.1 Suppressing t&e 0Printing0 box
;o+ to s%ppress the Printing bo- +hi$h /ppe/rs +hen o%tp%tting to printer= 64B or
*)0
SUBROUTINE StopPrintingBox
use spmodule ! Specifies constants, TYPEs and OpCodes
TYPE(SIMPLE_WINDOWS_DATA_STRUCT_T), DIMENSION(2) :: OpCodes
INTEGER :: iPrintBox = 0 ! Supress for all options
SAVE OpCodes, iPrintBox
OpCodes(1)%iOpc = SIMPLE_WINDOWS_PRINTING_WINDOW
OpCodes(1)%iPtr = LOC(iPrintBox)
OpCodes(2)%iOpc = SIMPLE_WINDOWS_END_LIST
CALL DDDATA(LOC(OpCodes))
CALL DEVNAM('WINDOWS_WMF_ONLY') ! Nominate output device
-.2.2 1iing t&e screen $it& a Simpepot $indo$
;o+ to $re/te / +indo+ +hi$h &ills the displ/y= /nd to $h/nge the *indo+ !/"e?
SUBROUTINE SetDDData
use spmodule ! Specifies constants, TYPEs and OpCodes
TYPE(SIMPLE_WINDOWS_DATA_STRUCT_T), DIMENSION(3) :: OpCodes
CHARACTER*10 :: WindowHeader = 'My Header' ! Alternative name
TYPE(SIMPLE_WINDOWS_SIZE_T) WindowSize
SAVE OpCodes, WindowHeader, WindowSize
WindowSize%iUnits = SIMPLE_PERCENT ! Units for ...
WindowSize%iWidth = 100 ! ... %age screen width
WindowSize%iHeight = 100 ! ... & height
WindowSize%iDepth = 0 ! Set depth to be same as screen
OpCodes(1)%iOpc = SIMPLE_WINDOWS_SET_WINDOW_NAME
OpCodes(1)%iPtr = LOC(WindowHeader)
OpCodes(2)%iOpc = SIMPLE_WINDOWS_WINDOW_SIZE
OpCodes(2)%iPtr = LOC(WindowSize)
OpCodes(3)%iOpc = SIMPLE_WINDOWS_END_LIST
CALL DDDATA(LOC(OpCodes))
CALL DEVNAM('WINDOW')
END SUBROUTINE SetDDData
10 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
-.2.! ( step.b#.step guide to interfacing to CearWin2
*ithin / Cle/r*inS eniron"ent= the &ollo+ing progr/" str%$t%re "/y be %sed to
send Si"pleplot o%tp%t to / Cle/r*inS *indo+?
1. Cre/te / Bit"/p %sing the Cle/r*inS &%n$tion 57#HB4#)APH6CX.
2. P/ss the Bit"/p /nd its di"ensions to Si"pleplot %sing s%bro%tine 666A#A.
9. P/ss the s/"e Bit"/p to Cle/r*inS %sing the &or"/t spe$i&ier Wd+.
4. Use Si"pleplot ro%tines to plot yo%r d/t/.
5. Copy the $ontents o& the Bit"/p to / +indo+ %sing the Cle/r*inS s%bro%tine
*4!62*HUP6A#7X.
Step 1 Create a bitmap
A Bit"/p is di"ensioned in pi-els. #o "/Be yo%r progr/" port/ble on syste"s +ith
di&&erent resol%tion displ/ys= %se the Cle/r*inS &%n$tion 5etSyste")etri$s to &ind
o%t the resol%tion o& yo%r s$reen. #he e-/"ple belo+ sets the Bit"/p di"ensions to
(0W o& the s$reen in - /nd y= /nd then $re/tes / Bit"/p= ret%rning its 6ei$e Conte-t
@6CA.
include <windows.ins>
use spmodule ! Specifies constants, TYPEs and OpCodes
TYPE(SIMPLE_WINDOWS_DATA_STRUCT_T), DIMENSION(3) :: OpCodes
TYPE(SIMPLE_WINDOWS_HDC_DATA_T) WindowData
SAVE OpCodes, WidowData
! Find dimensions of screen in pixels & create bitmap @60%
nXPixels = GetSystemMetrics(SM_CXSCREEN) * 0.6
nYPixels = GetSystemMetrics(SM_CYSCREEN) * 0.6
iBitMapDC = GET_BITMAP_DC@(INTS(nXPixels), INTS(nYPixels))
Step 2 Pass t&e 3itmap and its dimensions to Simpepot
WindowData%hDC = iBitmapDC !
WindowData%iWidth = nXPixels ! ... %age screen width
WindowData%iHeight = nYPixels ! ... & height
OpCodes(1)%iOpc = SIMPLE_WINDOWS_SET_HDC_DIM
OpCodes(1)%iPtr = LOC(WindowData)
OpCodes(2)%iOpc = SIMPLE_WINDOWS_END_LIST
CALL DDDATA(LOC(OpCodes))
CALL DEVNAM('WINDOW') ! Windows driver
Step ! Pass t&e same 3itmap to CearWin2
iAns = WINIO@('... %dw ...', iBitMapDC)
Step ' Cop# t&e contents of t&e 3itmap to $indo$ after dra$ing
CALL OUTBUF ! Purge all Simpleplot buffers
CALL WINDOW_UPDATE@(iBitMapDC)
28/05/2014 11
User 5%ide ' 0tn,5
-.2.' Cear$in.Simpepot source program
UYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
U #4#L7? CL*4!HSP
U <71S42!?1.1
U ABS#1AC#?SBeleton S4)PL7PL2# progr/" to dr/+ into Cle/r*inS *indo+
U
U S#1UC#U17?
U iA Cre/te Cle/r*inS Bit"/p
U iiA P/ss bit"/p J di"ensions to S4)PL7PL2# J sele$t *4!62*
U iiiA Cre/te "en%s J p/ss bit"/p to Cle/r*in
U iA 0or e/$h type o& pi$t%re reN%ested= dr/+ into bit"/p
U then $opy to +indo+
U YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
)26UL7 SP*4! U Cont/ins de&inition o& /l%es to p/ss to 666A#A
#:P7 ;6CH64)H#:P7
4!#7571Y4 iBit"/p6C= i*idth= i;eight
7!6 #:P7 ;6CH64)H#:P7
#:P7 @;6CH64)H#:P7A ?? ;6CH64)
U Use&%l de&inition o& d/t/ str%$t%re to hold Bit"/p6C to p/ss to S4)PL7PL2#
7!6 )26UL7 SP*4!
P1251A) CL*4!HSP
US7 SP)26UL7
US7 SP*4!
4!CLU67 K*4!62*S.4!SE
4!#7571Y4 iAns= 6r/+ContL= 6r/+ContS= 6r/+S%r&L= 6r/+S%r&S
7.#71!AL 6r/+ContL= 6r/+ContS= 6r/+S%r&L= 6r/+S%r&S
U Cre/te Bit"/p (00 - 400 pi-els
;6CH64) W i*idth T (00
;6CH64) W i;eight T 400
;6CH64) W iBit"/p6C T 57#HBit"/pH6CX@;6CH64) W i*idth= ;6CH64) W i;eightA
CALL SPHS%pplyBit"/p U P/ss Bit"/p to S4)PL7PL2#
CALL SetAttrib%tes
iAns T *4!42X@PW$/ZS4)PL7PL2# /nd Cle/r*inS[JPA U C/ption
iAns T *4!42X@PW"nZJ6r/+P // J
PZJConto%rZJSh/ded= JLine[=P // J
PJS%r&/$eZJSh/ded= JLine[=P // J
P\= 7J-it[[JP= J U P\P &or horiR sep/r/tor
6r/+ContS= 6r/+ContL= 6r/+S%r&S= 6r/+S%r&L= P7.4#PA
iAns T *4!42X@PWd+P= ;6CH64) W iBit"/p6CA U P/ss bit"/p6C to Cle/r*in
7!6
U YYYYYYYYYYYYYYYYYYY SPHS%pplyBit"/p YYYYYYYYYYYYYYYYYYYYYYY
SUB12U#4!7 SPHS%pplyBit"/p U P/ss Bit"/p to S4)PL7PL2#
U Set %p / St/ti$ @SA<7dA /rr/y o& 2pCodes. 7/$h 2pCode $onsists o& /n
U 2pCode 46 &ollo+ed by /n option/l /ddress o& / d/t/ str%$t%re.
U #he p/r/"eter blo$B /ddress is p/ssed to S4)PL7PL2# by SUB12U#4!7 666A#A.
U
U 4n this e-/"ple?
U S4)PL7H*4!62*SHS7#H;6CH64) spe$i&ies th/t the ne-t integer is the /ddress
U o& / d/t/ str%$t%re $onsisting o& / Bit"/p 6C &ollo+ed by its di"ensions
U S4)PL7H*4!62*SH7!6HL4S# is the "/nd/tory end o& list ite" +hi$h does not
U reN%ire the /ddress o& / str%$t%re
US7 sp"od%le
US7 SP*4!
12 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
#:P7@S4)PL7H*4!62*SH6A#AHS#1UC#H#A= 64)7!S42!@2A ?? 2pCodes
SA<7 2pCodes
2pCodes@1AWi2p$ T S4)PL7H*4!62*SHS7#H;6CH64) U h6C S di"ensions
2pCodes@1AWiPtr T L2C@;6CH64)A U See de&inition o& SP*4! /boe
2pCodes@2AWi2p$ T S4)PL7H*4!62*SH7!6HL4S#U 7nd o& list
CALL 666A#A@L2C@2pCodesAAU !oti&y S4)PL7PL2#
CALL 67<!A)@P*4!62*PA U Sele$t *indo+
CALL 2*!!7*@.#1U7.A U 4nhibit PContin%eP b%tton
7!6
U YYYYYYYYYYYYYYYYYYYYY #est 0%n$tion YYYYYYYYYYYYYYYYYYYYYYY
17AL 0U!C#42! #st0%n@-= yA
U #st0%n is / si"ple &%n$tion o& 2 /ri/bles &or de"onstr/tion p%rposes
17AL -= yU 4!? /rg%"ents to &%n$tion o& 2 /ri/bles $/lled by
U 0!C!#S= 0!S;6S= 0!SU10 belo+
#st0%n T SQ1#@ABS@C2S@yA Y S4!@-AAA
7!6
U YYYYYYYYYYYYYYY C/ll'b/$B? Conto%r 'E Line YYYYYYYYYYYYYYYY
4!#7571 0U!C#42! 6r/+ContL@A
U 6r/+ / line $onto%r plot.
7.#71!AL #st0%n U 0%n$tion gien /boe
17AL #st0%n
CALL !7*PA5 U St/rt ne+ p/ge
CALL #4#L7>@P;igherP=PCentreP= PLine Conto%rs &ro" S4)PL7PL2#PA
CALL A.7S>@P.P= P:PA U St/rt ne+ pi$t%re J dr/+ /-es
CALL Upd/te*in U Copy Bit"/p so &/r to +indo+
CALL C#!U)B@.#1U7.A U 1eN%est l/belled $onto%rs
CALL 0!C!#S@#st0%nA U 6r/+ $onto%r plot
CALL C#!U)B@.0ALS7.A U C/n$el l/belled $onto%rs
CALL Upd/te*in U Copy Bit"/p to +indo+
6r/+ContL T 1 U 1et%rn d%""y /l%e
7!6
28/05/2014 19
User 5%ide ' 0tn,5
U YYYYYYYYYYYYYYY C/ll'b/$B? Conto%r 'E Sh/ded YYYYYYYYYYYYYY
4!#7571 0U!C#42! 6r/+ContS@A
U 6r/+ / &illed $onto%r plot.
7.#71!AL #st0%n
17AL #st0%n
17AL R)in= R)/- U #o re$eie &%n$tion r/nge
CALL !7*PA5 U St/rt ne+ p/ge
CALL #4#L7>@P;igherP=PCentreP= P0illed Conto%rs &ro" S4)PL7PL2#PA
CALL !7*P4C U St/rt ne+ pi$t%re
CALL L4)S0!@#st0%n= R)in= R)/-A U 0ind &%n$tion r/nge
CALL )P3>;@PLo+erP= PCentreP= R)in= R)/-= J U Add Bey
PR T SQ1#@ABS@C2S@yA Y S4!@-AAAPA
CALL Upd/te*in U Copy Bit"/p to +indo+
CALL 0!S;6S@#st0%nA U 6r/+ sh/ded $onto%r
CALL Upd/te*in U Copy Bit"/p to +indo+
6r/+ContS T 1 U 1et%rn d%""y /l%e
7!6
U YYYYYYYYYYYYYYY C/ll'b/$B? S%r&/$e 'E Line YYYYYYYYYYYYYYYY
4!#7571 0U!C#42! 6r/+S%r&L@A
U 6r/+ / line s%r&/$e plot.
7.#71!AL #st0%n
17AL #st0%n
CALL !7*PA5 U St/rt ne+ p/ge
CALL #4#L7>@P;igherP=PCentreP= PLine S%r&/$e &ro" S4)PL7PL2#PA
CALL 0!SU10@#st0%nA U St/rt pi$t%re J dr/+ s%r&/$e
CALL Upd/te*in U Copy Bit"/p to +indo+
6r/+S%r&L T 1 U 1et%rn d%""y /l%e
7!6
U YYYYYYYYYYYYYYY C/ll'b/$B? S%r&/$e'E Sh/ded YYYYYYYYYYYYYY
4!#7571 0U!C#42! 6r/+S%r&S@A
U 6r/+ / solid s%r&/$e plot.
7.#71!AL #st0%n
17AL #st0%n
17AL R)in= R)/-
CALL !7*PA5 U St/rt ne+ p/ge
CALL #4#L7>@P;igherP=PCentreP= P0illed S%r&/$e &ro" S4)PL7PL2#PA
CALL L4)S0!@#st0%n= R)in= R)/-A U 0ind &%n$tion r/nge
CALL )P3>;@PLo+erP= PCentreP= R)in= R)/-= J U Add Bey
PR T SQ1#@ABS@C2S@yA Y S4!@-AAAPA
CALL Upd/te*in U Copy Bit"/p to +indo+
CALL 4SS;A6@4A U Spe$i&y sh/ding
CALL 0!SU10@#st0%nA U St/rt pi$t%re J dr/+ s%r&/$e
CALL 4SS;A6@0A U C/n$el sh/ding
CALL Upd/te*in U Copy Bit"/p to +indo+
6r/+S%r&S T 1 U 1et%rn d%""y /l%e
7!6
U YYYYYYYYYYYYYYYYYYYYY Upd/te *indo+ YYYYYYYYYYYYYYYYYYYYYY
U #his s%bro%tine is $/lled +heneer the bit"/p is to be $opied to the s$reen.
U Until this is $/lled= none o& the gr/phi$s prod%$ed by S4)PL7PL2# is isible
SUB12U#4!7 Upd/te*in
US7 SP*4!
CALL 2U#BU0 U 0l%sh b%&&ers
CALL *4!62*HUP6A#7X@;6CH64) W iBit"/p6CA U Copy Bit"/p to +indo+
7!6
U YYYYYYYYYYYYYYYYYYYY 6e&ine $h/r/$teristi$s o& pi$t%re YYYYYYYYYYYYYYY
SUB12U#4!7 SetAttrib%tes
CALL S7#P!S@1= 1= 9= 4A U )%lti'$olo%red
14 S4)PL7PL2# 2'1(
User 5%ide ' &tn,5
CALL C;S7#@',AU Sele$t &ont
CALL 0!A17A@0.0= 5.0= 0.0= 5.0A U 6e&ine &%n$tion r/nge
CALL SCAL7S@0.0= 5.0= 1= 0.0= 5.0= 1A U Set s$/les &or $onto%r
CALL 4S#:P7@9AU 1eN%est $ross'h/t$hed iso"etri$s
CALL 4S0ULL@.#1U7.A U 0ill pi$t%re +ith iso"etri$
CALL 4SA.7S@.#1U7.A U 1eN%est /-es on iso"etri$s
CALL S0)7S;@21= 21A U 7/l%/te &%n$tion oer 21-21 grid
7!6
4. Simpepot.Windo$s interface
4.1 1onts5
#he Si"pleplot'*indo+s inter&/$e s%pports the &ollo+ing &onts sele$ted by
SUB12U#4!7 C;S7#?
Ch/r/$teristi$s prede&ined /re? @nor"/lly #r%e#ypeA
Selected b! 1old Fixed
$idth
(talic Famil! *xample
$hset@0A r a r )odern Courier
1
$hset@'1A r a r )odern Courier
$hset@'2A r a a )odern Courier-Oblique
$hset@'9A a a r )odern Courier-Bold
$hset@'4A a a a )odern Courier-BoldOblique
$hset@'5A r r r 1o"/n #i"es'1o"/n
$hset@'(A r r a 1o"/n ,imes(talic
$hset@'>A a r r 1o"/n Times-8old
$hset@'8A a r a 1o"/n Times-BoldItalic
$hset@',A r r r S+iss Helvetica
$hset@'10A r r a S+iss Helvetica-Oblique
$hset@'11A a r r S+iss Helvetica-Bold
$hset@'12A a r a S+iss Helvetica-BoldOblique
1
#he &ont sele$ted by C;S7#@0A $/n be $on&ig%red to be the S:S#7)H02!# ' see spe$i&i$/tion o&
1egistry options
4.2 Identif#ing mouse buttons5
#he /l%e ret%rned by S%bro%tine SUB12U#4!7 57#.: /s 4;4# is /s &ollo+s?
5r/phi$s 4np%t? )o%se @p%$B= penA s%pport?
B%tto
n
</l%e
1 '1
2 '2
9 '4
4 '8
28/05/2014 15
User 5%ide ' 0tn,5
6. SI7P*%P*O8 7aps
#he S4)PL7PL2# "/pping "od%le is s%pplied +ith t+o independent sets o& $o/stline
d/t/ both o& +hi$h h/e been en$oded &or r%n'ti"e e&&i$ien$y?
#he shoreline &ile is b/sed on ;ershey shoreline d/t/= /nd $onsists o& G%st oer
20000 d/t/ points. 4t "/y be %se&%l in / deelop"ent eniron"ent +here speed o&
o%t p%t is "ore i"port/nt th/n N%/lity. #his is the de&/%lt d/t/ &ile.
#he geological s%rey &ile is b/sed on the US 5eologi$/l S%rey d/t/= /nd $onsists
o& G%st oer (0000 d/t/ points.
#hese d/t/ &iles /re /$$essed i/ /n inde- &ile +hi$h is de&ined by the 1egistry syste"
%nder the Bey
5=&37%'/2%7M2/5#N&>S'FTW2(&>8SS %td>>!&N&(2%
)APH641 points to the dire$tory in +hi$h /ll the S4)PL7PL2# )/ps
d/t/ &iles /re stored.
)APH4!67. spe$i&ies +hi$h inde- &ile is to be /$$essed.
)APHP2L4#4CAL spe$i&ies the d/t/ &ile &or politi$/l bo%nd/ries
#o sele$t the ;ershey shoreline d/t/= set the &ollo+ing entries %nder the 57!71AL
Bey?
)APH4!67. SL4!67..6A#
)APHP2L4#4CAL SLP2L#CL.6A#
#o sele$t the US 5eologi$/l S%rey d/t/?
)APH4!67. 5S4!67..6A#
)APHP2L4#4CAL 5SP2L#CL.6A#
1( S4)PL7PL2# 2'1(

You might also like