C# Class NContrib.Drawing.Extensions.SizeExtensions

Datei anzeigen Open project: veracross/ncontrib

Public Methods

Method Description
CropToAspect ( this sourceSize, float aspect ) : Size

Returns a Size that is a sub-section of the given source size and conforms to the specified aspect

Expand ( this sourceSize, int width, int height, ScaleMethod method ) : Size

Scales an image Size, but only up

Scale ( this sourceSize, float scalePercent ) : Size

Calculates a scaled image size, changing the size by a percentage

Scale ( this sourceSize, int width, int height, ScaleMethod method, ScaleType type ) : Size

Scales an image size, preserving aspect ratio.

Shrink ( this sourceSize, int width, int height, ScaleMethod method ) : Size

Scales an image Size, but only down

Method Details

CropToAspect() public static method

Returns a Size that is a sub-section of the given source size and conforms to the specified aspect
public static CropToAspect ( this sourceSize, float aspect ) : Size
sourceSize this
aspect float
return System.Drawing.Size

Expand() public static method

Scales an image Size, but only up
public static Expand ( this sourceSize, int width, int height, ScaleMethod method ) : Size
sourceSize this
width int
height int
method ScaleMethod
return System.Drawing.Size

Scale() public static method

Calculates a scaled image size, changing the size by a percentage
public static Scale ( this sourceSize, float scalePercent ) : Size
sourceSize this
scalePercent float Scale percentage. 1 = 100% which yields no change /// .5 = 50% which would reduce the height and width by half.
return System.Drawing.Size

Scale() public static method

Scales an image size, preserving aspect ratio.
public static Scale ( this sourceSize, int width, int height, ScaleMethod method, ScaleType type ) : Size
sourceSize this
width int Min or max allowed width. Min/Max controlled by the method parameter
height int Min or max allowed height. Min/Max controlled by the method parameter
method ScaleMethod
type ScaleType
return System.Drawing.Size

Shrink() public static method

Scales an image Size, but only down
public static Shrink ( this sourceSize, int width, int height, ScaleMethod method ) : Size
sourceSize this
width int
height int
method ScaleMethod
return System.Drawing.Size