logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementScreenshotSizing

    Answers how large a captured frame should be stored, given the width a project is willing to keep.

    Inheritance
    object
    AchievementScreenshotSizing
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Application.Services
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public static class AchievementScreenshotSizing
    Remarks

    Pure arithmetic on purpose: the size decision is the part of screenshot capture worth pinning with tests, and keeping it out of the engine-bound capturer is what makes that possible. The capturer only performs the resample this answer describes.

    Methods

    TryFitWidth(int, int, int, out int, out int)

    Computes the size a frame has to be resampled to in order to fit a maximum width, preserving its aspect ratio.

    Declaration
    public static bool TryFitWidth(int sourceWidth, int sourceHeight, int maximumWidth, out int targetWidth, out int targetHeight)
    Parameters
    Type Name Description
    int sourceWidth

    The captured frame's width, in pixels.

    int sourceHeight

    The captured frame's height, in pixels.

    int maximumWidth

    The width the project keeps at most. Zero or less keeps the frame as captured.

    int targetWidth

    The width to resample to, when one is needed.

    int targetHeight

    The height to resample to, when one is needed.

    Returns
    Type Description
    bool

    True when the frame has to be resampled; false when it should be stored as captured.

    In this article
    © 2026 Serenity. All Rights Reserved