API reference

Crop Class

Modifiers: final
A normalized sub-rect of a panel's content to display, in 0, 1 UV space with (0, 0) at the top-left and (1, 1) at the bottom-right (the same convention as SceneLayer.setClip).
Applying a crop to a panel does two things in lockstep: it samples only this sub-rect of the content, and it shrinks the panel's rendered footprint — including the SPC hole-punch — to match. The cropped content therefore fills the panel with no letterbox bars and no stretching. See PanelSceneObject.setCrop.

Signature

class Crop(val left: Float = 0.0f, val top: Float = 0.0f, val right: Float = 1.0f, val bottom: Float = 1.0f)

Constructors

Crop ( left , top , right , bottom )
Signature
constructor(left: Float = 0.0f, top: Float = 0.0f, right: Float = 1.0f, bottom: Float = 1.0f)
Parameters
left: Float  Left edge of the sub-rect, in 0, 1.
top: Float  Top edge of the sub-rect, in 0, 1.
right: Float  Right edge of the sub-rect, in 0, 1.
bottom: Float  Bottom edge of the sub-rect, in 0, 1.
Returns
Crop

Properties

bottom : Float
[Get]
Bottom edge of the sub-rect, in 0, 1.
Signature
val bottom: Float = 1.0f
left : Float
[Get]
Left edge of the sub-rect, in 0, 1.
Signature
val left: Float = 0.0f
right : Float
[Get]
Right edge of the sub-rect, in 0, 1.
Signature
val right: Float = 1.0f
top : Float
[Get]
Top edge of the sub-rect, in 0, 1.
Signature
val top: Float = 0.0f

Companion Object

Properties

NONE : Crop
[Get]
No crop — the full content fills the panel.
Signature
val NONE: Crop

Methods

aspect ( ratio , contentAspect )
A centered crop that trims the longer axis so the visible sub-rect has the given aspect Crop.Companion.aspect (width / height), for content whose own aspect is Crop.Companion.aspect (width / height, default square). Returns Crop.Companion.NONE for non-positive inputs.
Signature
fun aspect(ratio: Float, contentAspect: Float = 1.0f): Crop
Parameters
ratio: Float
contentAspect: Float
Returns
Crop