Class
Object2D
Description
The base class of any object that can be drawn in a vector graphics environment.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
Property descriptions
Object2D.BorderColor
BorderColor As Color
The color of the object's border.
Object2D.BorderOpacity
BorderOpacity As Double
Indicates the level of opacity.
Degrees of transparency is currently supported only on macOS and Windows. On other platforms, the border is either visible (100%) or invisible.
The following code adds a border to an Object2S:
Var a As New Object2D
a.BorderOpacity = 100
g.DrawObject(a)
Object2D.BorderWidth
BorderWidth As Double
The width of the border, in points. The default is 1.
The width a Double value with a default of 1.0.
Object2D.FillColor
FillColor As Color
The color of the interior of the shape.
Object2D.FillOpacity
FillOpacity As Double
The opacity of the interior, from 0 (completely transparent) to 100 (opaque).
This example sets the Fill to 50% opacity.
Var a As New Object2D
a.BorderOpacity = 100
a.BorderColor = Color.Black
a.BorderWidth = 2.75
a.FillOpacity = 50
a.FillColor = Color.Red
g.DrawObject(a)
Object2D.Rotation
Rotation As Double
Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.
This code rotates the shape 0.9 radians.
Var a As New Object2D
a.Rotation = 0.90
a.BorderOpacity = 100
a.BorderColor = Color.Black
a.BorderWidth = 2.75
g.DrawObject(a)
Object2D.Scale
Scale As Double
The scaling factor relative to the object's original size.
The following code rescales the arc by a factor of 1.5.
Var a As New Object2D
a.Scale = 1.5
a.Rotation = .90
a.BorderOpacity = 100
a.BorderColor = Color.Black
a.BorderWidth = 2.75
g.DrawObject(a)
Object2D.X
X As Double
The horizontal position of the center or main anchor point.
This example sets the horizontal position to 100 pixels from the left of the containing Canvas.
Var a As New Object2D
a.X = 100
a.BorderOpacity = 100
a.BorderColor = Color.Black
g.DrawObject(a)
Object2D.Y
Y As Double
The vertical position (down from top) position of the center or anchor point.
This example moves the position of the object down 100 pixels from the top of the containing Canvas.
Var a As New Object2D
a.Y = 100
a.BorderOpacity = 100
a.BorderColor = Color.Black
g.DrawObject(a)
Notes
Object2D is the base class for a group of subclasses that enable you to create vector (as opposed to bitmap) graphics. The subclasses are shown in the following table:
Class |
Description |
---|---|
Draws an arc of a circle. |
|
Draws straight lines or curves using one or more "control points." |
|
Draws polygons that can (optionally) have curved sides. |
|
Draws circles and ovals. |
|
Imports a bitmap picture into the image. |
|
Draws a square or rectangle. |
|
Draws a square or rectangle with rounded corners. |
|
Draws text in a specified font, font size, and style. |
These basic shapes can be organized into a hierarchy using the Group2D class.
The Picture class has a property, Objects, that enables you to include a vector graphics drawing (a Group2D object) in a picture and the Graphics class has a new method, DrawObject, that enables you to draw a Group2D object within the Graphics object. Also, the Save method of the Picture class has an optional parameter that enables you to save a vector graphics picture in a format that retains the vector information. The OpenAsVectorPicture method of the FolderItem class attempts to open an existing image as a vector graphic and map the contents of the image into Object2D drawing primitives.
Compatibility
Desktop and web project types on all supported operating systems.
See also
Object parent class; ArcShape, CurveShape, FigureShape, FolderItem, Graphics, Group2D, OvalShape, Picture, PixmapShape, RectShape, RoundRectShape, TextShape classes.