Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/Clipper/Clipper Offset Test
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/Clipper/Clipper Offset Test
This example is the version from Fri, 4th Jan 2018.
Project "Clipper Offset Test.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() dim p as new Picture(Width, Height, 32) dim subj as new ClipperPathMBS dim solution as ClipperPathsMBS subj.Append new ClipperPointMBS(348,257) subj.Append new ClipperPointMBS(364,148) subj.Append new ClipperPointMBS(362,148) subj.Append new ClipperPointMBS(326,241) subj.Append new ClipperPointMBS(295,219) subj.Append new ClipperPointMBS(258,88) subj.Append new ClipperPointMBS(440,129) subj.Append new ClipperPointMBS(370,196) subj.Append new ClipperPointMBS(372,275) const EndTypeClosedPolygon = 0 const JoinTypeRound = 1 dim co as new ClipperOffsetMBS co.AddPath(subj, JoinTypeRound, EndTypeClosedPolygon) co.Execute(solution, -7.0) DrawPolygon(p.graphics, subj, &c888888) dim solution0 as ClipperPathMBS = solution.Value(0) dim solution1 as ClipperPathMBS = solution.Value(1) 'dim values0() as ClipperPointMBS = solution0.Values 'dim values1() as ClipperPointMBS = solution1.Values //draw solution ... DrawPolygon(p.graphics, solution0, &c4000FF) DrawPolygon(p.graphics, solution1, &cFF0099) Backdrop = p End EventHandler
Sub DrawPolygon(g as graphics, p as ClipperPathMBS, c as color) dim coordinates(0) as integer dim points() as ClipperPointMBS = p.Values for each point as ClipperPointMBS in points coordinates.Append point.x coordinates.Append point.y next g.ForeColor = c g.FillPolygon coordinates End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Tools Plugin.

MBS Xojo Chart Plugins