public static class WZSize.ScaledDimensions extends Object
ScaledDimensions
is a utility class representing common scaling operations when
placing one rectangular area (the source) within another (the destination)
WZSize frameSize = WZSize(640, 480); WZSize screenSize = WZSize(1920, 1080); WZSize.ScaledDimension croppedDimensions = frameSize.scaleAndCrop(screenSize);
Modifier and Type | Field and Description |
---|---|
WZPoint |
centerPoint
The center point of the destination rectangle
|
WZSize |
destSize
The dimensions of the destination rectangle
|
WZSize |
offset
The offset of the source rectangle within the destination
|
WZSize |
scaledSize
The dimensions of the source rectangle after the appropriate placement calculation has been applied
|
float |
scaleX
The scaling factor applied to the width of the source rectangle
|
float |
scaleY
The scaling factor applied to the height of the source rectangle
|
WZSize |
srcSize
The dimensions of the source rectangle
|
Constructor and Description |
---|
ScaledDimensions(WZSize srcSize,
WZSize destSize)
The default constructor
|
Modifier and Type | Method and Description |
---|---|
WZSize.ScaledDimensions |
center()
Calculate the offset of the source rectangle from the destination after centering it within the destination.
|
WZSize.ScaledDimensions |
scaleWithCrop()
Calculate the dimensions of the source rectangle after scaling such that it fits entirely within the destination rectangle, preserving the aspect ratio.
|
WZSize.ScaledDimensions |
scaleWithFill()
Calculate the dimensions of the source rectangle after scaling such that it fills the destination rectangle, preserving the aspect ratio.
|
void |
setDestSize(WZSize destSize)
Update the dimensions of the destination rectangle
|
void |
setSrcSize(WZSize srcSize)
Update the dimensions of the source rectangle
|
String |
toString()
Returns a human-readable description of this instance
|
public WZSize srcSize
public WZSize destSize
public WZSize scaledSize
public WZSize offset
public WZPoint centerPoint
public float scaleX
public float scaleY
public void setSrcSize(WZSize srcSize)
srcSize
- The dimensions of the source rectanglepublic void setDestSize(WZSize destSize)
destSize
- The dimensions of the destination rectanglepublic WZSize.ScaledDimensions scaleWithCrop()
public WZSize.ScaledDimensions scaleWithFill()
public WZSize.ScaledDimensions center()
© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal