# OfficeTransform

Dependency-free 2D affine transform in a local top-left coordinate space.

Struct 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeTransform.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L30)

**Base**

`ValueType`

**Implements**

`IEquatable<OfficeTransform>`

**Modifiers**

sealed

Dependency-free 2D affine transform in a local top-left coordinate space.

## Inheritance

- ValueType
- OfficeTransform

## Usage

Explore 39 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 17

- Property [OfficeDrawingEffectGroup.Transform](/api/core/officeimo-drawing-officedrawingeffectgroup/#property-transform)
- Property [OfficeDrawingSoftMask.Transform](/api/core/officeimo-drawing-officedrawingsoftmask/#property-transform)
- Method [OfficeDrawingTilingPattern.GetTileTransforms](/api/core/officeimo-drawing-officedrawingtilingpattern/#method-gettiletransforms)
- Property [OfficeDrawingTilingPattern.Transform](/api/core/officeimo-drawing-officedrawingtilingpattern/#property-transform)
- Method [OfficeImageFrameTransform.CreateDestinationTransform](/api/core/officeimo-drawing-officeimageframetransform/#method-createdestinationtransform)
- Method [OfficeImageProjection.CreateUnitSquareTransform](/api/core/officeimo-drawing-officeimageprojection/#method-createunitsquaretransform)
- Property [OfficeInkStroke.Transform](/api/core/officeimo-drawing-officeinkstroke/#property-transform)
- Property [OfficeRadialGradient.CoordinateTransform](/api/core/officeimo-drawing-officeradialgradient/#property-coordinatetransform)
- Property [OfficeScanProcessingReport.ProcessedToSource](/api/core/officeimo-drawing-officescanprocessingreport/#property-processedtosource)
- Property [OfficeScanProcessingReport.SourceToProcessed](/api/core/officeimo-drawing-officescanprocessingreport/#property-sourcetoprocessed)
- Property [OfficeShape.Transform](/api/core/officeimo-drawing-officeshape/#property-transform)
- Method [OfficeTransform.Invert](/api/core/officeimo-drawing-officetransform/#method-invert)
- Method [OfficeTransform.RotateDegrees](/api/core/officeimo-drawing-officetransform/#method-rotatedegrees-double)
- Method [OfficeTransform.Scale](/api/core/officeimo-drawing-officetransform/#method-scale-double-double)
- Method [OfficeTransform.Then](/api/core/officeimo-drawing-officetransform/#method-then-officeimo-drawing-officetransform)
- Method [OfficeTransform.Translate](/api/core/officeimo-drawing-officetransform/#method-translate-double-double)
- Property [OfficeTransform.Identity](/api/core/officeimo-drawing-officetransform/#property-identity)

### Accepted by parameters 22

- Method [OfficeDrawing.AddBorderBox](/api/core/officeimo-drawing-officedrawing/#method-addborderbox-double-double-double-double-nullable-officeimo-officecolor-officeimo-drawing-officeborderbox-nullable-officeimo-drawing-officetransform) parameter `transform`
- Method [OfficeDrawing.AddEffectDrawing](/api/core/officeimo-drawing-officedrawing/#method-addeffectdrawing-officeimo-drawing-officedrawing-officeimo-drawing-officetransform-double) parameter `transform`
- Method [OfficeDrawing.AddTilingPattern](/api/core/officeimo-drawing-officedrawing/#method-addtilingpattern-officeimo-drawing-officedrawing-officeimo-drawing-officeimageplacement-double-double-nullable-officeimo-drawing-officetransform-double-double-int32-double) parameter `transform`
- Constructor [OfficeDrawingEffectGroup.OfficeDrawingEffectGroup](/api/core/officeimo-drawing-officedrawingeffectgroup/#constructor-ctor-officeimo-drawing-officedrawing-officeimo-drawing-officetransform-double) parameter `transform`
- Constructor [OfficeDrawingSoftMask.OfficeDrawingSoftMask](/api/core/officeimo-drawing-officedrawingsoftmask/#constructor-ctor-officeimo-drawing-officedrawing-officeimo-drawing-officesoftmaskmode-nullable-officeimo-drawing-officetransform-nullable-officeimo-officecolor) parameter `transform`
- Method [OfficeDrawingSoftMask.CreateWithLuminosityStandard](/api/core/officeimo-drawing-officedrawingsoftmask/#method-createwithluminositystandard-officeimo-drawing-officedrawing-officeimo-drawing-officesoftmaskluminositystandard-officeimo-drawing-officesoftmaskmode-nullable-officeimo-drawing-officetransform-nullable-officeimo-officecolor) parameter `transform`
- Constructor [OfficeDrawingTilingPattern.OfficeDrawingTilingPattern](/api/core/officeimo-drawing-officedrawingtilingpattern/#constructor-ctor-officeimo-drawing-officedrawing-officeimo-drawing-officeimageplacement-double-double-nullable-officeimo-drawing-officetransform-double-double-int32-double) parameter `transform`
- Method [OfficeInkPoint.Transform](/api/core/officeimo-drawing-officeinkpoint/#method-transform-officeimo-drawing-officetransform) parameter `transform`
- Method [OfficeLinearGradient.FromTransformedAngle](/api/core/officeimo-drawing-officelineargradient/#method-fromtransformedangle-collections-generic-ireadonlylist-officeimo-drawing-officegradientstop-double-double-double-officeimo-drawing-officetransform) parameter `localToDestination`
- Method [OfficeRadialGradient.TransformCoordinates](/api/core/officeimo-drawing-officeradialgradient/#method-transformcoordinates-officeimo-drawing-officetransform) parameter `transform`
- Method [OfficeRasterCanvas.DrawAffineImage](/api/core/officeimo-drawing-officerastercanvas/#method-drawaffineimage-officeimo-drawing-officerasterimage-officeimo-drawing-officetransform-double-officeimo-drawing-officeblendmode) parameter `transform`
- Method [OfficeRasterCanvas.DrawTextLineTransformed](/api/core/officeimo-drawing-officerastercanvas/#method-drawtextlinetransformed-string-double-double-double-officeimo-officecolor-officeimo-drawing-officetransform-boolean-boolean-officeimo-drawing-officetextalignment-boolean-boolean-string) parameter `transform`
- Method [OfficeRasterResampler.Transform](/api/core/officeimo-drawing-officerasterresampler/#method-transform-officeimo-drawing-officerasterimage-officeimo-drawing-officetransform-int32-int32-nullable-officeimo-officecolor-threading-cancellationtoken) parameter `sourceToDestination`
- Method [OfficeSvgFormatting.AppendMatrixTransformAttribute](/api/core/officeimo-drawing-officesvgformatting/#method-appendmatrixtransformattribute-text-stringbuilder-officeimo-drawing-officetransform-double-double) parameter `transform`
- Method [OfficeSvgFormatting.FormatMatrixTransform](/api/core/officeimo-drawing-officesvgformatting/#method-formatmatrixtransform-officeimo-drawing-officetransform-double-double) parameter `transform`
- Method [OfficeTransform.Equals](/api/core/officeimo-drawing-officetransform/#method-equals-officeimo-drawing-officetransform) parameter `other`
- Method [OfficeTransform.op_Equality](/api/core/officeimo-drawing-officetransform/#method-op-equality-officeimo-drawing-officetransform-officeimo-drawing-officetransform) parameter `left`
- Method [OfficeTransform.op_Equality](/api/core/officeimo-drawing-officetransform/#method-op-equality-officeimo-drawing-officetransform-officeimo-drawing-officetransform) parameter `right`
- Method [OfficeTransform.op_Inequality](/api/core/officeimo-drawing-officetransform/#method-op-inequality-officeimo-drawing-officetransform-officeimo-drawing-officetransform) parameter `left`
- Method [OfficeTransform.op_Inequality](/api/core/officeimo-drawing-officetransform/#method-op-inequality-officeimo-drawing-officetransform-officeimo-drawing-officetransform) parameter `right`
- Method [OfficeTransform.Then](/api/core/officeimo-drawing-officetransform/#method-then-officeimo-drawing-officetransform) parameter `next`
- Method [OfficeTransform.TryInvert](/api/core/officeimo-drawing-officetransform/#method-tryinvert-officeimo-drawing-officetransform) parameter `inverse`

Filter members 

Show inherited

## Constructors

`public OfficeTransform(double m11, double m12, double m21, double m22, double offsetX, double offsetY)` [#](#constructor-ctor-double-double-double-double-double-double)

[OfficeTransform.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L30)

Creates an affine transform.

Parameters

**m11 double required**

**m12 double required**

**m21 double required**

**m22 double required**

**offsetX double required**

**offsetY double required**

## Methods

Equals 2 overloads

`public bool Equals(OfficeTransform other)` [#](#method-equals-officeimo-drawing-officetransform)

[OfficeTransform.cs:154](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L154)

Indicates whether the current object is equal to another object of the same type.

Parameters

**other OfficeIMO.Drawing.OfficeTransform required**

An object to compare with this object.

Returns

`bool` true if the current object is equal to the other parameter; otherwise, false.

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

[OfficeTransform.cs:163](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L163)

Indicates whether this instance and a specified object are equal.

Parameters

**obj object? required**

The object to compare with the current instance.

Returns

`bool` true if obj and this instance are the same type and represent the same value; otherwise, false.

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

[OfficeTransform.cs:168](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L168)

Returns the hash code for this instance.

Returns

`int` A 32-bit signed integer that is the hash code for this instance.

`public OfficeTransform Invert()` [#](#method-invert)

[OfficeTransform.cs:90](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L90)

Returns the inverse transform.

Returns

`OfficeTransform`

Exceptions

- `InvalidOperationException` – Thrown when the transform cannot be inverted.

`public static bool op_Equality(OfficeTransform left, OfficeTransform right)` [#](#method-op-equality-officeimo-drawing-officetransform-officeimo-drawing-officetransform)

[OfficeTransform.cs:179](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L179)

Returns true when two transforms are equal.

Parameters

**left OfficeIMO.Drawing.OfficeTransform required**

**right OfficeIMO.Drawing.OfficeTransform required**

Returns

`bool`

`public static bool op_Inequality(OfficeTransform left, OfficeTransform right)` [#](#method-op-inequality-officeimo-drawing-officetransform-officeimo-drawing-officetransform)

[OfficeTransform.cs:182](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L182)

Returns true when two transforms are not equal.

Parameters

**left OfficeIMO.Drawing.OfficeTransform required**

**right OfficeIMO.Drawing.OfficeTransform required**

Returns

`bool`

RotateDegrees 2 overloads

`public static OfficeTransform RotateDegrees(double degrees)` [#](#method-rotatedegrees-double)

[OfficeTransform.cs:53](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L53)

Creates a clockwise rotation transform around the local origin.

Parameters

**degrees double required**

Returns

`OfficeTransform`

`public static OfficeTransform RotateDegrees(double degrees, double centerX, double centerY)` [#](#method-rotatedegrees-double-double-double)

[OfficeTransform.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L64)

Creates a clockwise rotation transform around a local point.

Parameters

**degrees double required**

**centerX double required**

**centerY double required**

Returns

`OfficeTransform`

`public static OfficeTransform Scale(double scaleX, double scaleY)` [#](#method-scale-double-double)

[OfficeTransform.cs:49](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L49)

Creates a scale transform around the local origin.

Parameters

**scaleX double required**

**scaleY double required**

Returns

`OfficeTransform`

`public OfficeTransform Then(OfficeTransform next)` [#](#method-then-officeimo-drawing-officetransform)

[OfficeTransform.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L76)

Returns a transform that applies this transform first, then the supplied transform.

Parameters

**next OfficeIMO.Drawing.OfficeTransform required**

Returns

`OfficeTransform`

`public OfficePoint TransformPoint(OfficePoint point)` [#](#method-transformpoint-officeimo-drawing-officepoint)

[OfficeTransform.cs:121](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L121)

Transforms a point in local top-left coordinates.

Parameters

**point OfficeIMO.Drawing.OfficePoint required**

Returns

`OfficePoint`

`public ValueTuple<double, double, double, double> TransformRectangleBounds(double x, double y, double width, double height)` [#](#method-transformrectanglebounds-double-double-double-double)

[OfficeTransform.cs:135](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L135)

Calculates axis-aligned bounds for a transformed rectangle.

Parameters

**x double required**

Rectangle left coordinate.

**y double required**

Rectangle top coordinate.

**width double required**

Rectangle width.

**height double required**

Rectangle height.

Returns

`ValueTuple<double, double, double, double>` Axis-aligned bounds of the transformed rectangle.

`public static OfficeTransform Translate(double offsetX, double offsetY)` [#](#method-translate-double-double)

[OfficeTransform.cs:46](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L46)

Creates a translation transform.

Parameters

**offsetX double required**

**offsetY double required**

Returns

`OfficeTransform`

`public bool TryInvert(out OfficeTransform inverse)` [#](#method-tryinvert-officeimo-drawing-officetransform)

[OfficeTransform.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L103)

Attempts to create the inverse transform.

Parameters

**inverse OfficeIMO.Drawing.OfficeTransform required**

Inverse transform when inversion succeeds.

Returns

`bool` True when the transform has a non-zero determinant.

## Inherited Methods

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

Inherited from object

Returns

`Type`

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

Inherited from ValueType

Returns

`string?`

## Properties

`public static OfficeTransform Identity { get; }` [#](#property-identity)

[OfficeTransform.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L8)

Identity transform.

`public double M11 { get; }` [#](#property-m11)

[OfficeTransform.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L11)

Horizontal scale/rotation component.

`public double M12 { get; }` [#](#property-m12)

[OfficeTransform.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L14)

Vertical shear/rotation component.

`public double M21 { get; }` [#](#property-m21)

[OfficeTransform.cs:17](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L17)

Horizontal shear/rotation component.

`public double M22 { get; }` [#](#property-m22)

[OfficeTransform.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L20)

Vertical scale/rotation component.

`public double OffsetX { get; }` [#](#property-offsetx)

[OfficeTransform.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L23)

Horizontal translation component.

`public double OffsetY { get; }` [#](#property-offsety)

[OfficeTransform.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTransform.cs#L26)

Vertical translation component.

<!-- PowerForge markdown artifact sha256:5E6F2B4BA536F770E197F8B5DFDB0F65B1D31638DDCD2D8EBA3D39760C503659 -->
