Show / Hide Table of Contents

Class DrawingUtils

Utility class for drawing layouts.

Inheritance
System.Object
DrawingUtils
Namespace: Edgar.GraphBasedGenerator.Grid2D.Drawing
Assembly: Edgar.dll
Syntax
public static class DrawingUtils : Object

Methods

GetBoundingBox(List<PolygonGrid2D>)

Computes the bounding box of a given list of polygons.

Declaration
public static RectangleGrid2D GetBoundingBox(List<PolygonGrid2D> polygons)
Parameters
Type Name Description
System.Collections.Generic.List<PolygonGrid2D> polygons
Returns
Type Description
RectangleGrid2D

GetOffset(RectangleGrid2D, Int32, Int32, Single)

Computes the offset that must be applied to the bounding box in order to center it to a given target with and height.

Declaration
public static Vector2 GetOffset(RectangleGrid2D boundingBox, int targetWidth, int targetHeight, float scale)
Parameters
Type Name Description
RectangleGrid2D boundingBox
System.Int32 targetWidth
System.Int32 targetHeight
System.Single scale
Returns
Type Description
Vector2

GetScale(RectangleGrid2D, Int32, Int32, Single)

Computes the scale that must be applied to the bounding box in order to fit a given target width, target height and padding.

Declaration
public static float GetScale(RectangleGrid2D boundingBox, int targetWidth, int targetHeight, float padding)
Parameters
Type Name Description
RectangleGrid2D boundingBox
System.Int32 targetWidth
System.Int32 targetHeight
System.Single padding
Returns
Type Description
System.Single

GetSize(RectangleGrid2D, Nullable<Int32>, Nullable<Int32>, Nullable<Single>, Nullable<Int32>, Single)

Computes the final width, height and scale of a given bounding box.

Declaration
public static ValueTuple<int, int, float> GetSize(RectangleGrid2D boundingBox, Nullable<int> targetWidth, Nullable<int> targetHeight, Nullable<float> targetScale, Nullable<int> paddingAbsolute, float paddingPercentage)
Parameters
Type Name Description
RectangleGrid2D boundingBox
System.Nullable<System.Int32> targetWidth
System.Nullable<System.Int32> targetHeight
System.Nullable<System.Single> targetScale
System.Nullable<System.Int32> paddingAbsolute
System.Single paddingPercentage
Returns
Type Description
System.ValueTuple<System.Int32, System.Int32, System.Single>

GetWidthHeightRatio(RectangleGrid2D)

Computes the width/height ratio of the bounding box.

Declaration
public static float GetWidthHeightRatio(RectangleGrid2D boundingBox)
Parameters
Type Name Description
RectangleGrid2D boundingBox
Returns
Type Description
System.Single
Back to top Generated by DocFX