Class

ArcShape


Description

Used for drawing arcs in a vector graphics environment.

Methods

Name

Parameters

Returns

Shared

Contains

X As Double, Y As Double

Boolean

Property descriptions


ArcShape.ArcAngle

ArcAngle As Double

The angle of the arc, in radians.

The following method, when called from the Paint event of a Window, creates an arc.

Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.BorderColor

BorderColor As Color

The color of the object's border.


ArcShape.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 ArcShape:

Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.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.


ArcShape.FillColor

FillColor As Color

The color of the interior of the shape.


ArcShape.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 ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.FillOpacity = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.Height

Height As Double

The height of the rectangle.

This example sets the height and width of the shape to 150 pixels.

Var r As New RectShape
r.Width = 150
r.Height = 150
r.Border = 100
r.BorderColor = Color.RGB(0, 0, 0) // black
r.FillColor = Color.RGB(0, 127, 127) // teal
r.BorderWidth = 2.5
r.Rotation = -0.78
g.DrawObject(r, 100, 100)

ArcShape.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 arc 0.9 radians.

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.Rotation = 0.90
a.arcAngle = 1.57
a.startAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.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 ArcShape
a.Scale = 1.5
a.Rotation = .90
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.Segments

Segments As Integer

The number of polygon sides to use when approximation is needed. Zero means it's up to the renderer.

This example specifies the number of segments to use.

Var o As New OvalShape
o.Width = 60
o.Height = 120
o.Segments = 5
o.FillColor = Color.RGB(127, 127, 255)
g.DrawObject(o, o.Width, o.Height)

ArcShape.StartAngle

StartAngle As Double

The starting angle, in radians.

This code sets the starting angle to -1.57 radians:

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.Rotation = 0.90
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor = Color.RGB(255,0,127)
g.DrawObject(a, 100, 100)

ArcShape.Width

Width As Double

The width of the rectangle.

This example sets the Width to 150 pixels.

Var r As New RectShape
r.Width = 150
r.Height = 150
r.Border = 100
r.BorderColor = Color.RGB(0, 0, 0) // black
r.FillColor = Color.RGB(0, 127, 127) // teal
r.BorderWidth = 2.5
r.Rotation = -0.78
g.DrawObject(r, 100, 100)

ArcShape.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 ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.X = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

ArcShape.Y

Y As Double

The vertical position (down from top) position of the center or anchor point.

This example moves the position of the arc down 100 pixels from the top of the containing Canvas.

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Y = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

Method descriptions


ArcShape.Contains

Contains(X As Double, Y As Double) As Boolean

Tests whether the object contains the point X, Y. Returns True if the rectangle contains the point specified by X, Y.

This code tests whether the RectShape contains the passed point:

Var r As New RectShape
r.Width = 75
r.Height = 75
r.Border = 100
r.Bordercolor = Color.RGB(0, 0, 0) // black
r.FillColor = Color.RGB(0, 127, 127) // teal
r.BorderWidth = 2.5
r.Rotation = -0.78
If r.Contains(50, 50) Then
  // draw something here..
End If
g.DrawObject(r, 100, 100)

Notes

A StartAngle of 0 means due east, i.e., a positive X value with Y = 0. Positive angles are clockwise, just as with Object2D rotation. The value of ArcAngle can be positive or negative, extending from the starting angle. If the angle is filled, it produces a wedge; this may be useful for making pie charts, for example.

The radius of the arc is determined by its Width and Height properties. These are inherited from RectShape. The default values of Width and Height are 100 pixels. This means that the default value of the radius is 100/2 = 50 pixels.

For ArcShape, BorderOpacity defaults to 0.

Sample code

The following method, when called from the Paint event of a Window, creates an arc.

Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

Compatibility

Desktop and web project types on all supported operating systems.