StretchableAppearance

Appearances whose bounds can be defined by two opposite corners of a rectangle, both of which can be moved anywhere.

Pose and Graphic are not StretchableAppearance, because the corners cannot be arbitrarily changed, they are defined by the pin and the size of the pose/graphic.

corner1 and corner3 are derived from corner0 and corner2 and therefore are not stored, and aren't mutable.

The rectangular region will be centered iff corner0 == - corner2

In some cases, it is useful to grow/shrink an appearance by changing the position of the corners AND to change the actor's scale. For example, suppose we have a NinePatchAppearance of a framed picture. We can change the size of the picture by changing corner0 and corner2; the picture frame's thickness wouldn't change. If we want a thicker frame, scale the actor. We would also need to move the corners to compensate if we wanted the overall size framed picture to remain unchanged.

Inheritors

Properties

Link copied to clipboard
abstract var corner0: Vector2

In conjunction with corner2, this defines a rectangle in CoordinateSystem.local coordinates.

Link copied to clipboard
Link copied to clipboard
open val corner1: Vector2

A corner of the bounding rectangle derived from corner0 and corner2.

Link copied to clipboard
abstract var corner2: Vector2
Link copied to clipboard

In conjunction with corner2, this defines a rectangle in CoordinateSystem.local coordinates.

Link copied to clipboard
open val corner3: Vector2

A corner of the bounding rectangle derived from corner0 and corner2.

Link copied to clipboard
abstract val resourcePath: String
Link copied to clipboard
open var tintIfAvailable: Color

Most appearances are TintedAppearance, but checking if an appearance is a TintedAppearance can be onerous. This gives the illusion that all appearances have a tint. For those without a tint, the value will be Color.WHITE, and setting this value will do nothing.

Functions

Link copied to clipboard
open override fun appearance(): Appearance

Pose and Graphic return themselves. NinePatch returns a NinePatchAppearance.

Link copied to clipboard
open override fun appearanceForActor(actor: Actor): Appearance

Creates an Appearance with the same tint. Also, if the new appearances is StretchableAppearance then it will have the same bounds as the previous appearance.

Link copied to clipboard
open fun applyToActor(actor: Actor)

Set the actor's appearance.

Link copied to clipboard
open override fun containsLocalPoint(localPoint: Vector2): Boolean

Given a point in local coordinates, is it within the bounding box of this Appearance?

Link copied to clipboard
abstract fun draw(modelMatrix: Matrix?)

The actor's transformation has already been applied to Backend (using Backend.transform). So we do NOT need to use Actor.position, Actor.scale or Actor.angleRadians.

Link copied to clipboard
open override fun localBounds(): Pair<Vector2, Vector2>

Returns two corners of a bounding rectangle in local coordinates.

Link copied to clipboard
open override fun localCorners(): List<Vector2>

Returns a list of local points which describes the bounding polygon. local means the points are unrelated to the Actor's position, angle or scale.

Link copied to clipboard
open fun moveCorner(corner: Int, newLocalPosition: Vector2)