Search Results for

    Show / Hide Table of Contents

    Class ResizeUtil

    Utility class for resizing logic.

    Inheritance
    System.Object
    ResizeUtil
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: ImageVault.Core.Conversion
    Assembly: ImageVault.Core.dll
    Syntax
    public static class ResizeUtil

    Methods

    AdjustCropAndFindOffsetForFrameBounds(Rectangle, ref Rectangle)

    Combines the crop rectangle with the frame bounds and updates the crop rectangle to be relative the frameBounds. Also calculates the offset of the frame inside the original crop rectangle

    Declaration
    public static Point AdjustCropAndFindOffsetForFrameBounds(Rectangle frameBounds, ref Rectangle cropRectangle)
    Parameters
    Type Name Description
    System.Drawing.Rectangle frameBounds

    The System.Drawing.Rectangle defining the frame in the canvas

    System.Drawing.Rectangle cropRectangle

    The System.Drawing.Rectangle defining the area to crop from the canvas. Also defines the size of the new Canvas. Will be updated to reflect the actual rectangle to crop from the frameBounds. If crop rectangle is outside the frame, System.Drawing.Rectangle.Empty will be returned.

    Returns
    Type Description
    System.Drawing.Point

    The System.Drawing.Point defining the new offset of the cropped frame in the new canvas.

    GetCropRectangle(IResizeFormat, Int32, Int32, AreaOfInterest)

    Gets the CropRectangle that should be used for a specific resize operation

    Declaration
    public static ResizeUtil.Rect GetCropRectangle(IResizeFormat format, int imageWidth, int imageHeight, AreaOfInterest areaOfInterest)
    Parameters
    Type Name Description
    IResizeFormat format

    The IResizeFormat that should be performed

    System.Int32 imageWidth

    the width of the original image

    System.Int32 imageHeight

    the height of the original image

    AreaOfInterest areaOfInterest
    Returns
    Type Description
    ResizeUtil.Rect

    The ResizeUtil.Rect that should be cropped

    GetCropRectangle(Int32, Int32, Int32, Int32, ResizeMode, AreaOfInterest)

    Gets the CropRectangle that should be used for a specific resize operation

    Declaration
    public static ResizeUtil.Rect GetCropRectangle(int imageWidth, int imageHeight, int maxWidth, int maxHeight, ResizeMode resizeMode, AreaOfInterest areaOfInterest)
    Parameters
    Type Name Description
    System.Int32 imageWidth

    the width of the original image

    System.Int32 imageHeight

    the height of the original image

    System.Int32 maxWidth

    the max width of the target

    System.Int32 maxHeight

    the max height of the target

    ResizeMode resizeMode

    The ResizeMode that should be used

    AreaOfInterest areaOfInterest
    Returns
    Type Description
    ResizeUtil.Rect

    The ResizeUtil.Rect that should be cropped

    GetImageSize(Int32, Int32, IResizeFormat)

    Determine the size of the image if a IResizeFormat is applied to it

    Declaration
    public static Size GetImageSize(int orgWidth, int orgHeight, IResizeFormat format)
    Parameters
    Type Name Description
    System.Int32 orgWidth

    Original image width

    System.Int32 orgHeight

    Original image height

    IResizeFormat format

    The IResizeFormat to use

    Returns
    Type Description
    System.Drawing.Size

    The size of the resulting image

    GetImageSize(Int32, Int32, Int32, Int32, ResizeMode)

    Calculate new image size depending on resizeMode

    Declaration
    public static Size GetImageSize(int orgWidth, int orgHeight, int maxWidth, int maxHeight, ResizeMode resizeMode)
    Parameters
    Type Name Description
    System.Int32 orgWidth

    Original image width

    System.Int32 orgHeight

    Original image height

    System.Int32 maxWidth

    Maximum target width

    System.Int32 maxHeight

    Maximum target height

    ResizeMode resizeMode

    The ResizeMode to use

    Returns
    Type Description
    System.Drawing.Size

    GetImageSize(Int32, Int32, Int32, Int32, Double)

    Determine the size of the image

    Declaration
    public static Size GetImageSize(int orgWidth, int orgHeight, int maxWidth, int maxHeight, double aspectRatio)
    Parameters
    Type Name Description
    System.Int32 orgWidth

    Original image width

    System.Int32 orgHeight

    Original image height

    System.Int32 maxWidth

    Max target width

    System.Int32 maxHeight

    Max target height

    System.Double aspectRatio

    Target aspect ratio of the image. Will be used to make the image fit inside the

    Returns
    Type Description
    System.Drawing.Size

    The size of the resulting image

    In This Article
    Back to top (c) Meriworks 2002-2022