Class

# Object2D

<div class="rst-class">

forsearch

</div>

Shape

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The base class of any object that can be drawn in a vector graphics environment.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                    | Type                             | Read-Only | Shared |
|-----------------------------------------|----------------------------------|-----------|--------|
| `BorderColor<object2d.bordercolor>`     | `Color</api/data_types/color>`   |           |        |
| `BorderOpacity<object2d.borderopacity>` | `Double</api/data_types/double>` |           |        |
| `BorderWidth<object2d.borderwidth>`     | `Double</api/data_types/double>` |           |        |
| `FillColor<object2d.fillcolor>`         | `Color</api/data_types/color>`   |           |        |
| `FillOpacity<object2d.fillopacity>`     | `Double</api/data_types/double>` |           |        |
| `Rotation<object2d.rotation>`           | `Double</api/data_types/double>` |           |        |
| `Scale<object2d.scale>`                 | `Double</api/data_types/double>` |           |        |
| `X<object2d.x>`                         | `Double</api/data_types/double>` |           |        |
| `Y<object2d.y>`                         | `Double</api/data_types/double>` |           |        |

## Property descriptions

<div id="object2d.bordercolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.BorderColor

**BorderColor** As `Color</api/data_types/color>`

> The color of the object's border.

<div id="object2d.borderopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.BorderOpacity

**BorderOpacity** As `Double</api/data_types/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 \`Object2D\`:
>
> ``` xojo
> Var a As New Object2D
> a.BorderOpacity = 100
> g.DrawObject(a)
> ```

<div id="object2d.borderwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.BorderWidth

**BorderWidth** As `Double</api/data_types/double>`

> The width of the border, in points. The default is 1.
>
> The width a `Double</api/data_types/double>` value with a default of 1.0.

<div id="object2d.fillcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.FillColor

**FillColor** As `Color</api/data_types/color>`

> The color of the interior of the shape.

<div id="object2d.fillopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.FillOpacity

**FillOpacity** As `Double</api/data_types/double>`

> The opacity of the interior, from 0 (completely transparent) to 100 (opaque).
>
> This example sets the Fill to 50% opacity.
>
> ``` xojo
> 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)
> ```

<div id="object2d.rotation">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.Rotation

**Rotation** As `Double</api/data_types/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.
>
> ``` xojo
> Var a As New Object2D
> a.Rotation = 0.90
> a.BorderOpacity = 100
> a.BorderColor = Color.Black
> a.BorderWidth = 2.75
> g.DrawObject(a)
> ```

<div id="object2d.scale">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.Scale

**Scale** As `Double</api/data_types/double>`

> The scaling factor relative to the object's original size.
>
> The following code rescales the object by a factor of 1.5.
>
> ``` xojo
> 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)
> ```

<div id="object2d.x">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.X

**X** As `Double</api/data_types/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</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var a As New Object2D
> a.X = 100
> a.BorderOpacity = 100
> a.BorderColor = Color.Black
> g.DrawObject(a)
> ```

<div id="object2d.y">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Object2D.Y

**Y** As `Double</api/data_types/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</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var a As New Object2D
> a.Y = 100
> a.BorderOpacity = 100
> a.BorderColor = Color.Black
> g.DrawObject(a)
> ```

## Notes

<span class="title-ref">Object2D</span> 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                                                        |
|------------------------------------------------|--------------------------------------------------------------------|
| `ArcShape</api/graphics/arcshape>`             | Draws an arc of a circle.                                          |
| `CurveShape</api/graphics/curveshape>`         | Draws straight lines or curves using one or more "control points." |
| `FigureShape</api/graphics/figureshape>`       | Draws polygons that can (optionally) have curved sides.            |
| `OvalShape</api/graphics/ovalshape>`           | Draws circles and ovals.                                           |
| `PixmapShape</api/graphics/pixmapshape>`       | Imports a bitmap picture into the image.                           |
| `RectShape</api/graphics/rectshape>`           | Draws a square or rectangle.                                       |
| `RoundRectShape</api/graphics/roundrectshape>` | Draws a square or rectangle with rounded corners.                  |
| `TextShape</api/graphics/textshape>`           | Draws text in a specified font, font size, and style.              |

These basic shapes can be organized into a hierarchy using the `Group2D</api/graphics/group2d>` class.

The `Picture</api/graphics/picture>` class has a property, Objects, that enables you to include a vector graphics drawing (a `Group2D</api/graphics/group2d>` object) in a picture and the `Graphics</api/graphics/graphics>` class has a new method, DrawObject, that enables you to draw a `Group2D</api/graphics/group2d>` object within the `Graphics</api/graphics/graphics>` object. Also, the Save method of the `Picture</api/graphics/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</api/files/folderitem>` class attempts to open an existing image as a vector graphic and map the contents of the image into <span class="title-ref">Object2D</span> drawing primitives.

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `ArcShape</api/graphics/arcshape>`, `CurveShape</api/graphics/curveshape>`, `FigureShape</api/graphics/figureshape>`, `FolderItem</api/files/folderitem>`, `Graphics</api/graphics/graphics>`, `Group2D</api/graphics/group2d>`, `OvalShape</api/graphics/ovalshape>`, `Picture</api/graphics/picture>`, `PixmapShape</api/graphics/pixmapshape>`, `RectShape</api/graphics/rectshape>`, `RoundRectShape</api/graphics/roundrectshape>`, `TextShape</api/graphics/textshape>` classes.

</div>
