# Class SyWindowViewportAccumulator

java.lang.Object
com.io7m.jsycamore.api.windows.SyWindowViewportAccumulator

All Implemented Interfaces:
  `SyWindowViewportAccumulatorType`

public final class SyWindowViewportAccumulator extends Object implements SyWindowViewportAccumulatorType
The default implementation of the viewport accumulator interface.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `accumulate(com.io7m.jregions.core.parameterized.areas.PAreaI<SySpaceParentRelativeType> box)`
  Calculate a new viewport based on the given bounds.
  `static SyWindowViewportAccumulatorType`
  `create()`
  Create a new accumulator.
  `int`
  `maximumX()`
  `int`
  `maximumY()`
  `int`
  `minimumX()`
  `int`
  `minimumY()`
  `void`
  `reset(int width, int height)`
  Reset the accumulator to the given base size.
  `void`
  `restore()`
  Restore the viewport that was calculated before the most recent call to `SyWindowViewportAccumulatorType.accumulate(PAreaI)`.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### create

    public static SyWindowViewportAccumulatorType create()
    Create a new accumulator.
    Returns:
      A new accumulator

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### reset

    public void reset(int width, int height)
    Description copied from interface: `SyWindowViewportAccumulatorType`

    Reset the accumulator to the given base size. This is typically the width and height of a containing window. The width and height must be greater than or equal to `0`.

    This will clear the internal accumulator stack.

    Specified by:
      `reset` in interface `SyWindowViewportAccumulatorType`
    Parameters:
      `width` - The width
      `height` - The height

  - ### accumulate

    public void accumulate(com.io7m.jregions.core.parameterized.areas.PAreaI<SySpaceParentRelativeType> box)
    Description copied from interface: `SyWindowViewportAccumulatorType`

    Calculate a new viewport based on the given bounds.

    The calculated viewport will always be less than or equal to the previous viewport in size.

    Specified by:
      `accumulate` in interface `SyWindowViewportAccumulatorType`
    Parameters:
      `box` - The bounds

  - ### minimumX

    public int minimumX()
    Specified by:
      `minimumX` in interface `SyWindowViewportAccumulatorType`
    Returns:
      The leftmost edge of the effective viewport

  - ### minimumY

    public int minimumY()
    Specified by:
      `minimumY` in interface `SyWindowViewportAccumulatorType`
    Returns:
      The top edge of the effective viewport

  - ### maximumX

    public int maximumX()
    Specified by:
      `maximumX` in interface `SyWindowViewportAccumulatorType`
    Returns:
      The rightmost edge of the effective viewport

  - ### maximumY

    public int maximumY()
    Specified by:
      `maximumY` in interface `SyWindowViewportAccumulatorType`
    Returns:
      The bottomost edge of the effective viewport

  - ### restore

    public void restore()
    Description copied from interface: `SyWindowViewportAccumulatorType`

    Restore the viewport that was calculated before the most recent call to `SyWindowViewportAccumulatorType.accumulate(PAreaI)`.

    If more `restore` calls have been made than `accumulate` calls, the viewport position is reset to `(0, 0)` and the size is reset to the most recent values given to `SyWindowViewportAccumulatorType.reset(int, int)` (or `(0,0)` if none exist).

    Specified by:
      `restore` in interface `SyWindowViewportAccumulatorType`