I took some liberties with your original script removing things for clarity while testing that I did not put back. I don't know if this will be of use to you but I put time and effort in so I'll post it in case there is some tidbit our descendants might find useful.
I have not had time to look at what you created. Looks interesting. I'll have to look up the new API calls to see what they do
Code: Select all
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
Let>scaleD=1
Let>xmax=100
Let>ymax=50
Let>xmin=100
Let>ymin=50
//sample File Data - Lettering: T Font: monotype Corsiva
let>dxdyData=0,0,3%crlf%0,0,3%crlf%0,0,195%crlf%0.7,-5.4,193%crlf%1.4,-10.8,193%crlf%1.9,-16.1,193%crlf%1.9,-16.1,3%crlf%1.8,-16.2,3%crlf%2.9,-16.2,3%crlf%3.7,-15.4,3%crlf%4,-14.3,3%crlf%4,-13.2,3%crlf%3.9,-12.1,3%crlf%4.7,-11.1,3%crlf%4,-11.4,3%crlf%3.9,-12.5,3%crlf%3.9,-14,3%crlf%3.7,-15.4,3%crlf%2.8,-16.2,3%crlf%1.3,-16.5,3%crlf%1.7,-15.5,3%crlf%1.6,-16.7,3%crlf%2.1,-15.6,3%crlf%2,-16.8,3%crlf%2.3,-15.7,3%crlf%2.5,-16.8,3%crlf%2.5,-15.8,3%crlf%3,-16.7,3%crlf%2.7,-15.7,3%crlf%3.5,-16.4,3%crlf%2.9,-15.6,3%crlf%3.8,-16.1,3%crlf%3.1,-15.4,3%crlf%4.1,-15.7,3%crlf%3.3,-15.2,3%crlf%4.4,-15.2,3%crlf%3.4,-14.9,3%crlf%4.5,-14.8,3%crlf%3.4,-14.6,3%crlf%4.5,-14.3,3%crlf%3.4,-14.3,3%crlf%4.6,-13.9,3%crlf%3.4,-14,3%crlf%4,-13.6,3%crlf%3.9,-12.5,3%crlf%4,-11.4,3%crlf%4.8,-11.1,3%crlf%4.8,-10.7,3%crlf%4.9,-11.6,3%crlf%4.7,-10.6,3%crlf%4.8,-11.7,3%crlf%4.2,-10.6,3%crlf%4.5,-11.7,3%crlf%3.6,-11.1,3%crlf%4.4,-11.7,3%crlf%3.4,-11.7,3%crlf%4.4,-11.9,3%crlf%3.4,-12.2,3%crlf%4.4,-12.1,3%crlf%3.4,-12.6,3%crlf%4.4,-12.4,3%crlf%3.4,-13,3%crlf%4.5,-12.7,3%crlf%3.4,-13.4,3%crlf%4.5,-13.1,3%crlf%3.4,-13.7,3%crlf%4.5,-13.5,3%crlf%3.4,-14,3%crlf%3,-13.5,3%crlf%1.4,-13.9,3%crlf%0.2,-14.2,3%crlf%-0.2,-14.1,3%crlf%1.4,-13.7,3%crlf%3.3,-13.6,3%crlf%2.4,-13.8,3%crlf%1.4,-14.1,3%crlf%-0.5,-13.7,3%crlf%-0.4,-15.2,3%crlf%-0.2,-13.6,3%crlf%0.2,-14.2,3%crlf%1.1,-14,3%crlf%2.1,-13.7,3%crlf%3.3,-13.4,3%crlf%3.7,-14,3%crlf%3.6,-12.7,3%crlf%3.3,-14.1,3%crlf%3.2,-12.8,3%crlf%3,-14.2,3%crlf%2.9,-12.8,3%crlf%2.7,-14.3,3%crlf%2.6,-12.9,3%crlf%2.4,-14.3,3%crlf%2.3,-13,3%crlf%2.1,-14.4,3%crlf%2,-13.1,3%crlf%1.8,-14.5,3%crlf%1.7,-13.2,3%crlf%1.5,-14.6,3%crlf%1.3,-13.2,3%crlf%1.2,-14.7,3%crlf%1,-13.3,3%crlf%0.8,-14.7,3%crlf%0.7,-13.4,3%crlf%0.5,-14.8,3%crlf%0.4,-13.5,3%crlf%0.2,-14.9,3%crlf%0.1,-13.6,3%crlf%-0.1,-15,3%crlf%-0.2,-13.6,3%crlf%-0.1,-15,3%crlf%-0.6,-14.9,3%crlf%-0.3,-15.3,3%crlf%-1.2,-15.4,3%crlf%-0.1,-14.9,3%crlf%-1.1,-15,3%crlf%-0.2,-14.5,3%crlf%-1.1,-14.6,3%crlf%-0.2,-14,3%crlf%-1.2,-14.3,3%crlf%-0.3,-13.7,3%crlf%-1.2,-13.8,3%crlf%-0.2,-13.2,3%crlf%-1.2,-13.3,3%crlf%-0.2,-13.1,3%crlf%-1.2,-13.3,3%crlf%-0.2,-13.2,3%crlf%-1.2,-13.3,3%crlf%-0.2,-13.1,3%crlf%-1.2,-13.3,3%crlf%-1.2,-13.3,195%crlf%0.9,-10.7,193
// arrow with right triangle and left square
'let>dxdyData=0,0,3%crlf%0,5,3%crlf%0,25,3%crlf%10,5,3%crlf%10,3,3%crlf%9,3,3%crlf%10,5,3%crlf%-10,5,3%crlf%-10,3,3%crlf%-9,3,3%crlf%-9,5,3%crlf%-10,5,3%crlf%0,25,3
Dialog>Dialog1
object Dialog1: TForm
Left = 247
Top = 94
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Redraw File'
ClientHeight = 500
ClientWidth = 500
Color = clWhite
Ctl3D = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poDesktopCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,OnClose,Quit
GDP>Dialog1,,ClientHeight,Wy
GDP>Dialog1,,ClientWidth,Wx
Let>winX=%Wx%/2
Let>winY=%Wy%/2
Let>delay=0.05
Show>Dialog1
Separate>%dxdyData%,%crlf%,dline
let>c=,
let>st=0
Let>b=1
If>scaleD=1
Let>scale={(%Wx%-10)/(%xmax%+%xmin%)}
Else
Let>scale={(%Wy%-10)/(%ymax%+%ymin%)}
Endif
Let>scale={(round(%scale%*10))/10}
'scale for testing
let>scale=4
'Draw bounding box = to extents
'rect
let>ulx={(%winX%)-(%xmax%)}
Let>uly={(%winY%)-(%ymax%)}
let>lrx={(%winX%)+(%xmin%)}
Let>lry={(%winY%)+(%ymin%)}
GoSub>DrawRectangle,Dialog1.handle,1,0,14547193,ulx,uly,lrx,lry
let>xOffset={(%winX%)-(%xmax%-%xmin%)}
let>yOffset={(%winY%)-(%ymax%-%ymin%)}
Separate>dline_%b%,%c%,dl
Separate>dline_%b%,%c%,org
//I wasn't sure what the offset calculation was supposed to accomplish so I
//defined offsets for testing purposes
Let>xOffset=winx
Let>yOffset=winy
let>dl_1={%dl_1%*%scale%}
//Reverse y polarity at the start
let>dl_2={(%dl_2%*%scale%)*-1}
//Rotate coordinates clock Wise
//Is Quad I, To Quad II
If>{(%dl_1%>0)and(%dl_2%>0)}
Let>dxs={(%dl_2%*-1)+%xoffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad II, To Quad III
If>{(%dl_1%<0)and(%dl_2%>0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad III, To Quad IV
If>{(%dl_1%<0)and(%dl_2%<0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad IV, To Quad I
If>{(%dl_1%>0)and(%dl_2%<0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
EndIf
EndIf
EndIf
EndIf
//Deal with zeros should they occur
If>dl_1=0
Let>dxs=%dl_2%+%xoffset%
Let>dys={(%dl_1%*-1)+%yOffset%}
EndIf
If>dl_2=0
Let>dys=%dl_1%+%yoffset%
Let>dxs={(%dl_2%*-1)+%xOffset%}
EndIf
//Return Y polarity back to original
Let>dys={((%dys%-%yoffset%)*-1)+%yOffset%}
Repeat>b
Let>b=b+1
Separate>dline_%b%,%c%,dl
Separate>dline_%b%,%c%,org
let>dl_1={%dl_1%*%scale%}
let>dl_2={(%dl_2%*%scale%)*-1}
let>Flag=%dl_3%
if>Flag<>3
Random>16777215,color
//Is Quad I, To Quad II
If>{(%dl_1%>0)and(%dl_2%>0)}
Let>dxs={(%dl_2%*-1)+%xoffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad II, To Quad III
If>{(%dl_1%<0)and(%dl_2%>0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad III, To Quad IV
If>{(%dl_1%<0)and(%dl_2%<0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
Else
//Is Quad IV, To Quad I
If>{(%dl_1%>0)and(%dl_2%<0)}
Let>dxs={(%dl_2%*-1)+%xOffset%}
Let>dys=%dl_1%+%yOffset%
EndIf
EndIf
EndIf
EndIf
If>dl_1=0
Let>dxs=%dl_2%+%xoffset%
Let>dys={(%dl_1%*-1)+%yOffset%}
EndIf
If>dl_2=0
Let>dys=%dl_1%+%yoffset%
Let>dxs={(%dl_2%*-1)+%xOffset%}
EndIf
Let>dys={((%dys%-%yoffset%)*-1)+%yOffset%}
let>dxe=%dxs%
let>dye=%dys%
else
//Is Quad I, To Quad II
If>{(%dl_1%>0)and(%dl_2%>0)}
Let>dxe={(%dl_2%*-1)+%xoffset%}
Let>dye=%dl_1%+%yOffset%
Else
//Is Quad II, To Quad III
If>{(%dl_1%<0)and(%dl_2%>0)}
Let>dxe={(%dl_2%*-1)+%xOffset%}
Let>dye=%dl_1%+%yOffset%
Else
//Is Quad III, To Quad IV
If>{(%dl_1%<0)and(%dl_2%<0)}
Let>dxe={(%dl_2%*-1)+%xOffset%}
Let>dye=%dl_1%+%yOffset%
Else
//Is Quad IV, To Quad I
If>{(%dl_1%>0)and(%dl_2%<0)}
Let>dxe={(%dl_2%*-1)+%xOffset%}
Let>dye=%dl_1%+%yOffset%
EndIf
EndIf
EndIf
EndIf
If>dl_1=0
Let>dxe=%dl_2%+%xoffset%
Let>dye={(%dl_1%*-1)+%yOffset%}
EndIf
If>dl_2=0
Let>dye=%dl_1%+%yoffset%
Let>dxe={(%dl_2%*-1)+%xOffset%}
EndIf
Let>dye={((%dye%-%yoffset%)*-1)+%yOffset%}
wait>0
Let>dys={round(%dys%)}
Let>dxs={round(%dxs%)}
Let>dye={round(%dye%)}
Let>dxe={round(%dxe%)}
GoSub>DrawLine,Dialog1.handle,1,color,dxs,dys,dxe,dye
let>dxs=%dxe%
let>dys=%dye%
endif
Until>b,%dline_count%
let>MSG_HEIGHT=100
Let>MSG_WIDTH=200
Let>MSG_XPOS=600
Let>MSG_YPOS=500
MessageModal>Done
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd
SRT>DrawLine
LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
LibFunc>gdi32,DeleteObject,DOres,Penres
LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine
//DrawRectangle Usage:
//GoSub>DrawRectangle,WindowHandle,PenSize,PenColor,SolidColor,ULXLocation,ULYLocation,LRXLocation,LRYLocation
SRT>DrawRectangle
LibFunc>user32,GetDC,HDC,%DrawRectangle_var_1%
LibFunc>gdi32,CreatePen,Penres,0,%DrawRectangle_var_2%,%DrawRectangle_var_3%
LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
LibFunc>gdi32,CreateSolidBrush,SBres,%DrawRectangle_var_4%
LibFunc>gdi32,SelectObject,SOres,hdc,sbres
LibFunc>gdi32,Rectangle,recres,hdc,%DrawRectangle_var_5%,%DrawRectangle_var_6%,%DrawRectangle_var_7%,%DrawRectangle_var_8%
LibFunc>gdi32,DeleteObject,DOres,Penres
LibFunc>gdi32,DeleteObject,DOres,sbres
LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawRectangle
SRT>Quit
Exit>0
END>Quit