home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsd / drawpersp / !DrawPersp / DrawLib (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1995-01-29  |  36.9 KB  |  1,167 lines

  1.  >Module DrawLib
  2. $*|Start PROCshell_DrawCreateFile
  3. shell_DrawCreateFile(
  4.  buffer%)
  5.  creator$,style_blk%,trans_matrix%
  6.  EvntShell drawfiles in memory have a 60 byte 'pre-header' which keeps
  7.  track of current settings. The 'pre-header' must not be saved to disk
  8.  as the file will not be a valid drawfile!
  9.     *buffer% = 
  10. shell_HeapBlockFetch(60+24)
  11. Ibuffer%!00   = -1      :
  12.  Number of current outline font (-1 if none)
  13. :buffer%!04   = 60      :
  14.  Size of EvntShell pre-header
  15. Sbuffer%!08   = 0       :
  16.  File offset to next free address (from start of file)
  17. O|(buffer%+12)=1814.1732:
  18.  Current unit multiplier factor (real nr, 5 bytes)
  19. 1buffer%!20   = 7       :
  20.  Current path colour
  21. 1buffer%!24   = -1      :
  22.  Current fill colour
  23. Nbuffer%!28   = 0       :
  24.  File offset to start of current group definition
  25. 0buffer%!32   = 0       :
  26.  Current path width
  27. -buffer%!36   = 0       :
  28.  Current end cap
  29. Mbuffer%!40   = -1      :
  30.  Number of outline fonts declared   (-1 if none)
  31. Vbuffer%!44   = -1      :
  32.  File offset to start of font table (-1 if no font table)
  33. Ebuffer%!48   = 0       :
  34.  Pointer to path style description block
  35. $buffer%!52   = 0       :
  36.  Unused
  37. G$(buffer% + (buffer%!04))= "Draw"  :
  38.  Required to tag as a drawfile
  39. >buffer%!(buffer%!04 + 4) = 201     :
  40.  Major version number
  41. >buffer%!(buffer%!04 + 8) = 0       :
  42.  Minor version number
  43. W$(buffer% + (buffer%!04 + 12)) = 
  44. shell_StringPadTrailing(
  45. shell_GetAppName," ",11)
  46. Lbuffer%!08 = buffer%!04 + 24       :
  47.  24 is length of DrawFile so far...
  48.  Set extent words of DrawFile to be 0,0,1,1...
  49. shell_DrawPutWord(0,buffer%)
  50. shell_DrawPutWord(0,buffer%)
  51. shell_DrawPutWord(0,buffer%)
  52. shell_DrawPutWord(0,buffer%)
  53. !*buffer%!48 = 
  54. shell_HeapBlockFetch(16)
  55. style_blk% = buffer%!48
  56. style_blk%!00 = 0
  57. style_blk%!04 = 0
  58. style_blk%!08 = 0
  59. style_blk%!12 = 0
  60. '*buffer%!52 = 
  61. shell_HeapBlockFetch(24)
  62. trans_matrix% = buffer%!52
  63. ))trans_matrix%!00 = 1 << 16 :
  64.  x scale
  65. **trans_matrix%!04 = 0       :
  66.  rotation
  67. +*trans_matrix%!08 = 0       :
  68.  rotation
  69. ,)trans_matrix%!12 = 1 << 16 :
  70.  y scale
  71. -3trans_matrix%!16 = 0       :
  72.  x position offset
  73. .3trans_matrix%!20 = 0       :
  74.  y position offset
  75. 0"DRW_PATH_START%    = buffer%!8
  76. DRW_PATH_SCALE_FAC = 1
  77. DRW_PATH_XMIN = 0
  78. DRW_PATH_YMIN = 0
  79. DRW_PATH_XMAX = 0
  80. DRW_PATH_YMAX = 0
  81. 9#*|Stop PROCshell_DrawCreateFile
  82. ;%*|Start PROCshell_DrawOutlineFont
  83. shell_DrawOutlineFont(
  84.  buffer%,text$,ptsize,pthigh,xorigin%,yorigin%)
  85.  start%,ptr%,lx%,by%,rx%,ty%,font%,scl_fac
  86. scl_fac = |(buffer%+12)
  87. font% = !buffer%
  88.  text$ <> "" 
  89. A3  buffer% = 
  90. shell_HeapBlockExtend(buffer%,256)
  91. B#  ptr%    = buffer% + buffer%!8
  92.   start%  = ptr%
  93. D/  !ptr%   =   1              :
  94.  Text object
  95. ED  ptr%    += 24              :
  96.  Skip size, object bounds for now
  97. F$  lx%     = (xorigin% * scl_fac)
  98. G$  by%     = (yorigin% * scl_fac)
  99.  PROCshell_Tracef0("DEBUG::font is "+STR$font%)
  100.  PROCshell_Tracef0("DEBUG::font is "+FNshell_DrawFontName(buffer%,font%))
  101.  "Font_FindFont",,
  102. shell_DrawFontName(buffer%,font%),ptsize * 16, pthigh * 16 
  103.  handle%
  104.  "Font_SetFont",handle%
  105.  "Font_StringBBox",,text$ 
  106.  ,r1%,r2%,r3%,r4%
  107.  "Font_LoseFont",handle%
  108.  PROCshell_Tracef0("DEBUG::r1% = "+STR$r1%)
  109.  PROCshell_Tracef0("DEBUG::r2% = "+STR$r2%)
  110.  PROCshell_Tracef0("DEBUG::r3% = "+STR$r3%)
  111.  PROCshell_Tracef0("DEBUG::r4% = "+STR$r4%)
  112. S&  rx%     = lx% + ((r3%/1000)*640)
  113. T&  ty%     = by% + ((r4%/1000)*640)
  114.  PROCshell_Tracef0("DEBUG::lx%="+STR$lx%)
  115.  PROCshell_Tracef0("DEBUG::by%="+STR$by%)
  116.  PROCshell_Tracef0("DEBUG::rx%="+STR$rx%)
  117.  PROCshell_Tracef0("DEBUG::ty%="+STR$ty%)
  118. shell_DrawPutCoords(start% + 8,lx%,by%,rx%,ty%)
  119. Z'  !ptr%   = buffer%!20   :ptr% += 4
  120. ['  !ptr%   = buffer%!24   :ptr% += 4
  121. \'  !ptr%   = font%        :ptr% += 4
  122. ]'  !ptr%   = ptsize * 640 :ptr% += 4
  123. ^'  !ptr%   = pthigh * 640 :ptr% += 4
  124. _2  !ptr%   = xorigin% * |(buffer%+12):ptr% += 4
  125. `2  !ptr%   = yorigin% * |(buffer%+12):ptr% += 4
  126. shell_DrawPutString(text$,ptr%)
  127.   start%!4 = ptr% - start%
  128. shell_DrawUpdateBounds(buffer%,lx%,by%,rx%,ty%)
  129. d>  buffer% = 
  130. shell_HeapBlockExtend(buffer%,start%!4 - 256)
  131.   buffer%!8 += start%!4
  132. i$*|Stop PROCshell_DrawOutlineFont
  133. k#*|Start PROCshell_DrawPutString
  134. shell_DrawPutString(S$,
  135.  ptr%)
  136. $ptr% = S$
  137. ptr% += 
  138.   ?ptr% = 0
  139.   ptr% += 1
  140.  ptr% 
  141.  4 = 0
  142. u"*|Stop PROCshell_DrawPutString
  143. w#*|Start PROCshell_DrawPutCoords
  144. shell_DrawPutCoords(start%,lx%,by%,rx%,ty%)
  145. start%!00 = lx%
  146. start%!04 = by%
  147. start%!08 = rx%
  148. start%!12 = ty%
  149. "*|Stop PROCshell_DrawPutCoords
  150. &*|Start PROCshell_DrawSetPathWidth
  151. shell_DrawSetPathWidth(buffer%,width)
  152. 1buffer%!32 = 
  153. ((width * |(buffer%+12)) + 0.5)
  154. %*|Stop PROCshell_DrawSetPathWidth
  155. '*|Start PROCshell_DrawSetPathColour
  156. shell_DrawSetPathColour(buffer%,R%,G%,B%)
  157. buffer%?20 = 0
  158. buffer%?21 = R%
  159. buffer%?22 = G%
  160. buffer%?23 = B%
  161. &*|Stop PROCshell_DrawSetPathColour
  162. )*|Start PROCshell_DrawSetPathNoColour
  163. shell_DrawSetPathNoColour(buffer%)
  164. buffer%!20 = -1
  165. (*|Stop PROCshell_DrawSetPathNoColour
  166. '*|Start PROCshell_DrawSetFillColour
  167. shell_DrawSetFillColour(buffer%,R%,G%,B%)
  168. buffer%?24 = 0
  169. buffer%?25 = R%
  170. buffer%?26 = G%
  171. buffer%?27 = B%
  172. &*|Stop PROCshell_DrawSetFillColour
  173. )*|Start PROCshell_DrawSetNoFillColour
  174. shell_DrawSetNoFillColour(buffer%)
  175. buffer%!24 = -1
  176. (*|Stop PROCshell_DrawSetNoFillColour
  177. !*|Start PROCshell_DrawPutWord
  178. shell_DrawPutWord(k%,
  179.  buffer%)
  180.  next%
  181. /buffer% = 
  182. shell_HeapBlockExtend(buffer%,4)
  183.  next% = buffer% + buffer%!08
  184. !next% = k%
  185. buffer%!08 += 4
  186.  *|Stop PROCshell_DrawPutWord
  187. $*|Start PROCshell_DrawStartGroup
  188. shell_DrawStartGroup(
  189.  buffer%,name$)
  190.  next%
  191.  buffer%!28 > 0 
  192. shell_DrawEndGroup(buffer%)
  193. Kbuffer%!28 = buffer%!08:
  194.  Store file offset to current group definition
  195.  PROCshell_Tracef0("DEBUG::bb_offset = "+STR$~buffer%!28)
  196. shell_DrawPutWord(06,buffer%) :
  197.  Object type 6 (group)
  198. shell_DrawPutWord(36,buffer%) :
  199.  Current size of group object
  200. shell_DrawPutWord(-1,buffer%) :
  201.  Bounding box xmin
  202. shell_DrawPutWord(-1,buffer%) :
  203.  Bounding box ymin
  204. shell_DrawPutWord(1,buffer%)  :
  205.  Bounding box xmax
  206. shell_DrawPutWord(1,buffer%)  :
  207.  Bounding box ymax
  208. 0buffer% = 
  209. shell_HeapBlockExtend(buffer%,12)
  210. "next%   = buffer% + buffer%!08
  211. $next%  = name$
  212. Abuffer%!08 += 12 :
  213.  Update file offset to next free address..
  214. #*|Stop PROCshell_DrawStartGroup
  215. "*|Start PROCshell_DrawEndGroup
  216. shell_DrawEndGroup(buffer%)
  217.  start%
  218.  buffer%!28 > 0 
  219. %  start% = buffer% + (buffer%!28)
  220. /  start%!4 = (buffer% + buffer%!8) - start%
  221.   buffer%!28 = 0
  222. !*|Stop PROCshell_DrawEndGroup
  223. %*|Start PROCshell_DrawDestroyFile
  224. shell_DrawDestroyFile(buffer%)
  225. shell_HeapBlockExists(buffer%!48) 
  226. shell_HeapBlockReturn(buffer%!48)
  227. shell_HeapBlockReturn(buffer%)
  228. $*|Stop PROCshell_DrawDestroyFile
  229. "*|Start PROCshell_DrawSaveFile
  230. shell_DrawSaveFile(buffer%,file$)
  231.  Add some error trapping here...
  232. X% = 
  233. (file$)
  234.  PROCshell_Tracef0("DEBUG::size is "+STR$(buffer%!8 - buffer%!4))
  235.  "OS_GBPB",2,X%,buffer% + (buffer%!4),buffer%!8 - buffer%!4
  236. ("SetType "+file$+ " &AFF")
  237. !*|Stop PROCshell_DrawSaveFile
  238.  *|Start FNshell_DrawLoadFile
  239. shell_DrawLoadFile(name$)
  240.  buff%,X%,size%
  241. shell_DrawCreateFile(buff%)
  242. ,buff%!8 -= 40 :
  243.  don't need the header..
  244. $size% = 
  245. shell_FileLength(name$)
  246. /buff% = 
  247. shell_HeapBlockExtend(buff%,size%)
  248. X% = 
  249. (name$)
  250.  "OS_GBPB",4,X%,buff% + buff%!4,size%
  251. buff%!8 = size% + buff%!4
  252. shell_DrawSetScale(buffer%,1,1)
  253. = buff%
  254. *|Stop FNshell_DrawLoadFile
  255. !*|Start PROCshell_DrawEllipse
  256. shell_DrawEllipse(
  257.  buffer%,X,Y,Xm,Ym)
  258.  start%,A,B,C,D,E,K,Xs,Ys
  259. start% = buffer%!8
  260. X  = X  * |(buffer%+12)
  261. Y  = Y  * |(buffer%+12)
  262. Xm = Xm * |(buffer%+12)
  263. Ym = Ym * |(buffer%+12)
  264.  PROCshell_Tracef0("DEBUG::X="+STR$X)
  265.  PROCshell_Tracef0("DEBUG::Y="+STR$Y)
  266.  PROCshell_Tracef0("DEBUG::Xm="+STR$Xm)
  267.  PROCshell_Tracef0("DEBUG::Ym="+STR$Ym)
  268.  Xm >= Ym 
  269.   A = Xm / Xm / 10 + 0.5
  270.  Xm / Ym < 2 
  271.  A = 0.7
  272.  Xm / Ym > 4.5 
  273.  A = 0.95
  274.   Xs = A * Xm
  275. (  Ys = 
  276. (1 - Xs * Xs / Xm / Xm) * Ym
  277.  Ym > Xm 
  278.   A = Ym / Xm / 10 + 0.5
  279.  Ym / Xm < 2 
  280.  A = 0.7
  281.  Ym / Xm > 4.5 
  282.  A = 0.95
  283.   Ys = A * Ym
  284. (  Xs = 
  285. (1 - Ys * Ys / Ym / Ym) * Xm
  286. B = Ym + (Ym - Ys) / 3
  287. %K = Xs * Xs + (B - Ys) * (B - Ys)
  288. .C = (
  289. (4 * Xs * Xs + 12 * K) - 2 * Xs) / 6
  290. D = Xm + (Xm - Xs) / 3
  291. %K = Ys * Ys + (D - Xs) * (D - Xs)
  292. .E = (
  293. (4 * Ys * Ys + 12 * K) - 2 * Ys) / 6
  294. shell_DrawPutWord(2,buffer%)           :
  295.  Object type 2 (path)
  296. shell_DrawPutWord(0,buffer%)           :
  297.  Size of object (dummy value)
  298. shell_DrawPutWord(X - Xm,buffer%):
  299.  Set size of bounding box xmin
  300. shell_DrawPutWord(Y - Ym,buffer%):
  301.  Set size of bounding box ymin
  302. shell_DrawPutWord(X + Xm,buffer%):
  303.  Set size of bounding box xmax
  304. shell_DrawPutWord(Y + Ym,buffer%):
  305.  Set size of bounding box ymax
  306. shell_DrawUpdateBounds(buffer%,X - Xm,Y - Ym,X + Xm,Y + Ym)
  307. shell_DrawPutWord(buffer%!24,buffer%)  :
  308.  Fill colour
  309. shell_DrawPutWord(buffer%!20,buffer%)  :
  310.  Path colour
  311. shell_DrawPutWord(buffer%!32,buffer%)  :
  312.  Path width
  313. shell_DrawPutWord(00,buffer%)          :
  314.  Pattern
  315. shell_DrawPutWord(2,buffer%)           :
  316.  Absolute move
  317. shell_DrawPutWord(X + Xs,buffer%)      :
  318.  x start
  319. shell_DrawPutWord(Y - Ys,buffer%)      :
  320.  y start
  321. shell_DrawPutWord(6,buffer%)
  322. shell_DrawPutWord(X + C,buffer%)
  323. shell_DrawPutWord(Y - B,buffer%)
  324. shell_DrawPutWord(X - C,buffer%)
  325. shell_DrawPutWord(Y - B,buffer%)
  326. shell_DrawPutWord(X - Xs,buffer%)
  327. shell_DrawPutWord(Y - Ys,buffer%)
  328. shell_DrawPutWord(6,buffer%)
  329. shell_DrawPutWord(X - D,buffer%)
  330. shell_DrawPutWord(Y - E,buffer%)
  331. shell_DrawPutWord(X - D,buffer%)
  332. shell_DrawPutWord(Y + E,buffer%)
  333. shell_DrawPutWord(X - Xs,buffer%)
  334. shell_DrawPutWord(Y + Ys,buffer%)
  335. shell_DrawPutWord(6,buffer%)
  336. shell_DrawPutWord(X - C,buffer%)
  337. shell_DrawPutWord(Y + B,buffer%)
  338. shell_DrawPutWord(X + C,buffer%)
  339. shell_DrawPutWord(Y + B,buffer%)
  340. shell_DrawPutWord(X + Xs,buffer%)
  341. shell_DrawPutWord(Y + Ys,buffer%)
  342. shell_DrawPutWord(6,buffer%)
  343. shell_DrawPutWord(X + D,buffer%)
  344. shell_DrawPutWord(Y + E,buffer%)
  345. shell_DrawPutWord(X + D,buffer%)
  346. shell_DrawPutWord(Y - E,buffer%)
  347. shell_DrawPutWord(X + Xs,buffer%)
  348. shell_DrawPutWord(Y - Ys,buffer%)
  349. shell_DrawPutWord(0,buffer%)               :
  350.  End of path
  351. JJ!(buffer% + start% + 4) = buffer%!8 - start%   :
  352.  Store size of object
  353. M *|Stop PROCshell_DrawEllipse
  354. O *|Start PROCshell_DrawCircle
  355. shell_DrawCircle(
  356.  buffer%,X,Y,R)
  357.  start%,A,B,C,style_blk%
  358. style_blk% = buffer%!48
  359. start% = buffer%!8
  360. X = X * |(buffer%+12)
  361. Y = Y * |(buffer%+12)
  362. R = R * |(buffer%+12)
  363. A = R / 
  364. B = A + R / 2.544
  365. C = A - R / 2.544
  366. shell_DrawPutWord(2,buffer%)               :
  367.  Object type 2 (path)
  368. shell_DrawPutWord(0,buffer%)               :
  369.  Size of object (dummy value)
  370. shell_DrawPutWord(X - R,buffer%)           :
  371.  Set size of bounding box xmin
  372. shell_DrawPutWord(Y - R,buffer%)           :
  373.  Set size of bounding box ymin
  374. shell_DrawPutWord(X + R,buffer%)           :
  375.  Set size of bounding box xmax
  376. shell_DrawPutWord(Y + R,buffer%)           :
  377.  Set size of bounding box ymax
  378. shell_DrawUpdateBounds(buffer%,X - R,Y - R,X + R,Y + R)
  379. shell_DrawPutWord(buffer%!24,buffer%)      :
  380.  Fill colour
  381. shell_DrawPutWord(buffer%!20,buffer%)      :
  382.  Path colour
  383. shell_DrawPutWord(buffer%!32,buffer%)      :
  384.  Path width
  385. shell_DrawPutWord(style_blk%!0,buffer%)    :
  386.  Style word
  387.  (style_blk%?0 
  388.  1 << 7) <> 0 
  389. shell_DrawPutWord(style_blk%!04,buffer%) :
  390.  Offset to pattern start
  391. shell_DrawPutWord(style_blk%!08,buffer%) :
  392.  Nr of elements in pattern
  393. shell_DrawPutWord(style_blk%!12,buffer%) :
  394.  Length of dash element
  395. shell_DrawPutWord(2,buffer%)               :
  396.  Absolute move
  397. shell_DrawPutWord(X + A,buffer%)           :
  398.  x start
  399. shell_DrawPutWord(Y - A,buffer%)           :
  400.  y start
  401. shell_DrawPutWord(6,buffer%)
  402. shell_DrawPutWord(X + C,buffer%)
  403. shell_DrawPutWord(Y - B,buffer%)
  404. shell_DrawPutWord(X - C,buffer%)
  405. shell_DrawPutWord(Y - B,buffer%)
  406. shell_DrawPutWord(X - A,buffer%)
  407. shell_DrawPutWord(Y - A,buffer%)
  408. shell_DrawPutWord(6,buffer%)
  409. shell_DrawPutWord(X - B,buffer%)
  410. shell_DrawPutWord(Y - C,buffer%)
  411. shell_DrawPutWord(X - B,buffer%)
  412. shell_DrawPutWord(Y + C,buffer%)
  413. shell_DrawPutWord(X - A,buffer%)
  414. shell_DrawPutWord(Y + A,buffer%)
  415. shell_DrawPutWord(6,buffer%)
  416. shell_DrawPutWord(X - C,buffer%)
  417. shell_DrawPutWord(Y + B,buffer%)
  418. shell_DrawPutWord(X + C,buffer%)
  419. shell_DrawPutWord(Y + B,buffer%)
  420. shell_DrawPutWord(X + A,buffer%)
  421. shell_DrawPutWord(Y + A,buffer%)
  422. shell_DrawPutWord(6,buffer%)
  423. shell_DrawPutWord(X + B,buffer%)
  424. shell_DrawPutWord(Y + C,buffer%)
  425. shell_DrawPutWord(X + B,buffer%)
  426. shell_DrawPutWord(Y - C,buffer%)
  427. shell_DrawPutWord(X + A,buffer%)
  428. shell_DrawPutWord(Y - A,buffer%)
  429. shell_DrawPutWord(0,buffer%)               :
  430.  End of path
  431. J!(buffer% + start% + 4) = buffer%!8 - start%   :
  432.  Store size of object
  433. *|Stop PROCshell_DrawCircle
  434. *|Start PROCshell_DrawBox
  435. shell_DrawBox(
  436.  buffer%,x0,y0,width,height)
  437.  start%,scl_fac
  438. start% = buffer%!8
  439. scl_fac = |(buffer%+12)
  440. x0     = x0     * scl_fac
  441. y0     = y0     * scl_fac
  442. width  = width  * scl_fac
  443. height = height * scl_fac
  444. shell_DrawPutWord(2,buffer%)          :
  445.  Object type 2 (path)
  446. shell_DrawPutWord(0,buffer%)          :
  447.  Size of object (dummy value)
  448. shell_DrawPutWord(x0,buffer%)         :
  449.  Set size of bounding box xmin
  450. shell_DrawPutWord(y0,buffer%)         :
  451.  Set size of bounding box ymin
  452. shell_DrawPutWord(x0 + width,buffer%) :
  453.  Set size of bounding box xmax
  454. shell_DrawPutWord(y0 + height,buffer%):
  455.  Set size of bounding box ymax
  456. shell_DrawUpdateBounds(buffer%,x0,y0,x0 + width,y0 + height)
  457. shell_DrawPutWord(buffer%!24,buffer%) :
  458.  Fill colour
  459. shell_DrawPutWord(buffer%!20,buffer%) :
  460.  Path colour
  461. shell_DrawPutWord(buffer%!32,buffer%) :
  462.  Path width
  463. shell_DrawPutWord(00,buffer%)         :
  464.  Pattern
  465. shell_DrawPutWord(02,buffer%)         :
  466.  Absolute move
  467. shell_DrawPutWord(x0,buffer%)         :
  468.  x start
  469. shell_DrawPutWord(y0,buffer%)         :
  470.  y start
  471. shell_DrawPutWord(08,buffer%)         :
  472.  Draw to absolute position
  473. shell_DrawPutWord(x0,buffer%)
  474. shell_DrawPutWord(y0 + height,buffer%)
  475. shell_DrawPutWord(08,buffer%)
  476. shell_DrawPutWord(x0 + width,buffer%)
  477. shell_DrawPutWord(y0 + height,buffer%)
  478. shell_DrawPutWord(08,buffer%)
  479. shell_DrawPutWord(x0 + width,buffer%)
  480. shell_DrawPutWord(y0,buffer%)
  481. shell_DrawPutWord(08,buffer%)
  482. shell_DrawPutWord(x0,buffer%)
  483. shell_DrawPutWord(y0,buffer%)
  484. shell_DrawPutWord(00,buffer%)           :
  485.  End of path
  486. G!(buffer% + start% + 4) = buffer%!8 - start%:
  487.  Store size of object
  488. *|Stop PROCshell_DrawBox
  489.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  490.  Path Object
  491.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  492. **|Start PROCshell_DrawUpdateObjectBBox
  493. shell_DrawUpdateObjectBBox( buffer%, x_coord, y_coord )
  494.  x_coord < DRW_PATH_XMIN 
  495.  DRW_PATH_XMIN = x_coord
  496.  x_coord > DRW_PATH_XMAX 
  497.  DRW_PATH_XMAX = x_coord
  498.  y_coord < DRW_PATH_YMIN 
  499.  DRW_PATH_YMIN = y_coord
  500.  y_coord > DRW_PATH_YMAX 
  501.  DRW_PATH_YMAX = y_coord
  502. 7!( buffer% + DRW_PATH_START% + 08 ) = DRW_PATH_XMIN
  503. 7!( buffer% + DRW_PATH_START% + 12 ) = DRW_PATH_YMIN
  504. 7!( buffer% + DRW_PATH_START% + 16 ) = DRW_PATH_XMAX
  505. 7!( buffer% + DRW_PATH_START% + 20 ) = DRW_PATH_YMAX
  506. )*|Stop PROCshell_DrawUpdateObjectBBox
  507. #*|Start PROCshell_DrawPathStart
  508. shell_DrawPathStart( 
  509.  buffer%, x_coord, y_coord )
  510.  Set up Module Globals..
  511. "DRW_PATH_START%    = buffer%!8
  512. *DRW_PATH_SCALE_FAC = |( buffer% + 12 )
  513. *x_coord = x_coord * DRW_PATH_SCALE_FAC
  514. *y_coord = y_coord * DRW_PATH_SCALE_FAC
  515.  DRW_PATH_XMIN = x_coord
  516.  DRW_PATH_YMIN = x_coord
  517.  DRW_PATH_XMAX = y_coord
  518.  DRW_PATH_YMAX = y_coord
  519. DRW_PATH_XMIN = x_coord
  520. DRW_PATH_YMIN = y_coord
  521. DRW_PATH_XMAX = -&7FFFFFFF
  522. DRW_PATH_YMAX = -&7FFFFFFF
  523. shell_DrawPutWord( 2,buffer% )  :
  524.  Object type 2 (path)
  525. shell_DrawPutWord( 0,buffer% )  :
  526.  Size of object (dummy value)
  527. shell_DrawPutWord( DRW_PATH_XMIN, buffer% ) :
  528.  Set size of bounding box xmin
  529. shell_DrawPutWord( DRW_PATH_YMIN, buffer% ) :
  530.  Set size of bounding box ymin
  531. shell_DrawPutWord( DRW_PATH_XMAX, buffer% ) :
  532.  Set size of bounding box xmax
  533. shell_DrawPutWord( DRW_PATH_YMAX, buffer% ) :
  534.  Set size of bounding box ymax
  535. shell_DrawPutWord( buffer%!24, buffer% ) :
  536.  Fill colour
  537. shell_DrawPutWord( buffer%!20, buffer% ) :
  538.  Path colour
  539. shell_DrawPutWord( buffer%!32, buffer% ) :
  540.  Path width
  541. shell_DrawPutWord( 00,buffer% )          :
  542.  Pattern
  543. shell_DrawPutWord( 02,buffer% )          :
  544.  Absolute move
  545. shell_DrawPutWord( x_coord, buffer% )    :
  546.  x start
  547. shell_DrawPutWord( y_coord, buffer% )    :
  548.  y start
  549. !*Stop PROCshell_DrawPathStart
  550. $*|Start PROCshell_DrawPathDrawTo
  551. shell_DrawPathDrawTo( 
  552.  buffer%, x_coord, y_coord )
  553. shell_DrawPutWord( 08, buffer% ) :
  554.  Draw to absolute position
  555. *x_coord = x_coord * DRW_PATH_SCALE_FAC
  556. *y_coord = y_coord * DRW_PATH_SCALE_FAC
  557. shell_DrawPutWord( x_coord, buffer% )
  558. shell_DrawPutWord( y_coord, buffer% )
  559. shell_DrawUpdateObjectBBox( buffer%, x_coord, y_coord )
  560. "*Stop PROCshell_DrawPathDrawTo
  561. !*|Start PROCshell_DrawPathEnd
  562. shell_DrawPathEnd( 
  563.  buffer% )
  564. shell_DrawPutWord( 00, buffer% )
  565.  Store size of object..
  566. D!( buffer% + DRW_PATH_START% + 4 ) = buffer%!8 - DRW_PATH_START%
  567. shell_DrawUpdateBounds( buffer%, DRW_PATH_XMIN, DRW_PATH_YMIN, DRW_PATH_XMAX, DRW_PATH_YMAX )
  568. *Stop PROCshell_DrawPathEnd
  569.     '*|Start PROCshell_DrawPathCloseLine
  570. shell_DrawPathCloseLine( 
  571.  buffer% )
  572. shell_DrawPutWord( 05, buffer% )
  573. shell_DrawPutWord( 00, buffer% )
  574.  Store size of object..
  575. D!( buffer% + DRW_PATH_START% + 4 ) = buffer%!8 - DRW_PATH_START%
  576. shell_DrawUpdateBounds( buffer%, DRW_PATH_XMIN, DRW_PATH_YMIN, DRW_PATH_XMAX, DRW_PATH_YMAX )
  577. %*Stop PROCshell_DrawPathCloseLine
  578. &*|Start PROCshell_DrawUpdateBounds
  579. shell_DrawUpdateBounds(buffer%,x0,y0,x1,y1)
  580.  bb_start%
  581. #bb_start% = buffer% + buffer%!4
  582.  x0 > x1 
  583.  x0,x1
  584.  y0 > y1 
  585.  y0,y1
  586.  (bb_start% + 32) = 0 
  587.  !(bb_start% + 36) = 0 
  588.   !(bb_start% + 24) = x0
  589.   !(bb_start% + 28) = y0
  590.   !(bb_start% + 32) = x1
  591.   !(bb_start% + 36) = y1
  592.  x0 < !(bb_start% + 24) 
  593.  !(bb_start% + 24) = x0
  594.  y0 < !(bb_start% + 28) 
  595.  !(bb_start% + 28) = y0
  596.  x1 > !(bb_start% + 32) 
  597.  !(bb_start% + 32) = x1
  598.  y1 > !(bb_start% + 36) 
  599.  !(bb_start% + 36) = y1
  600.  buffer%!28 > 0 
  601. shell_DrawUpdateGroupBounds(buffer%,x0,y0,x1,y1)
  602. .%*|Stop PROCshell_DrawUpdateBounds
  603. 0+*|Start PROCshell_DrawUpdateGroupBounds
  604. shell_DrawUpdateGroupBounds(buffer%,x0,y0,x1,y1)
  605.  bb_start%
  606. 3$bb_start% = buffer% + buffer%!28
  607.  PROCshell_Tracef0("DEBUG::bb_offset = "+STR$~buffer%!28)
  608.  PROCshell_Tracef0("DEBUG::current x0 = "+STR$(!(bb_start% + 08)))
  609.  !(bb_start% + 08) = -1 
  610.   !(bb_start% + 08) = x0
  611.  x0 < !(bb_start% + 08) 
  612.  !(bb_start% + 08) = x0
  613.  !(bb_start% + 12) = -1 
  614.   !(bb_start% + 12) = y0
  615.  y0 < !(bb_start% + 12) 
  616.  !(bb_start% + 12) = y0
  617.  x1 > !(bb_start% + 16) 
  618.  !(bb_start% + 16) = x1
  619.  y1 > !(bb_start% + 20) 
  620.  !(bb_start% + 20) = y1
  621.  PROCshell_Tracef0("DEBUG::x0 = "+STR$x0)
  622.  PROCshell_Tracef0("DEBUG::y0 = "+STR$y0)
  623.  PROCshell_Tracef0("DEBUG::x1 = "+STR$x1)
  624.  PROCshell_Tracef0("DEBUG::y1 = "+STR$y1)
  625.  PROCshell_Tracef0("")
  626.  PROCshell_Tracef0("DEBUG::x0 = "+STR$(!(bb_start%+8)))
  627. J**|Stop PROCshell_DrawUpdateGroupBounds
  628. *|Start PROCshell_DrawLine
  629. shell_DrawLine(
  630.  buffer%,x0,y0,x1,y1)
  631.  start%,pat_blk%,scl_fac,style_blk%,p_width%,cap_width%,cap_len%
  632.  cap_width2%,cap_len2%,bbox_xmin,bbox_xmax,bbbox_ymin,bbox_ymax
  633. scl_fac = |(buffer%+12)
  634. start% = buffer%!8
  635. SHx0 = x0 * scl_fac :
  636.  Convert to draw units using stored scale factor
  637. y0 = y0 * scl_fac
  638. x1 = x1 * scl_fac
  639. y1 = y1 * scl_fac
  640. p_width%   = buffer%!32
  641. style_blk% = buffer%!48
  642.  x0 > x1 
  643.   bbox_xmin = x1
  644.   bbox_xmax = x0
  645.   bbox_xmin = x0
  646.   bbox_xmax = x1
  647.  y0 > y1 
  648.   bbox_ymin = y1
  649.   bbox_ymax = y0
  650.   bbox_ymin = y0
  651.   bbox_ymax = y1
  652.  PROCshell_Tracef0("DEBUG:: "+STR$(style_blk%?0 AND (1 << 2)))
  653.  PROCshell_Tracef0("DEBUG:: "+STR$(style_blk%?0 AND (1 << 3)))
  654.  (style_blk%?0 
  655.  %1100) 
  656.  (style_blk%?0 
  657.  %110000) <> 0 
  658.  Triangular end caps on the path, check the widths..
  659.  (style_blk%?0 
  660.  %1100) 
  661. n9    cap_width% = style_blk%?2:
  662.  1/16ths of path width
  663. o9    cap_len%   = style_blk%?3:
  664.  1/16ths of path width
  665. p3    cap_width% = (cap_width% * (p_width% / 16))
  666. q3    cap_len%   = (cap_len%   * (p_width% / 16))
  667.  (style_blk%?0 
  668.  %110000) 
  669. t:    cap_width2% = style_blk%?4:
  670.  1/16ths of path width
  671. u:    cap_len2%   = style_blk%?5:
  672.  1/16ths of path width
  673. v5    cap_width2% = (cap_width2% * (p_width% / 16))
  674. w5    cap_len2%   = (cap_len2%   * (p_width% / 16))
  675.  cap_width2% > cap_width% 
  676.  cap_width% = cap_width2%
  677.  cap_len2%   > cap_len%   
  678.  cap_len%   = cap_len2%
  679.  PROCshell_Tracef0("DEBUG:: cap_width% = "+STR$cap_width%)
  680.  PROCshell_Tracef0("DEBUG:: cap_len%   = "+STR$cap_len%)
  681. shell_DrawPutWord(2,buffer%)               :
  682.  Object type 2 (path)
  683. shell_DrawPutWord(0,buffer%)               :
  684.  Size of object (dummy value)
  685. shell_DrawPutWord(bbox_xmin-cap_len%,buffer%)                :
  686.  Set size of bounding box xmin
  687. shell_DrawPutWord(bbox_ymin-(p_width%/2)-cap_width%,buffer%) :
  688.  Set size of bounding box ymin
  689. shell_DrawPutWord(bbox_xmax+cap_len%,buffer%)                :
  690.  Set size of bounding box xmax
  691. shell_DrawPutWord(bbox_ymax+(p_width%/2)+cap_width%,buffer%) :
  692.  Set size of bounding box ymax
  693. shell_DrawUpdateBounds(buffer%,x0,y0,x1,y1):
  694.  Update DrawFile bounding box
  695. shell_DrawPutWord(buffer%!24,buffer%)      :
  696.  Fill colour (-1 = do not fill)
  697. shell_DrawPutWord(buffer%!20,buffer%)      :
  698.  Path colour (-1 = no outline)
  699. shell_DrawPutWord(buffer%!32,buffer%)      :
  700.  Path width
  701. shell_DrawPutWord(style_blk%!0,buffer%)    :
  702.  Style word
  703.  (style_blk%?0 
  704.  1 << 7) <> 0 
  705. shell_DrawPutWord(style_blk%!04,buffer%) :
  706.  Offset to pattern start
  707. shell_DrawPutWord(style_blk%!08,buffer%) :
  708.  Nr of elements in pattern
  709. shell_DrawPutWord(style_blk%!12,buffer%) :
  710.  Length of dash element
  711. shell_DrawPutWord(02,buffer%)              :
  712.  Absolute move
  713. shell_DrawPutWord(x0,buffer%)              :
  714.  x start
  715. shell_DrawPutWord(y0,buffer%)              :
  716.  y start
  717. shell_DrawPutWord(08,buffer%)              :
  718.  Draw to absolute position
  719. shell_DrawPutWord(x1,buffer%)              :
  720.  x finish
  721. shell_DrawPutWord(y1,buffer%)              :
  722.  y finish
  723. shell_DrawPutWord(00,buffer%)              :
  724.  End of path
  725. J!(buffer% + start% + 4) = buffer%!8 - start%   :
  726.  Store size of object
  727. *|Stop PROCshell_DrawLine
  728. !*|Start PROCshell_DrawSetFont
  729. shell_DrawSetFont(buffer%,font$)
  730.  ft_start%,ft_end%,f_handle%,ptr%,name$,found%
  731. found%    = 
  732. f_handle% = 0
  733.  font$ = "" 
  734. -  !buffer% = 0 :
  735.  Font 0 is system font..
  736.  Search font table to find internal font handle of requested font
  737.   ft_start% = buffer%!44
  738.  ft_start% = -1 
  739.  99,"No fonts have been initialised for this drawfile"
  740. F  ft_start% += buffer% :
  741.  Now points to start of font table object
  742.  PROCshell_Tracef0("DEBUG::font table size is = "+STR$(ft_start%!4))
  743. *  ft_end%    = ft_start%!4 + ft_start%
  744.    ptr%       = ft_start% + 8
  745. &    ft_handle% = ?ptr% : ptr% += 1
  746. &    name$ = 
  747. shell_GetString(ptr%)
  748. V    
  749.  PROCshell_Tracef0("DEBUG::font name found ("+STR$ft_handle%+") '"+name$+"'")
  750.     ptr% += 
  751. name$ + 1
  752.  ptr% 
  753.  4 <> 0
  754.       ptr% +=1
  755.         
  756.  name$ = font$ 
  757. )      found% = 
  758.  : ptr% = ft_end% + 1
  759. R      
  760.  PROCshell_Tracef0("DEBUG::font name match, handle is "+STR$ft_handle%)
  761.         
  762. 0      
  763.  PROCshell_Tracef0("DEBUG::NO MATCH")
  764.         
  765.  ptr% >= ft_end%
  766.  found% 
  767.   !buffer% = ft_handle%
  768.  PROCshell_Tracef0("DEBUG::Setting font handle to "+STR$(!buffer%))
  769.  99,"Font '"+font$+"' has not been initialised"
  770.  *|Stop PROCshell_DrawSetFont
  771. "*|Start PROCshell_DrawInitFont
  772. shell_DrawInitFont(
  773.  buffer%,font_name$)
  774.  ft_start%,ptr%,def_start%
  775. shell_FontIsAvailable(font_name$,12,12) 
  776. 6  buffer%    = 
  777. shell_HeapBlockExtend(buffer%,256)
  778. B  ptr%       = buffer% + buffer%!8   :
  779.  Next address in file..
  780.   def_start% = ptr%
  781.  buffer%!40 = -1 
  782. J    
  783.  This routine hasn't been called before, so create new font table
  784. T    buffer%!44 = buffer%!8           :
  785.  Store file offset to start of font table
  786. D    !ptr% = 0:ptr% += 4              :
  787.  Create font table object
  788. D    !ptr% = 0:ptr% += 4              :
  789.  Skip object size for now
  790. ?    buffer%!40 = 0                   :
  791.  Nr of defined fonts
  792. J  ft_start% = buffer% + buffer%!44   :
  793.  Start of font table definition
  794. @  buffer%!40 += 1                    :
  795.  Increment font count
  796. T  ?ptr% = buffer%!40                 :
  797.  Store internal font handle (starts at 1)
  798. F  $(ptr%+1) = font_name$             :
  799.  Store textual name of font
  800.   ptr% += 
  801. (font_name$) + 2
  802. G  ?(ptr% - 1) = 0                    :
  803.  Terminate name with CHR$(0)
  804.  ptr% 
  805.  4 <> 0              :
  806.  Pad with trailing spaces to a word boundary
  807.     ?ptr% = 0
  808.     ptr% += 1
  809. L  ft_start%!04   = ptr% - ft_start%  :
  810.  Update size of font table object
  811. C  buffer%!08 += ptr% - def_start%    :
  812.  Update size of DrawFile
  813.  Finally shrink heap block..
  814. H  buffer% = 
  815. shell_HeapBlockExtend(buffer%,(ptr% - ft_start%) - 256)
  816. h  void% = 
  817. shell_MessageWindow(
  818. shell_MessageOneArg("SHELLMSG31",font_name$),0,
  819. shell_GetAppName,"")
  820. !*|Stop PROCshell_DrawInitFont
  821. $*|Start PROCshell_DrawSetUnitsMM
  822. shell_DrawSetUnitsMM(buffer%)
  823. |(buffer% + 12) = 1814.1732
  824. #*|Stop PROCshell_DrawSetUnitsMM
  825. $*|Start PROCshell_DrawSetUnitsCM
  826. shell_DrawSetUnitsCM(buffer%)
  827. |(buffer% + 12) = 18141.732
  828. #*|Stop PROCshell_DrawSetUnitsCM
  829. $*|Start PROCshell_DrawSetUnitsIN
  830. shell_DrawSetUnitsIN(buffer%)
  831. |(buffer% + 12) = 46080
  832. #*|Stop PROCshell_DrawSetUnitsIN
  833. $*|Start PROCshell_DrawSetUnitsOS
  834. shell_DrawSetUnitsOS(buffer%)
  835. |(buffer% + 12) = 256
  836. #*|Stop PROCshell_DrawSetUnitsOS
  837. $*|Start PROCshell_DrawSetUnitsPT
  838. shell_DrawSetUnitsPT(buffer%)
  839. |(buffer% + 12) = 640
  840. #*|Stop PROCshell_DrawSetUnitsPT
  841. (*|Start PROCshell_DrawSetPathPattern
  842. shell_DrawSetPathPattern(buffer%,dashed%,offset,nr_el%,len)
  843.  pat_blk%,scl_fac
  844. pat_blk% = buffer%!48
  845. scl_fac  = |(buffer% + 12)
  846. $pat_blk%?0 = pat_blk%?0 
  847.  1 << 7
  848.  dashed% = 0 
  849. &  pat_blk%?0 = pat_blk%?0 
  850.  1 << 7
  851. "pat_blk%!04 = offset * scl_fac
  852. pat_blk%!08 = nr_el%
  853. "pat_blk%!12 = len    * scl_fac
  854. '*|Stop PROCshell_DrawSetPathPattern
  855. (*|Start PROCshell_DrawGetBoundingBox
  856. shell_DrawGetBoundingBox(buffer%,
  857.  xpos,
  858.  ypos,
  859.  width,
  860.  height,os_units%)
  861.  drawfile_start%,drawfile_size%,bbox_blk%,trans_matrix%,div%
  862. *drawfile_start%  = buffer% + buffer%!4
  863. ,drawfile_size%   = buffer%!8 - buffer%!4
  864. !trans_matrix%    = buffer%!52
  865. trans_matrix%!20 = 0
  866. trans_matrix%!24 = 0
  867. ")bbox_blk% = 
  868. shell_HeapBlockFetch(16)
  869.  os_units% <> 0 
  870.  div% = 256 
  871.  div% = 1
  872.  "DrawFile_BBox",0,drawfile_start%,drawfile_size%,trans_matrix%,bbox_blk%
  873. %"xpos   = (bbox_blk%!00) / div%
  874. &"ypos   = (bbox_blk%!04) / div%
  875. '0width  = (bbox_blk%!08 - bbox_blk%!00)/ div%
  876. (0height = (bbox_blk%!12 - bbox_blk%!04)/ div%
  877. shell_HeapBlockReturn(bbox_blk%)
  878. +'*|Stop PROCshell_DrawGetBoundingBox
  879. -#*|Start FNshell_DrawGetFileSize
  880. shell_DrawGetFileSize(buffer%)
  881. = buffer%!8 - buffer%!4
  882. 1"*|Stop FNshell_DrawGetFileSize
  883. 3 *|Start FNshell_DrawFontName
  884. shell_DrawFontName(ptr%,font%)
  885.  ft_table%,ft_end%,df_start%,font$,p%,ft_handle%,found%
  886.  ptr%!44 = -1 
  887.  99,"No fonts have been initialised for this drawfile"
  888. df_start%  = ptr% + ptr%!4
  889. ft_table%  = ptr%!44 + ptr%
  890.  PROCshell_Tracef0("DEBUG::ft_table% = &"+STR$~ft_table%)
  891.  PROCshell_Tracef0("DEBUG::df_start% = &"+STR$~df_start%)
  892.  font% = 0 
  893.   font$ = "System Font"
  894.  PROCshell_Tracef0("DEBUG::font table size is = "+STR$(ft_table%!4))
  895. ?*  ft_end%    = ft_table%!4 + ft_table%
  896. @   p%         = ft_table% + 8
  897. B"    ft_handle% = ?p% : p% += 1
  898. C$    font$ = 
  899. shell_GetString(p%)
  900.     p%   += 
  901. font$ + 1
  902.  4 <> 0
  903.       p% +=1
  904. G        
  905.  ft_handle% = font% 
  906. I'      found% = 
  907.  : p% = ft_end% + 1
  908. J        
  909.   p% >= ft_end%
  910.  found% = 0 
  911.  99,"Font not found in font table"
  912. = font$
  913. *|Stop FNshell_DrawFontName
  914.  Font routines
  915. T!*|Start FNshell_FontGetHandle
  916. shell_FontGetHandle(font$,x,y)
  917.  font%
  918.  "Font_FindFont",,font$,x * 16,y * 16,0,0 
  919.  font%
  920. = font%
  921. Z *|Stop FNshell_FontGetHandle
  922. \$*|Start PROCshell_FontForgetFont
  923. shell_FontForgetFont(font%)
  924.  "Font_LoseFont",font%
  925. a#*|stop PROCshell_FontForgetFont
  926. c#*|start PROCshell_FontSetColour
  927. shell_FontSetColour(fore%,back%)
  928.  "ColourTrans_SetFontColours",0,back%,fore%,14
  929. h"*|stop PROCshell_FontSetColour
  930. j$*|Start PROCshell_DrawRenderFile
  931. shell_DrawRenderFile(buffer%,x%,y%,q%,bound%)
  932.  drawsc%,draw%,drawlen%
  933.  bound%=-1 
  934.  bound% = 1 
  935.  bound% = 0
  936. drawsc%  = buffer%!52
  937. o"draw%    = buffer% + buffer%!4
  938. p$drawlen% = buffer%!8 - buffer%!4
  939. drawsc%!16 = x% * 256
  940. drawsc%!20 = y% * 256
  941.  "DrawFile_Render",bound%,draw%,drawlen%,drawsc%,q% + 28
  942. drawsc%!16 = 0
  943. drawsc%!20 = 0
  944. x#*|Stop PROCshell_DrawRenderFile
  945.  *|Start PROCshell_DrawRenderFile
  946.  DEF PROCshell_DrawRenderFile(buffer%,x%,y%,x_scl,y_scl,q%,bound%)
  947.  LOCAL drawsc%,draw%,drawlen%
  948.  IF bound%=-1 THEN bound% = 1 ELSE bound% = 0
  949.  drawsc%  = FNshell_HeapBlockFetch(24)
  950.  draw%    = buffer% + buffer%!4
  951.  drawlen% = buffer%!8 - buffer%!4
  952.  !drawsc% = INT(65536 * x_scl)
  953.  drawsc%!04 = 0
  954.  drawsc%!08 = 0
  955.  drawsc%!12 = INT(65536 * y_scl)
  956.  drawsc%!16 = x% * 256
  957.  drawsc%!20 = y% * 256
  958.  SYS "DrawFile_Render",bound%,draw%,drawlen%,drawsc%,q% + 28
  959.  PROCshell_HeapBlockReturn(drawsc%)
  960.  ENDPROC
  961.  *|Stop PROCshell_DrawRenderFile
  962. #*|Start PROCshell_DrawTextSpace
  963. shell_DrawTextSpace(ptr%,text$,font%,ptsize,pthigh,
  964.  lx%,
  965.  by%,
  966.  rx%,
  967.  ty%)
  968.  handle%,xscale%,yscale%,r1%,r2%,r3%,r4%
  969.  font% > 0 
  970.  "Font_FindFont",,
  971. shell_DrawFontName(ptr%,font%),ptsize * 16, pthigh * 16 
  972.  handle%
  973.  "Font_SetFont",handle%
  974.  "Font_StringBBox",,text$ 
  975.  ,r1%,r2%,r3%,r4%
  976.  "Font_ReadScaleFactor" 
  977.  ,xscale%,yscale%
  978.  "Font_LoseFont",handle%
  979. 1  ty% = 
  980. shell_DrawTextCoord(by%,r4%,yscale%)
  981. 1  rx% = 
  982. shell_DrawTextCoord(lx%,r3%,xscale%)
  983. 1  by% = 
  984. shell_DrawTextCoord(by%,r2%,yscale%)
  985. 1  lx% = 
  986. shell_DrawTextCoord(lx%,r1%,xscale%)
  987. )  rx% = lx% + ptsize * 2.5 * 
  988. (text$)
  989.   ty% = by% + pthigh * 2.5
  990. "*|Stop PROCshell_DrawTextSpace
  991. !*|Start FNshell_DrawTextCoord
  992. shell_DrawTextCoord(v%,r%,scale%) = (v% * scale% + r% +scale% / 2) / scale%
  993.  *|Stop FNshell_DrawTextCoord
  994. '*|Start PROCshell_DrawSetEndCapNone
  995. shell_DrawSetEndCapNone(buffer%)
  996.  style_blk%
  997. style_blk% = buffer%!48
  998. 6style_blk%?0 = style_blk%?0  
  999.  1 << 2 :
  1000.  set bit 2
  1001. 6style_blk%?0 = style_blk%?0  
  1002.  1 << 3 :
  1003.  set bit 3
  1004. 7style_blk%?0 = style_blk%?0 
  1005.  1 << 2 :
  1006.  unset bit 2
  1007. 7style_blk%?0 = style_blk%?0 
  1008.  1 << 3 :
  1009.  unset bit 3
  1010. &*|Stop PROCshell_DrawSetEndCapNone
  1011. (*|Start PROCshell_DrawSetEndCapRound
  1012. shell_DrawSetEndCapRound(buffer%)
  1013.  style_blk%
  1014. style_blk% = buffer%!48
  1015. 6style_blk%?0 = style_blk%?0  
  1016.  1 << 2 :
  1017.  set bit 2
  1018. 6style_blk%?0 = style_blk%?0  
  1019.  1 << 3 :
  1020.  set bit 3
  1021. 7style_blk%?0 = style_blk%?0 
  1022.  1 << 3 :
  1023.  unset bit 3
  1024. '*|Stop PROCshell_DrawSetEndCapRound
  1025. )*|Start PROCshell_DrawSetEndCapSquare
  1026. shell_DrawSetEndCapSquare(buffer%)
  1027.  style_blk%
  1028. style_blk% = buffer%!48
  1029. 6style_blk%?0 = style_blk%?0  
  1030.  1 << 2 :
  1031.  set bit 2
  1032. 6style_blk%?0 = style_blk%?0  
  1033.  1 << 3 :
  1034.  set bit 3
  1035. 7style_blk%?0 = style_blk%?0 
  1036.  1 << 2 :
  1037.  unset bit 2
  1038. (*|Stop PROCshell_DrawSetEndCapSquare
  1039. +*|Start PROCshell_DrawSetEndCapTriangle
  1040. shell_DrawSetEndCapTriangle(buffer%,width%,len%)
  1041.  style_blk%,path_width%
  1042. !path_width% = buffer%!32 / 16
  1043. style_blk%  = buffer%!48
  1044. %width% = width% * |(buffer% + 12)
  1045. %len%   = len%   * |(buffer% + 12)
  1046. 6style_blk%?0 = style_blk%?0  
  1047.  1 << 2 :
  1048.  set bit 2
  1049. 6style_blk%?0 = style_blk%?0  
  1050.  1 << 3 :
  1051.  set bit 3
  1052. 'style_blk%?2 = width% / path_width%
  1053. 'style_blk%?3 = len%   / path_width%
  1054.  PROCshell_Tracef0("DEBUG:: path width is "+STR$path_width%)
  1055. **|Stop PROCshell_DrawSetEndCapTriangle
  1056. )*|Start PROCshell_DrawSetStartCapNone
  1057. shell_DrawSetStartCapNone(buffer%)
  1058.  style_blk%
  1059. style_blk% = buffer%!48
  1060. 6style_blk%?0 = style_blk%?0  
  1061.  1 << 4 :
  1062.  set bit 4
  1063. 6style_blk%?0 = style_blk%?0  
  1064.  1 << 5 :
  1065.  set bit 5
  1066. 7style_blk%?0 = style_blk%?0 
  1067.  1 << 4 :
  1068.  unset bit 4
  1069. 7style_blk%?0 = style_blk%?0 
  1070.  1 << 5 :
  1071.  unset bit 5
  1072. (*|Stop PROCshell_DrawSetStartCapNone
  1073. **|Start PROCshell_DrawSetStartCapRound
  1074. shell_DrawSetStartCapRound(buffer%)
  1075.  style_blk%
  1076. style_blk% = buffer%!48
  1077. 6style_blk%?0 = style_blk%?0  
  1078.  1 << 4 :
  1079.  set bit 4
  1080. 6style_blk%?0 = style_blk%?0  
  1081.  1 << 5 :
  1082.  set bit 5
  1083. 7style_blk%?0 = style_blk%?0 
  1084.  1 << 5 :
  1085.  unset bit 5
  1086. )*|Stop PROCshell_DrawSetStartCapRound
  1087. +*|Start PROCshell_DrawSetStartCapSquare
  1088. shell_DrawSetStartCapSquare(buffer%)
  1089.  style_blk%
  1090. style_blk% = buffer%!48
  1091. 6style_blk%?0 = style_blk%?0  
  1092.  1 << 4 :
  1093.  set bit 4
  1094. 6style_blk%?0 = style_blk%?0  
  1095.  1 << 5 :
  1096.  set bit 5
  1097. 7style_blk%?0 = style_blk%?0 
  1098.  1 << 4 :
  1099.  unset bit 4
  1100. **|Stop PROCshell_DrawSetStartCapSquare
  1101. -*|Start PROCshell_DrawSetStartCapTriangle
  1102. shell_DrawSetStartCapTriangle(buffer%,width%,len%)
  1103.  style_blk%,path_width%
  1104. style_blk%  = buffer%!48
  1105. !path_width% = buffer%!32 / 16
  1106. %width% = width% * |(buffer% + 12)
  1107. %len%   = len%   * |(buffer% + 12)
  1108. 6style_blk%?0 = style_blk%?0  
  1109.  1 << 4 :
  1110.  set bit 4
  1111. 6style_blk%?0 = style_blk%?0  
  1112.  1 << 5 :
  1113.  set bit 5
  1114. 'style_blk%?2 = width% / path_width%
  1115. 'style_blk%?3 = len%   / path_width%
  1116.  PROCshell_Tracef0("DEBUG:: path width is "+STR$path_width%)
  1117.     ,*|Stop PROCshell_DrawSetStartCapTriangle
  1118. "*|Start PROCshell_DrawSetScale
  1119. shell_DrawSetScale(buffer%,xscl,yscl)
  1120.  matrix%
  1121. matrix%    = buffer%!52
  1122.  matrix%!00 = 
  1123. (65536 * xscl)
  1124.  matrix%!12 = 
  1125. (65536 * yscl)
  1126. !*|Stop PROCshell_DrawSetScale
  1127. "*|Start PROCshell_DrawGetScale
  1128. shell_DrawGetScale(buffer%,
  1129.  xscl,
  1130.  yscl)
  1131.  matrix%
  1132. matrix% = buffer%!52
  1133.  xscl    = matrix%!00 / 65536
  1134.  yscl    = matrix%!12 / 65536
  1135. !*|Stop PROCshell_DrawGetScale
  1136. &*|Start PROCshell_DrawResizeWindow
  1137. shell_DrawResizeWindow(buffer%,wh%,lm%,bm%,rm%,tm%)
  1138.  xpos,ypos,width,height
  1139. shell_DrawGetBoundingBox(buffer%,xpos,ypos,width,height,
  1140. shell_WindowResize(wh%,0,- (tm% + bm% + height + ypos),width + lm% + rm%,0,0)
  1141. &%*|Stop PROCshell_DrawResizeWindow
  1142. ('*|Start PROCshell_DrawScaleToWindow
  1143. shell_DrawScaleToWindow(buffer%,wh%,lm%,bm%,rm%,tm%,
  1144.  xscl,
  1145.  yscl)
  1146.  xpos,ypos,width,height,w_blk%,w_width%,w_height%,o_xscl,o_yscl
  1147. shell_DrawSetScale(buffer%,o_xscl,o_yscl)
  1148. shell_DrawSetScale(buffer%,1,1)
  1149. shell_DrawGetBoundingBox(buffer%,xpos,ypos,width,height,
  1150. .'w_blk%  = 
  1151. shell_HeapBlockFetch(36)
  1152. !w_blk% = wh%
  1153.  "Wimp_GetWindowState",,w_blk%
  1154. 1Aw_width%  = (w_blk%!12 - w_blk%!04 + w_blk%!20) - (lm% + rm%)
  1155. 2Aw_height% = (w_blk%!16 - w_blk%!08 + w_blk%!24) - (tm% + bm%)
  1156. 3*xscl      = (w_width%  / (width  - 0))
  1157. 4*yscl      = (w_height% / (height - 0))
  1158.  PROCshell_Tracef0(">>> "+STR$w_width%)
  1159.  PROCshell_Tracef0(">>> "+STR$width)
  1160.  PROCshell_Tracef0(">>> "+STR$w_height%)
  1161.  PROCshell_Tracef0(">>> "+STR$height)
  1162.  PROCshell_Tracef0(">>> xscl "+STR$xscl)
  1163.  PROCshell_Tracef0(">>> yscl "+STR$yscl)
  1164. shell_HeapBlockReturn(w_blk%)
  1165. shell_DrawSetScale(buffer%,o_xscl,o_yscl)
  1166. ?&*|Stop PROCshell_DrawScaleToWindow
  1167.