logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class PreviewResolutionPresets

    Shared reference-resolution presets and letterboxing math for the editor preview tools (the Composite View Builder wireframe and the View Preview live render). Keeping it in one place means both tools offer the same screen list and scale fixed-px content the same way.

    Inheritance
    object
    PreviewResolutionPresets
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Ui.Infrastructure.Editor.Preview
    Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
    Syntax
    public static class PreviewResolutionPresets

    Fields

    Presets

    Reference screens the preview can emulate; fixed-px sizes scale against the chosen resolution and the content is letterboxed to its aspect ratio. The last entry is a custom W×H.

    Declaration
    public static readonly (string label, int w, int h)[] Presets
    Field Value
    Type Description
    (string label, int w, int h)[]

    Methods

    AspectLabel(int, int)

    A reduced "W:H" aspect label (e.g. "16:9"), or "—" when undefined.

    Declaration
    public static string AspectLabel(int w, int h)
    Parameters
    Type Name Description
    int w
    int h
    Returns
    Type Description
    string

    IsCustom(int)

    True when the given preset index is the trailing "Custom…" entry.

    Declaration
    public static bool IsCustom(int index)
    Parameters
    Type Name Description
    int index
    Returns
    Type Description
    bool

    Labels()

    The popup labels for Presets.

    Declaration
    public static string[] Labels()
    Returns
    Type Description
    string[]

    Letterbox(Rect, float)

    Centers a rect of the given aspect (width/height) inside area, scaled to fit (letterbox). Returns area unchanged for degenerate inputs.

    Declaration
    public static Rect Letterbox(Rect area, float aspect)
    Parameters
    Type Name Description
    Rect area
    float aspect
    Returns
    Type Description
    Rect

    Resolution(int, int, int)

    Resolves the (width, height) for a preset index, using customWidth/customHeight when the index is the custom entry.

    Declaration
    public static (int w, int h) Resolution(int index, int customWidth, int customHeight)
    Parameters
    Type Name Description
    int index
    int customWidth
    int customHeight
    Returns
    Type Description
    (int w, int h)
    In this article
    © 2026 Serenity. All Rights Reserved