Difference between revisions of "FigureShape"
From Xojo Documentation
Line 20: | Line 20: | ||
{{Method | name=AddCurve | params=Curve as [[CurveShape]] | description=AddCurve(Curve as CurveShape)
Adds the passed CurveShape to the figure. }} | {{Method | name=AddCurve | params=Curve as [[CurveShape]] | description=AddCurve(Curve as CurveShape)
Adds the passed CurveShape to the figure. }} | ||
{{Method | name=AddCurveAt | params=Index as [[Integer]], Curve as [[CurveShape]] | description=AddCurveAt(Index as Integer, Curve as CurveShape)
Adds the passed CurveShape at the position indicated by Index. }} | {{Method | name=AddCurveAt | params=Index as [[Integer]], Curve as [[CurveShape]] | description=AddCurveAt(Index as Integer, Curve as CurveShape)
Adds the passed CurveShape at the position indicated by Index. }} | ||
− | {{Method | name= | + | {{Method | name=RemoveCurveAt | params=Index as [[Integer]] | description=RemoveCurveAt(Index as Integer )
Removes a curve, specified either by its index or by reference. }} |
− | {{Method | name= | + | {{Method | name=RemoveCurve | params=Curve as [[CurveShape]] | description=RemoveCurve(Curve as CurveShape)
Removes a curve, specified either by its index or by reference. }} |
</dynamicTable> | </dynamicTable> | ||
Line 27: | Line 27: | ||
A figure is formed by drawing each curve it contains in order, joining the endpoint of one to the starting point of the next. The figure is degenerate if doing so does not enclose any area. This will be the case for a figure containing only one line, for example. The appearance of a degenerate figure is undefined. | A figure is formed by drawing each curve it contains in order, joining the endpoint of one to the starting point of the next. The figure is degenerate if doing so does not enclose any area. This will be the case for a figure containing only one line, for example. The appearance of a degenerate figure is undefined. | ||
− | AddLine, AddCubic, and AddQuad are convenience methods that make it easier to add curves to the figure. You could instead create your own [[CurveShape|CurveShapes]], and add them with the | + | [[FigureShape.AddLine|AddLine]], [[FigureShape.AddCubic|AddCubic]], and [[FigureShape.AddQuad|AddQuad]] are convenience methods that make it easier to add curves to the figure. You could instead create your own [[CurveShape|CurveShapes]], and add them with the [[FigureShape.AddCurve|AddCurve]] or [[FigureShape.AddCurveAt|AddCurveAt]] methods. |
==Examples== | ==Examples== |
Latest revision as of 18:17, 14 July 2020
Used to draw vector graphic shapes composed of lines and curves. It is similar to a polygon except that a “side” may be curved. A figure consists of a set of CurveShapes, with the end point of one curve automatically joined to the starting point of the next.
Properties | |||||||||||
|
Methods | |||||||
|
Notes
A figure is formed by drawing each curve it contains in order, joining the endpoint of one to the starting point of the next. The figure is degenerate if doing so does not enclose any area. This will be the case for a figure containing only one line, for example. The appearance of a degenerate figure is undefined.
AddLine, AddCubic, and AddQuad are convenience methods that make it easier to add curves to the figure. You could instead create your own CurveShapes, and add them with the AddCurve or AddCurveAt methods.
Examples
The following example draws a triangle. The code is placed in the Paint event of a Window or Canvas.
fx.AddLine(0, 100, 50, 0)
fx.AddLine(50, 0, -50, 0)
fx.Border = 100 // opaque border
fx.BorderColor = &cFF0000 // red border
fx.FillColor = &cFFFF00 // yellow interior
g.DrawObject(fx, 100, 100)
See Also
ArcShape, CurveShape, FolderItem, Graphics, Group2D, Object2D, OvalShape, Picture, PixmapShape, RectShape, RoundRectShape, TextShape classes.