C# Class Imazen.LightResize.BoxMath

Provides simple layout math
Mostra file Open project: imazen/lightresize Class Usage Examples

Public Methods

Method Description
CenterInside ( SizeF size, RectangleF bounds ) : RectangleF

Creates a rectangle of size 'size' with a center matching that of bounds. No rounding is performed.

FitsInside ( SizeF inner, SizeF outer ) : bool

Returns true if 'inner' fits inside or equals 'outer'

RoundPoints ( SizeF sizeF ) : Size

Rounds a SizeF structure using System.Round

ScaleInside ( SizeF inner, SizeF bounding ) : SizeF

Scales 'inner' to fit inside 'bounding' while maintaining aspect ratio. Upscales and downscales.

ToRectangle ( RectangleF r ) : Rectangle

Rounds a floating-point rectangle to an integer rectangle using System.Round

Method Details

CenterInside() public static method

Creates a rectangle of size 'size' with a center matching that of bounds. No rounding is performed.
public static CenterInside ( SizeF size, RectangleF bounds ) : RectangleF
size System.Drawing.SizeF
bounds System.Drawing.RectangleF
return System.Drawing.RectangleF

FitsInside() public static method

Returns true if 'inner' fits inside or equals 'outer'
public static FitsInside ( SizeF inner, SizeF outer ) : bool
inner System.Drawing.SizeF
outer System.Drawing.SizeF
return bool

RoundPoints() public static method

Rounds a SizeF structure using System.Round
public static RoundPoints ( SizeF sizeF ) : Size
sizeF System.Drawing.SizeF
return System.Drawing.Size

ScaleInside() public static method

Scales 'inner' to fit inside 'bounding' while maintaining aspect ratio. Upscales and downscales.
public static ScaleInside ( SizeF inner, SizeF bounding ) : SizeF
inner System.Drawing.SizeF
bounding System.Drawing.SizeF
return System.Drawing.SizeF

ToRectangle() public static method

Rounds a floating-point rectangle to an integer rectangle using System.Round
public static ToRectangle ( RectangleF r ) : Rectangle
r System.Drawing.RectangleF
return System.Drawing.Rectangle