# OfficeShape

Dependency-free vector shape descriptor shared by OfficeIMO document packages. Dimensions are expressed in the caller's layout unit, such as points for PDF.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeShape.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L10)

**Modifiers**

sealed

Dependency-free vector shape descriptor shared by OfficeIMO document packages. Dimensions are expressed in the caller's layout unit, such as points for PDF.

## Inheritance

- object
- OfficeShape

## Usage

Explore 12 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 8

- Property [OfficeDrawingShape.Shape](/api/core/officeimo-drawing-officedrawingshape/#property-shape)
- Method [OfficeShape.Clone](/api/core/officeimo-drawing-officeshape/#method-clone)
- Method [OfficeShape.Ellipse](/api/core/officeimo-drawing-officeshape/#method-ellipse-double-double)
- Method [OfficeShape.Line](/api/core/officeimo-drawing-officeshape/#method-line-double-double-double-double)
- Method [OfficeShape.Path](/api/core/officeimo-drawing-officeshape/#method-path-officeimo-drawing-officepathcommand)
- Method [OfficeShape.Polygon](/api/core/officeimo-drawing-officeshape/#method-polygon-officeimo-drawing-officepoint)
- Method [OfficeShape.Rectangle](/api/core/officeimo-drawing-officeshape/#method-rectangle-double-double)
- Method [OfficeShape.RoundedRectangle](/api/core/officeimo-drawing-officeshape/#method-roundedrectangle-double-double-double)

### Accepted by parameters 4

- Method [OfficeDrawing.AddShape](/api/core/officeimo-drawing-officedrawing/#method-addshape-officeimo-drawing-officeshape-double-double) parameter `shape`
- Method [OfficeDrawing.AddShapeBehindContent](/api/core/officeimo-drawing-officedrawing/#method-addshapebehindcontent-officeimo-drawing-officeshape-double-double) parameter `shape`
- Constructor [OfficeDrawingShape.OfficeDrawingShape](/api/core/officeimo-drawing-officedrawingshape/#constructor-ctor-officeimo-drawing-officeshape-double-double) parameter `shape`
- Method [OfficeShapePresets.TryCreate](/api/core/officeimo-drawing-officeshapepresets/#method-trycreate-string-double-double-boolean-boolean-officeimo-drawing-officeshape) parameter `shape`

Filter members 

Show inherited

## Constructors

`public OfficeShape()` [#](#constructor-ctor)

[OfficeShape.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L10)

## Methods

`public OfficeShape Clone()` [#](#method-clone)

[OfficeShape.cs:377](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L377)

Creates a detached copy of this shape.

Returns

`OfficeShape`

`public static OfficeShape Ellipse(double width, double height)` [#](#method-ellipse-double-double)

[OfficeShape.cs:173](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L173)

Creates an ellipse descriptor bounded by the supplied width and height.

Parameters

**width double required**

**height double required**

Returns

`OfficeShape`

Line 2 overloads

`public static OfficeShape Line(double x1, double y1, double x2, double y2)` [#](#method-line-double-double-double-double)

[OfficeShape.cs:145](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L145)

Creates a straight line descriptor from two points in a local top-left coordinate space.

Parameters

**x1 double required**

**y1 double required**

**x2 double required**

**y2 double required**

Returns

`OfficeShape`

`public static OfficeShape Line(OfficePoint start, OfficePoint end)` [#](#method-line-officeimo-drawing-officepoint-officeimo-drawing-officepoint)

[OfficeShape.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L149)

Creates a straight line descriptor from two points in a local top-left coordinate space.

Parameters

**start OfficeIMO.Drawing.OfficePoint required**

**end OfficeIMO.Drawing.OfficePoint required**

Returns

`OfficeShape`

Path 4 overloads

`public static OfficeShape Path(params OfficePathCommand[] commands)` [#](#method-path-officeimo-drawing-officepathcommand)

[OfficeShape.cs:234](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L234)

Creates a freeform path descriptor from commands in a local top-left coordinate space.

Parameters

**commands OfficeIMO.Drawing.OfficePathCommand[] required**

Returns

`OfficeShape`

`public static OfficeShape Path(IEnumerable<OfficePathCommand> commands)` [#](#method-path-collections-generic-ienumerable-officeimo-drawing-officepathcommand)

[OfficeShape.cs:238](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L238)

Creates a freeform path descriptor from commands in a local top-left coordinate space.

Parameters

**commands System.Collections.Generic.IEnumerable<OfficeIMO.Drawing.OfficePathCommand> required**

Returns

`OfficeShape`

`public static OfficeShape Path(double width, double height, params OfficePathCommand[] commands)` [#](#method-path-double-double-officeimo-drawing-officepathcommand)

[OfficeShape.cs:274](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L274)

Creates a freeform path descriptor while preserving a declared local coordinate canvas.

Parameters

**width double required**

**height double required**

**commands OfficeIMO.Drawing.OfficePathCommand[] required**

Returns

`OfficeShape`

`public static OfficeShape Path(double width, double height, IEnumerable<OfficePathCommand> commands)` [#](#method-path-double-double-collections-generic-ienumerable-officeimo-drawing-officepathcommand)

[OfficeShape.cs:280](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L280)

Creates a freeform path descriptor while preserving a declared local coordinate canvas.

Parameters

**width double required**

**height double required**

**commands System.Collections.Generic.IEnumerable<OfficeIMO.Drawing.OfficePathCommand> required**

Returns

`OfficeShape`

Polygon 2 overloads

`public static OfficeShape Polygon(params OfficePoint[] points)` [#](#method-polygon-officeimo-drawing-officepoint)

[OfficeShape.cs:180](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L180)

Creates a polygon descriptor from points in a local top-left coordinate space.

Parameters

**points OfficeIMO.Drawing.OfficePoint[] required**

Returns

`OfficeShape`

`public static OfficeShape Polygon(IEnumerable<OfficePoint> points)` [#](#method-polygon-collections-generic-ienumerable-officeimo-drawing-officepoint)

[OfficeShape.cs:184](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L184)

Creates a polygon descriptor from points in a local top-left coordinate space.

Parameters

**points System.Collections.Generic.IEnumerable<OfficeIMO.Drawing.OfficePoint> required**

Returns

`OfficeShape`

`public static OfficeShape Rectangle(double width, double height)` [#](#method-rectangle-double-double)

[OfficeShape.cs:119](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L119)

Creates a rectangle descriptor.

Parameters

**width double required**

**height double required**

Returns

`OfficeShape`

`public static OfficeShape RoundedRectangle(double width, double height, double cornerRadius)` [#](#method-roundedrectangle-double-double-double)

[OfficeShape.cs:127](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L127)

Creates a rounded rectangle descriptor.

Parameters

**width double required**

**height double required**

**cornerRadius double required**

Returns

`OfficeShape`

`public void SetStrokeDashArray(IEnumerable<double>? pattern, double offset = 0)` [#](#method-setstrokedasharray-collections-generic-ienumerable-system-double-double)

[OfficeShape.cs:245](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L245)

Sets an exact stroke dash array and phase. Passing null or an empty sequence clears the exact pattern and leaves [OfficeShape.StrokeDashStyle](/api/core/officeimo-drawing-officeshape/) in control.

Parameters

**pattern System.Collections.Generic.IEnumerable<double>? required**

**offset double = 0 optional**

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public OfficeShapeKind Kind { get; set; }` [#](#property-kind)

[OfficeShape.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L12)

Shape type.

`public double Width { get; set; }` [#](#property-width)

[OfficeShape.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L15)

Shape width in the caller's layout unit.

`public double Height { get; set; }` [#](#property-height)

[OfficeShape.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L18)

Shape height in the caller's layout unit.

`public OfficeColor? StrokeColor { get; set; }` [#](#property-strokecolor)

[OfficeShape.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L21)

Optional stroke color. Null means no outline.

`public double StrokeWidth { get; set; }` [#](#property-strokewidth)

[OfficeShape.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L24)

Stroke width in the caller's layout unit.

`public OfficeStrokeDashStyle StrokeDashStyle { get; set; }` [#](#property-strokedashstyle)

[OfficeShape.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L27)

Stroke dash style.

`public IReadOnlyList<double> StrokeDashArray { get; private set; }` [#](#property-strokedasharray)

[OfficeShape.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L33)

Optional exact alternating dash and gap lengths. When non-empty, renderers prefer this pattern over [OfficeShape.StrokeDashStyle](/api/core/officeimo-drawing-officeshape/).

`public double StrokeDashOffset { get; private set; }` [#](#property-strokedashoffset)

[OfficeShape.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L36)

Offset into [OfficeShape.StrokeDashArray](/api/core/officeimo-drawing-officeshape/) at which stroking begins.

`public double StrokeMiterLimit { get; set; }` [#](#property-strokemiterlimit)

[OfficeShape.cs:40](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L40)

Maximum miter length as a multiple of the stroke width.

`public OfficeStrokeLineCap? StrokeLineCap { get; set; }` [#](#property-strokelinecap)

[OfficeShape.cs:62](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L62)

Optional stroke ending style for open paths. Null lets each renderer choose its default.

`public OfficeStrokeLineJoin? StrokeLineJoin { get; set; }` [#](#property-strokelinejoin)

[OfficeShape.cs:65](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L65)

Optional stroke corner style for connected path segments. Null lets each renderer choose its default.

`public OfficeLineMarker? StrokeStartMarker { get; set; }` [#](#property-strokestartmarker)

[OfficeShape.cs:68](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L68)

Optional marker drawn at the first point of open line shapes.

`public OfficeLineMarker? StrokeEndMarker { get; set; }` [#](#property-strokeendmarker)

[OfficeShape.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L71)

Optional marker drawn at the last point of open line shapes.

`public OfficeColor? FillColor { get; set; }` [#](#property-fillcolor)

[OfficeShape.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L74)

Optional fill color. Null means transparent fill.

`public OfficeLinearGradient? FillGradient { get; set; }` [#](#property-fillgradient)

[OfficeShape.cs:77](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L77)

Optional gradient fill. When set, renderers should prefer it over [OfficeShape.FillColor](/api/core/officeimo-drawing-officeshape/) for fill-capable shapes.

`public OfficeRadialGradient? FillRadialGradient { get; set; }` [#](#property-fillradialgradient)

[OfficeShape.cs:80](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L80)

Optional radial gradient fill. When set, renderers should prefer it over [OfficeShape.FillGradient](/api/core/officeimo-drawing-officeshape/) and [OfficeShape.FillColor](/api/core/officeimo-drawing-officeshape/) for fill-capable shapes.

`public OfficeLinearGradient? StrokeGradient { get; set; }` [#](#property-strokegradient)

[OfficeShape.cs:83](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L83)

Optional linear gradient stroke. When set, renderers should prefer it over [OfficeShape.StrokeColor](/api/core/officeimo-drawing-officeshape/) for stroked shapes.

`public OfficeRadialGradient? StrokeRadialGradient { get; set; }` [#](#property-strokeradialgradient)

[OfficeShape.cs:86](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L86)

Optional radial gradient stroke. When set, renderers should prefer it over [OfficeShape.StrokeGradient](/api/core/officeimo-drawing-officeshape/) and [OfficeShape.StrokeColor](/api/core/officeimo-drawing-officeshape/) for stroked shapes.

`public OfficeShadow? Shadow { get; set; }` [#](#property-shadow)

[OfficeShape.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L89)

Optional shadow intent rendered behind the shape when supported by a format-specific renderer.

`public OfficeGlow? Glow { get; set; }` [#](#property-glow)

[OfficeShape.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L92)

Optional glow intent rendered around the shape when supported by a format-specific renderer.

`public double? FillOpacity { get; set; }` [#](#property-fillopacity)

[OfficeShape.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L95)

Optional fill opacity from 0.0 (transparent) to 1.0 (opaque). Null lets each renderer use opaque fill.

`public double? StrokeOpacity { get; set; }` [#](#property-strokeopacity)

[OfficeShape.cs:98](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L98)

Optional stroke opacity from 0.0 (transparent) to 1.0 (opaque). Null lets each renderer use opaque stroke.

`public OfficeTransform? Transform { get; set; }` [#](#property-transform)

[OfficeShape.cs:101](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L101)

Optional local transform applied before format-specific rendering.

`public OfficeClipPath? ClipPath { get; set; }` [#](#property-clippath)

[OfficeShape.cs:104](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L104)

Optional local clipping path applied before format-specific rendering.

`public OfficeFillRule FillRule { get; set; }` [#](#property-fillrule)

[OfficeShape.cs:107](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L107)

Fill rule used for multi-contour path shapes.

`public double CornerRadius { get; set; }` [#](#property-cornerradius)

[OfficeShape.cs:110](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L110)

Corner radius for rounded rectangle shapes.

`public IReadOnlyList<OfficePoint> Points { get; private set; }` [#](#property-points)

[OfficeShape.cs:113](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L113)

Local points for point-based shapes such as polygons.

`public IReadOnlyList<OfficePathCommand> PathCommands { get; private set; }` [#](#property-pathcommands)

[OfficeShape.cs:116](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeShape.cs#L116)

Local commands for freeform path shapes.

<!-- PowerForge markdown artifact sha256:326BE70741659698B92DE05E434CF37980D876F3F00FD8235AB05DA0617C6424 -->
