BaseImage

open class BaseImage(bitmap: Resourceable<out BitmapCoords>, anchor: Anchor = Anchor.TOP_LEFT, hitShape: VectorPath? = null, var smoothing: Boolean = true) : RectBase

Inheritors

Constructors

Link copied to clipboard
constructor(bitmap: Bitmap, anchor: Anchor = Anchor.TOP_LEFT, hitShape: VectorPath? = null, smoothing: Boolean = true)
constructor(bmpCoords: BitmapCoords, anchor: Anchor = Anchor.TOP_LEFT, hitShape: VectorPath? = null, smoothing: Boolean = true)
constructor(bitmap: Resourceable<out BitmapCoords>, anchor: Anchor = Anchor.TOP_LEFT, hitShape: VectorPath? = null, smoothing: Boolean = true)

Properties

Link copied to clipboard

Returns a list of all the non-null View.name values of this and the descendants

Link copied to clipboard

Shortcut for adjusting the multiplicative alpha value manually. Equivalent to ColorTransform.mA + View.invalidate

Link copied to clipboard
Link copied to clipboard

Returns the number of ancestors of this view. Views without parents return 0.

Link copied to clipboard

Returns a list of all the ancestors (including this) to reach the root node (usually the stage).

Link copied to clipboard
open override var anchor: Anchor
Link copied to clipboard
Link copied to clipboard
open override val anchorDispX: Float
Link copied to clipboard
Link copied to clipboard
open override val anchorDispY: Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The BlendMode used for this view BlendMode.INHERIT will use the ancestors blendModes

Link copied to clipboard
open override val bview: View
Link copied to clipboard
open override val bviewAll: List<View>
Link copied to clipboard

The multiplicative RGBA color.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var extra: ExtraType
Link copied to clipboard

An optional Filter attached to this view. Filters allow to render this view to a texture, and to control how to render that texture (using shaders, repeating the texture, etc.). You add multiple filters by creating a composite filter ComposedFilter.

Link copied to clipboard

Usually a value between 0.0, 1.0

Link copied to clipboard
Link copied to clipboard
open val frameHeight: Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val frameWidth: Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the global bounds of this object. Note this incurs in allocations. Use getGlobalBounds (out) to avoid it

Link copied to clipboard

Global transform Matrix. Matrix that concatenates all the affine transforms of this view and its ancestors.

Link copied to clipboard

The inverted version of the globalMatrix

Link copied to clipboard
Link copied to clipboard

Computed speed combining all the speeds from ancestors

Link copied to clipboard

Changes the height of this view. Generically, this means adjusting the scaleY of the view to match that size using the current bounds, but some views might override this to adjust its internal width or height (like SolidRect or UIView for example).

Link copied to clipboard
open var hitShape: VectorPath?
Link copied to clipboard
open override var hitShape2d: Shape2D
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var index: Int

The index the child has in its parent

Link copied to clipboard

Indicates if this class is a container or not. This is only overridden by Container. This check is performed like this, to avoid type checks. That might be an expensive operation in some targets.

Link copied to clipboard
Link copied to clipboard

Local transform MMatrix. If you plan to change its components manually instead of setting it directly, you should call the View.invalidate method.

Link copied to clipboard
var View.mask: View?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines if mouse events will be handled for this view and its children

Link copied to clipboard
var name: String?

Optional name of this view

Link copied to clipboard
Link copied to clipboard

Parent Container of this View if any, or null

Link copied to clipboard
var pos: Point
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Indicates if this view is going to propagate the events that reach this node to its children

Link copied to clipboard

The concatenated/global version of the local alpha

Link copied to clipboard

The concatenated/global version of the local alpha

Link copied to clipboard

The actual blendMode of the view after computing the ancestors and reaching a view with a non BlendMode.INHERIT.

Link copied to clipboard

The concatenated/global version of the local colorMul

Link copied to clipboard
Link copied to clipboard
val root: View

The ancestor view without parents. When attached (visible or invisible), this is the Stage. When no parents, it is this

Link copied to clipboard

Local rotation of this view

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Local scaling in the X axis of this view

Link copied to clipboard
Link copied to clipboard

Local scaling in the Y axis of this view

Link copied to clipboard
Link copied to clipboard
var size: Size
Link copied to clipboard

Local skewing in the X axis of this view

Link copied to clipboard

Local skewing in the Y axis of this view

Link copied to clipboard
Link copied to clipboard

Ratio speed of this node, affecting all the View.addUpdater

Link copied to clipboard
Link copied to clipboard
open val stage: Stage?

When included in the tree, this returns the stage. When not attached yet, this will return null.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var tint: RGBA

Alias for colorMul to make this familiar to people coming from other engines.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var unscaledSize: Size
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var visible: Boolean

Determines if the view will be displayed or not. It is different to alpha=0, since the render method won't be executed. Usually giving better performance. But also not receiving events.

Link copied to clipboard

Changes the width of this view. Generically, this means adjusting the scaleX of the view to match that size using the current bounds, but some views might override this to adjust its internal width or height (like SolidRect or UIView for example).

Link copied to clipboard

Returns the global bounds of this object. Note this incurs in allocations. Use getGlobalBounds (out) to avoid it

Link copied to clipboard
var x: Double

Local X position of this view

Link copied to clipboard
var y: Double

Local Y position of this view

Link copied to clipboard

Functions

Link copied to clipboard

Like setTransform but without invalidation. If used at all, should be used with care and invalidate when required.

Link copied to clipboard
Link copied to clipboard
fun View?.allDescendants(out: ArrayList<View> = arrayListOf()): List<View>
Link copied to clipboard
fun View?.ancestorsUpTo(target: View?): List<View>

Returns a list of all the ancestors including this in order to reach from this view to the target view, or a list of all the ancestors in the case target is not an ancestor.

Link copied to clipboard
suspend fun View.animate(defaultTime: TimeSpan = Animator.DEFAULT_TIME, defaultSpeed: Double = Animator.DEFAULT_SPEED, defaultEasing: Easing = Animator.DEFAULT_EASING, parallel: Boolean = false, looped: Boolean = false, completeOnCancel: Boolean = false, startImmediately: Boolean = Animator.DEFAULT_START_IMMEDIATELY, block: Animator.() -> Unit = {}): Animator
Link copied to clipboard
fun View.animator(defaultTime: TimeSpan = Animator.DEFAULT_TIME, defaultSpeed: Double = Animator.DEFAULT_SPEED, defaultEasing: Easing = Animator.DEFAULT_EASING, parallel: Boolean = false, looped: Boolean = false, startImmediately: Boolean = Animator.DEFAULT_START_IMMEDIATELY, block: Animator.() -> Unit = {}): Animator
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun BView.bviewFastForEach(block: (view: View) -> Unit)
Link copied to clipboard
fun <T : BEvent> clearEvents(type: EventType<T>)
Link copied to clipboard
open fun clone(): View

Allows to clone this view. This method is inadvisable in normal circumstances. This might not work properly if the View doesn't override the createInstance method.

Link copied to clipboard
fun View?.commonAncestor(ancestor: View?): View?
Link copied to clipboard
fun View.convertToSpace(srcPoint: Point, dst: View): Point
Link copied to clipboard
open fun copyPropsFrom(source: View)

Allows to copy the basic properties (transform localMatrix, visible, colorMul, speed, name...) from source into this

Link copied to clipboard
suspend fun View.delay(time: TimeSpan)
Link copied to clipboard
suspend fun View.delayFrame()
Link copied to clipboard
inline fun <T> View?.descendantsOfType(): List<T>
Link copied to clipboard
fun View?.descendantsWith(out: ArrayList<View> = arrayListOf(), check: (View) -> Boolean): List<View>

Returns a list of descendants including this that matches the check method. Allows to provide an out array to reduce allocations.

Link copied to clipboard
override fun <T : BEvent> dispatch(event: T): Boolean
override fun <T : BEvent> dispatch(type: EventType<T>, event: T, result: EventResult?): Boolean

open override fun <T : BEvent> dispatch(type: EventType<T>, event: T, result: EventResult?, up: Boolean, down: Boolean): Boolean

Dispatched a event of type that will execute all the handlers registered with onEvents in this object and its children.

Link copied to clipboard
open fun <T : BEvent> dispatchChildren(type: EventType<T>, event: T, result: EventResult?)
Link copied to clipboard
open fun <T : BEvent> dispatchDown(type: EventType<T>, event: T, result: EventResult? = null): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun <T : BEvent> dispatchParent(type: EventType<T>, event: T, result: EventResult?)
Link copied to clipboard
open fun <T : BEvent> dispatchUp(type: EventType<T>, event: T, result: EventResult? = null): Boolean
Link copied to clipboard
Link copied to clipboard
override fun <T : BEvent> dispatchWithResult(event: T, out: EventResult): EventResult
Link copied to clipboard
fun View?.dump(indent: String = "", emit: (String) -> Unit = ::println)

Dumps a view and its children for debugging purposes. The emit block parameter allows to define how to print those results.

Link copied to clipboard

Dumps a view and its children for debugging purposes into a String.

Link copied to clipboard
fun View?.findFirstAscendant(cond: (view: View) -> Boolean): View?
Link copied to clipboard
fun View?.findLastAscendant(cond: (view: View) -> Boolean): View?
Link copied to clipboard
open fun findViewByName(name: String): View?

Allows to find a descendant view whose View.name property is name. Returns null if can't find any.

Link copied to clipboard
fun View?.firstAncestor(includeThis: Boolean = true, condition: (View) -> Boolean): View?
Link copied to clipboard
inline fun <T : View> View?.firstAncestorOfType(includeThis: Boolean = true): T?
Link copied to clipboard

Tries to find a view matching the check method or null if none is found

Link copied to clipboard
inline fun View?.forEachAscendant(includeThis: Boolean = false, handler: (View) -> Unit)
Link copied to clipboard
inline fun forEachChild(callback: (child: View) -> Unit): Unit?

Iterates all the children of this container in normal order of rendering.

Link copied to clipboard
inline fun forEachChildren(callback: (child: View) -> Unit): Unit?

Iterates all the children of this container in normal order of rendering.

Link copied to clipboard
inline fun forEachChildrenReversed(callback: (child: View) -> Unit): Unit?

Iterates all the children of this container in reverse order of rendering.

Link copied to clipboard
inline fun forEachChildrenWithIndex(callback: (index: Int, child: View) -> Unit): Unit?

Iterates all the children of this container in normal order of rendering. Providing an index in addition to the child to the callback.

Link copied to clipboard
inline fun forEachChildReversed(callback: (child: View) -> Unit): Unit?

Iterates all the children of this container in reverse order of rendering.

Link copied to clipboard
inline fun forEachChildWithIndex(callback: (index: Int, child: View) -> Unit): Unit?

Iterates all the children of this container in normal order of rendering. Providing an index in addition to the child to the callback.

Link copied to clipboard
fun View?.foreachDescendant(handler: (View) -> Unit)

Iterates all the descendant Views including this calling the handler. Iteration happens in Pre-order (NLR).

Link copied to clipboard
inline fun <T> View.gamepad(callback: GamePadEvents.() -> T): T
Link copied to clipboard
inline fun <T> View.gestures(callback: GestureEvents.() -> T): T
Link copied to clipboard
operator fun View?.get(name: String): QView

Indexer that allows to get a descendant marked with the name name.

Link copied to clipboard
fun getBounds(target: View? = this, doAnchoring: Boolean = true, inclusive: Boolean = false, includeFilters: Boolean = false): Rectangle
Link copied to clipboard
fun getBoundsInSpace(viewSpace: View?, doAnchoring: Boolean = true, includeFilters: Boolean = false): Rectangle

Get the bounds of the current this view in another view viewSpace.

Link copied to clipboard
fun getBoundsNoAnchoring(target: View? = this, inclusive: Boolean = false, includeFilters: Boolean = false): Rectangle

Get the bounds of this view, using the target view as coordinate system. Not providing a target will return the local bounds. Allows to specify out to prevent allocations.

Link copied to clipboard
Link copied to clipboard
fun getConcatMatrix(target: View, inclusive: Boolean = false): Matrix

Gets the concatenated MMatrix of this View up to the target view. If inclusive is true, the concatenated matrix will include the target view too. Allows to define an out matrix that will hold the result to prevent allocations.

Link copied to clipboard
fun getConcatMatrixAccurateSlow(target: View, inclusive: Boolean = false): Matrix
Link copied to clipboard

Returns a list of descendants views that are of type T.

Link copied to clipboard
fun getGlobalBounds(includeFilters: Boolean = false): Rectangle

Returns the global bounds of this object.

Link copied to clipboard
fun getLocalBounds(doAnchoring: Boolean = true, includeFilters: Boolean = false): Rectangle

Get local bounds of the view.

Link copied to clipboard
open override fun getLocalBoundsInternal(): RectangleD
Link copied to clipboard
Link copied to clipboard
inline fun <T : ViewRenderPhase> getOrCreateAndAddRenderPhase(create: () -> T): T
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Converts the global point p (using root/stage as reference) into the local coordinate system. Allows to define out to avoid allocation.

Link copied to clipboard
Link copied to clipboard
fun View.hasAncestor(ancestor: View): Boolean

Checks if this view has the specified ancestor.

Link copied to clipboard
open fun hitTest(globalPos: Point, direction: HitTestDirection = HitTestDirection.ANY): View?

Determines the view at the global point defined by xD and yD if any, or null

Link copied to clipboard
open override fun hitTestAny(p: Point, direction: HitTestDirection): Boolean
Link copied to clipboard
fun hitTestLocal(p: Point, direction: HitTestDirection = HitTestDirection.ANY): View?
Link copied to clipboard
fun hitTestShape(shape: Shape2D, matrix: Matrix, direction: HitTestDirection = HitTestDirection.ANY): View?
Link copied to clipboard
fun hitTestView(view: View, direction: HitTestDirection = HitTestDirection.ANY): View?
fun hitTestView(views: List<View>, direction: HitTestDirection = HitTestDirection.ANY): View?
Link copied to clipboard
fun View.interval(time: TimeSpan, callback: () -> Unit): Closeable
Link copied to clipboard
fun View.intervalAndNow(time: TimeSpan, callback: () -> Unit): Closeable
Link copied to clipboard
open fun invalidate()

Invalidates the View after changing some of its properties so the geometry can be computed again. If you change the localMatrix directly, you should call invalidateMatrix instead.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Invalidates the localMatrix, so it gets updated from the decomposed properties: xD, yD, scaleXD, scaleYD, rotation, skewX and skewY.

Link copied to clipboard
open override fun invalidateRender()
Link copied to clipboard
fun View?.isDescendantOf(other: View, include: Boolean = true): Boolean
Link copied to clipboard
inline fun <T> View.keys(callback: KeysEvents.() -> T): T
Link copied to clipboard

Computes the local X and Y coordinates of the mouse using the coords from the Views object

Link copied to clipboard

Converts the local point p into a global point (using root/stage as reference). Allows to define out to avoid allocation.

Link copied to clipboard
fun localToWindow(views: Views, p: Point): Point

Converts the local point p into a point in window coordinates.

Link copied to clipboard
fun View.makeFocusable(tabIndex: Int = 0, onChanged: (value: Boolean) -> Unit = {}): UIFocusable
Link copied to clipboard

x and y are in global coordinates

Link copied to clipboard
inline fun View.newKeys(callback: KeysEvents.() -> Unit): KeysEvents
Link copied to clipboard
inline fun View.newMouse(callback: MouseEvents.() -> Unit): MouseEvents
Link copied to clipboard
inline fun View.nextView(filter: (View) -> Boolean): View?
Link copied to clipboard
inline fun <T> View.nextViewOfType(): T?
Link copied to clipboard

Handles a DropFileEvent. The event happens when a drag&drop file over the window happens.

Link copied to clipboard
override fun <T : BEvent> onEvent(type: EventType<T>, handler: (T) -> Unit): CloseableCancellable

Registers a handler block to be executed when an event of type is dispatched

Link copied to clipboard
override fun onEventCount(type: EventType<*>): Int
Link copied to clipboard
open fun <T : BEvent> onEvents(vararg etypes: EventType<out T>, handler: (T) -> Unit): Closeable
Link copied to clipboard
Link copied to clipboard
operator fun View?.plusAssign(view: View?)

Adds the specified view to this view only if this view is a Container.

Link copied to clipboard
inline fun View.prevView(filter: (View) -> Boolean): View?
Link copied to clipboard
inline fun <T> View.prevViewOfType(): T?
Link copied to clipboard
fun View.removeFilter(filter: Filter)
Link copied to clipboard

Removes this view from its parent.

Link copied to clipboard
Link copied to clipboard
override fun render(ctx: RenderContext)

The render method that is in charge of rendering. This method receives the ctx that allows to buffer geometry to be drawn in batches.

Link copied to clipboard
inline fun View.renderCtx2d(ctx: RenderContext, crossinline block: (RenderContext2D) -> Unit)
Link copied to clipboard
open fun renderDebug(ctx: RenderContext)
Link copied to clipboard
fun View.renderFiltered(ctx: RenderContext, filter: Filter, first: Boolean = true)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun View.renderToBitmap(views: Views? = this.stage?.views, region: Rectangle? = null, scale: Double = 1.0, outPoint: Ref<Point>? = null, includeBackground: Boolean = false): Bitmap32

Asynchronously renders this View (with the provided views) to a Bitmap32 and returns it. The rendering will happen before the next frame.

Link copied to clipboard

Converts a point p in the nearest ancestor marked as View.Reference into the local coordinate system. Allows to define out to avoid allocation.

Link copied to clipboard
inline fun <T : ViewRenderPhase> replaceRenderPhase(create: () -> T)
Link copied to clipboard

Replaces this view in its parent with view. Returns true if the replacement was successful. If this view doesn't have a parent or view is the same as this, returns false.

Link copied to clipboard
open fun reset()

Resets the View properties to an identity state.

Link copied to clipboard

Scroll ancestors to make this view is visible

Link copied to clipboard

Tries to set the global bounds of the object. If there are rotations in the ancestors, this might not work as expected.

Link copied to clipboard
fun View?.setHtml(html: String)
Link copied to clipboard
fun setMatrix(matrix: Matrix)

Sets the local transform matrix that includes xD, yD, scaleXD, scaleYD, rotation, skewX and skewY encoded into a Matrix

Link copied to clipboard

Like setMatrix but directly sets an interpolated version of the l and r matrices with the ratio

Link copied to clipboard
Link copied to clipboard
fun View?.setText(text: String)
Link copied to clipboard

Sets the MatrixTransform decomposed version of the transformation, that directly includes xD, yD, scaleXD, scaleYD, rotation, skewX and skewY.

Link copied to clipboard
fun View.singleTouch(removeTouch: Boolean = false, supportStartAnywhere: Boolean = false, block: SingleTouchHandler.(id: Int) -> Unit)
Link copied to clipboard
fun View.timeout(time: TimeSpan, callback: () -> Unit): Closeable
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun View.touch(block: TouchEvents.() -> Unit)
Link copied to clipboard
Link copied to clipboard
suspend fun BaseView?.tween(vararg vs: V2<*>, time: TimeSpan = DEFAULT_TIME, easing: Easing = DEFAULT_EASING, waitTime: TimeSpan = TimeSpan.NIL, timeout: Boolean = false, autoInvalidate: Boolean = true, callback: (Float) -> Unit = { })

Creates a tween that will take a specified time to execute, with an optional easing.

Link copied to clipboard
suspend fun BaseView?.tweenAsync(vararg vs: V2<*>, time: TimeSpan = DEFAULT_TIME, easing: Easing = DEFAULT_EASING, waitTime: TimeSpan = TimeSpan.NIL, callback: (Float) -> Unit = {}): Deferred<Unit>
fun BaseView?.tweenAsync(vararg vs: V2<*>, coroutineContext: CoroutineContext, time: TimeSpan = DEFAULT_TIME, easing: Easing = DEFAULT_EASING, waitTime: TimeSpan = TimeSpan.NIL, callback: (Float) -> Unit = {}): Deferred<Unit>
Link copied to clipboard
fun BaseView?.tweenNoWait(vararg vs: V2<*>, time: TimeSpan = DEFAULT_TIME, easing: Easing = DEFAULT_EASING, waitTime: TimeSpan = TimeSpan.NIL, callback: (Float) -> Unit = { }): TweenComponent?
Link copied to clipboard
fun View.unsafeRenderToBitmapSync(ctx: RenderContext, region: Rectangle? = null, scale: Double = 1.0, outPoint: Ref<Point>? = null, useTexture: Boolean = true, bgcolor: RGBA = Colors.TRANSPARENT): Bitmap32
Link copied to clipboard
fun View.updateSingleView(delta: TimeSpan, tempUpdate: UpdateEvent = UpdateEvent())
Link copied to clipboard