the demos show rotating the offset which places the object at that angle
but does not change its orientation.
Here is what I came up with but it only flips it no rotation.
I tried using the gdi32 function setworldtransformation but I could not get it to accept my array?
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%clf%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%crlf%
// 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
SRT>invXY
' inverting y flips object no rotation
let>dl_2=%dl_2%*-1
let>dl_1=%dl_1%
END>invXY
SRT>orgXY
' original x y
let>dl_2=%dl_2%
let>dl_1=%dl_1%
END>orgXY
let>dl_1={round(%dl_1%*%scale%)}
let>dl_2={round(%dl_2%*%scale%)}
let>dxs=%xOffset%+%dl_1%
let>dys=%yOffset%+%dl_2%
Repeat>b
Let>b=b+1
Separate>dline_%b%,%c%,dl
'orgXY or invXY
GoSub>orgXY
let>dl_1={round(%dl_1%*%scale%)}
let>dl_2={round(%dl_2%*%scale%)}
Wait>%delay%
let>Flag=%dl_3%
if>Flag<3>16777215,color
let>dxs=%xOffset%+%dl_1%
let>dys=%yOffset%+%dl_2%
let>dxe=%dxs%
let>dye=%dys%
else
let>dxe=%xOffset%+%dl_1%
let>dye=%yOffset%+%dl_2%
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