# OfficeImagePlacement

Describes the destination rectangle used when placing an image into a target box.

Struct 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

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

**Base**

`ValueType`

**Modifiers**

sealed

Describes the destination rectangle used when placing an image into a target box.

## Inheritance

- ValueType
- OfficeImagePlacement

## Usage

Explore 11 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 6

- Property [OfficeDrawingTilingPattern.Area](/api/core/officeimo-drawing-officedrawingtilingpattern/#property-area)
- Method [OfficeImagePatternLayout.GetTilePlacements](/api/core/officeimo-drawing-officeimagepatternlayout/#method-gettileplacements-int32)
- Property [OfficeImagePatternLayout.Area](/api/core/officeimo-drawing-officeimagepatternlayout/#property-area)
- Property [OfficeImagePatternLayout.Tile](/api/core/officeimo-drawing-officeimagepatternlayout/#property-tile)
- Method [OfficeImagePlacement.Fit](/api/core/officeimo-drawing-officeimageplacement/#method-fit-double-double-double-double-double-double-officeimo-drawing-officeimagefit)
- Property [OfficeImageProjection.Placement](/api/core/officeimo-drawing-officeimageprojection/#property-placement)

### Accepted by parameters 5

- 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 `area`
- 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 `area`
- Constructor [OfficeImagePatternLayout.OfficeImagePatternLayout](/api/core/officeimo-drawing-officeimagepatternlayout/#constructor-ctor-officeimo-drawing-officeimageplacement-officeimo-drawing-officeimageplacement-boolean-boolean) parameter `area`
- Constructor [OfficeImagePatternLayout.OfficeImagePatternLayout](/api/core/officeimo-drawing-officeimagepatternlayout/#constructor-ctor-officeimo-drawing-officeimageplacement-officeimo-drawing-officeimageplacement-boolean-boolean) parameter `tile`
- Constructor [OfficeImageProjection.OfficeImageProjection](/api/core/officeimo-drawing-officeimageprojection/#constructor-ctor-officeimo-drawing-officeimageplacement-officeimo-drawing-officeimagesourcecrop-double-nullable-system-double-nullable-system-double-boolean-boolean) parameter `placement`

Filter members 

Show inherited

## Constructors

`public OfficeImagePlacement(double x, double y, double width, double height)` [#](#constructor-ctor-double-double-double-double)

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

Creates a new image placement rectangle.

Parameters

**x double required**

**y double required**

**width double required**

**height double required**

## Methods

`public static bool ExceedsAspectRatioDistortion(double sourceWidth, double sourceHeight, double targetWidth, double targetHeight, double thresholdRatio)` [#](#method-exceedsaspectratiodistortion-double-double-double-double-double)

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

Returns whether a source image would visibly distort when stretched into a target rectangle.

Parameters

**sourceWidth double required**

Source image width.

**sourceHeight double required**

Source image height.

**targetWidth double required**

Target rectangle width.

**targetHeight double required**

Target rectangle height.

**thresholdRatio double required**

Minimum distortion ratio considered visible. Values below 1 are invalid.

Returns

`bool`

`public static OfficeImagePlacement Fit(double sourceWidth, double sourceHeight, double targetX, double targetY, double targetWidth, double targetHeight, OfficeImageFit fit = Stretch)` [#](#method-fit-double-double-double-double-double-double-officeimo-drawing-officeimagefit)

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

Fits a source image into a target rectangle using the requested image fit mode.

Parameters

**sourceWidth double required**

Source image width.

**sourceHeight double required**

Source image height.

**targetX double required**

Target rectangle left coordinate.

**targetY double required**

Target rectangle top coordinate.

**targetWidth double required**

Target rectangle width.

**targetHeight double required**

Target rectangle height.

**fit OfficeIMO.Drawing.OfficeImageFit = Stretch optional**

Image fit mode.

Returns

`OfficeImagePlacement` The destination rectangle to render.

`public static double GetAspectRatioDistortionRatio(double sourceWidth, double sourceHeight, double targetWidth, double targetHeight)` [#](#method-getaspectratiodistortionratio-double-double-double-double)

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

Calculates the visible aspect-ratio change between a source image and a target rectangle.

Parameters

**sourceWidth double required**

Source image width.

**sourceHeight double required**

Source image height.

**targetWidth double required**

Target rectangle width.

**targetHeight double required**

Target rectangle height.

Returns

`double` A ratio greater than or equal to 1 where 1 means the source and target aspect ratios match.

`public ValueTuple<double, double, double, double> ToTuple()` [#](#method-totuple)

[OfficeImagePlacement.cs:126](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImagePlacement.cs#L126)

Converts the placement into a tuple.

Returns

`ValueTuple<double, double, double, double>`

## Inherited Methods

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

Inherited from ValueType

Parameters

**obj object? required**

Returns

`bool`

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

Inherited from ValueType

Returns

`int`

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

Inherited from object

Returns

`Type`

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

Inherited from ValueType

Returns

`string?`

## Properties

`public double X { get; }` [#](#property-x)

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

Destination left coordinate.

`public double Y { get; }` [#](#property-y)

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

Destination top coordinate.

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

[OfficeImagePlacement.cs:29](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImagePlacement.cs#L29)

Destination width.

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

[OfficeImagePlacement.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImagePlacement.cs#L32)

Destination height.

<!-- PowerForge markdown artifact sha256:29A05C4C121AA3CD223D2CF13EFB44F615D8181E1185D95BEF573F1C94448A4D -->
