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 TypeMethodDescriptionvoidaccumulate(com.io7m.jregions.core.parameterized.areas.PAreaI<SySpaceParentRelativeType> box) Calculate a new viewport based on the given bounds.create()Create a new accumulator.intmaximumX()intmaximumY()intminimumX()intminimumY()voidreset(int width, int height) Reset the accumulator to the given base size.voidrestore()Restore the viewport that was calculated before the most recent call toSyWindowViewportAccumulatorType.accumulate(PAreaI).toString()
-
Method Details
-
create
Create a new accumulator.- Returns:
- A new accumulator
-
toString
-
reset
public void reset(int width, int height) Description copied from interface:SyWindowViewportAccumulatorTypeReset 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:
resetin interfaceSyWindowViewportAccumulatorType- Parameters:
width- The widthheight- The height
-
accumulate
public void accumulate(com.io7m.jregions.core.parameterized.areas.PAreaI<SySpaceParentRelativeType> box) Description copied from interface:SyWindowViewportAccumulatorTypeCalculate 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:
accumulatein interfaceSyWindowViewportAccumulatorType- Parameters:
box- The bounds
-
minimumX
public int minimumX()- Specified by:
minimumXin interfaceSyWindowViewportAccumulatorType- Returns:
- The leftmost edge of the effective viewport
-
minimumY
public int minimumY()- Specified by:
minimumYin interfaceSyWindowViewportAccumulatorType- Returns:
- The top edge of the effective viewport
-
maximumX
public int maximumX()- Specified by:
maximumXin interfaceSyWindowViewportAccumulatorType- Returns:
- The rightmost edge of the effective viewport
-
maximumY
public int maximumY()- Specified by:
maximumYin interfaceSyWindowViewportAccumulatorType- Returns:
- The bottomost edge of the effective viewport
-
restore
public void restore()Description copied from interface:SyWindowViewportAccumulatorTypeRestore the viewport that was calculated before the most recent call to
SyWindowViewportAccumulatorType.accumulate(PAreaI).If more
restorecalls have been made thanaccumulatecalls, the viewport position is reset to(0, 0)and the size is reset to the most recent values given toSyWindowViewportAccumulatorType.reset(int, int)(or(0,0)if none exist).- Specified by:
restorein interfaceSyWindowViewportAccumulatorType
-