This documentation is for the old version. Go to the latest Graphics Mill docs

Resize.CalculateProportionalDimensions Method (Int32, Int32, Int32 %, Int32 %, ResizeMode)

Calculates parameters for resize which preserve the aspect ratio of specified dimensions.

Namespace: Aurigma.GraphicsMill.Transforms
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public Shared Sub CalculateProportionalDimensions ( _
	srcWidth As Integer, _
	srcHeight As Integer, _
	ByRef destWidth As Integer, _
	ByRef destHeight As Integer, _
	mode As ResizeMode _
)
C#
public static void CalculateProportionalDimensions(
	int srcWidth,
	int srcHeight,
	ref int destWidth,
	ref int destHeight,
	ResizeMode mode
)

Parameters

srcWidth

Type: System.Int32

Input width.
srcHeight

Type: System.Int32

Input height.
destWidth

Type: System.Int32 %

Width value you need to recalculate. This value may be changed depending on the mode argument value.
destHeight

Type: System.Int32 %

Height value you need to recalculate. This value may be changed depending on the mode argument value.
mode

Type: Aurigma.GraphicsMill.Transforms.ResizeMode

ResizeMode value which specifies how to interpret destWidth and destHeight value.

Remarks

Use this method if you need to get the exact dimensions of the bitmap after proportional resize. This method recalculates specified width and height to preserve the specified aspect ratio respecting the specified ResizeMode. Note, destWidth and destHeight are both in and out, and these values are changed by the method.

For example, you need to make sure that the bitmap after resize will fit 640x480 rectangle. In this case you should pass the following values:

  • srcWidthWidth of the bitmap which you are going to resize.
  • srcBitmapHeight of the bitmap which you are going to resize.
  • destWidthAn integer variable which is equal to 640.
  • destHeightAn integer variable which is equal to 480
  • mode Fit

After you run this method, variables you pass as destWidth and destHeight will store recalculated dimensions.

See Also

Reference