Skip to content

BorrowedTexture

abstract class BorrowedTexture<H>
Implements: ITexture
Known subtypes: GlBorrowedTexture, VulkanBorrowedTexture
Package: dev.joid.lib.bridge.render.texture · Module: core · Source: BorrowedTexture.java

The base class of a texture that belongs to the host: JOID samples it and reads its size, and never allocates, writes or deletes it.

The handle comes from a supplier, read again at each use, so that the host can recreate its texture.

ReturnsSignatureSummary
BorrowedTexture(Supplier supplier) protectedCreates the texture over the supplier of the handle of the host.

ReturnsSignatureSummary
intgetWidth()Returns the width of the current handle, or 0 when the supplier returns null.
intgetHeight()Returns the height of the current handle, or 0 when the supplier returns null.
ReturnsSignatureSummary
booleanisMipmapped()If true, the current handle has mipmap levels.
HgetHandle()Returns the current handle of the host, or null.
booleanisValid()If true, the supplier returns a handle that names a texture of the host.
Supplier<H>getSupplier()Returns the supplier of the handle.
ReturnsSignatureSummary
thismipmap(boolean mipmap) fluentDoes nothing: the host decides the levels of its texture.
BorrowedTexture<H>allocate(int width, int height)Throws an UnsupportedOperationException: JOID never allocates a texture of the host.
BorrowedTexture<H>upload(int[] pixels)Throws an UnsupportedOperationException: JOID never writes a texture of the host.
voiddelete()Does nothing: the host deletes its texture.
ReturnsSignatureSummary
intgetWidth(H handle) hook abstract protectedReturns the width of the handle, in pixels; JOID calls it with the current handle.
intgetHeight(H handle) hook abstract protectedReturns the height of the handle, in pixels; JOID calls it with the current handle.
booleanisValid(H handle) hook abstract protectedReturns true when the handle names a live texture; JOID calls it with the current handle.
booleanisMipmapped(H handle) hook abstract protectedReturns true when the handle has mipmap levels; JOID calls it with the current handle.
Inherited from ITexture (1)

isAllocated

BorrowedTexture(Supplier<H> supplier) protected

Creates the texture over the supplier of the handle of the host.

int getWidth()

Returns the width of the current handle, or 0 when the supplier returns null.

int getWidth(H handle) hook abstract protected

Returns the width of the handle, in pixels; JOID calls it with the current handle.

int getHeight()

Returns the height of the current handle, or 0 when the supplier returns null.

int getHeight(H handle) hook abstract protected

Returns the height of the handle, in pixels; JOID calls it with the current handle.

boolean isMipmapped()

If true, the current handle has mipmap levels.

boolean isMipmapped(H handle) hook abstract protected

Returns true when the handle has mipmap levels; JOID calls it with the current handle.

H getHandle()

Returns the current handle of the host, or null.

boolean isValid()

If true, the supplier returns a handle that names a texture of the host.

boolean isValid(H handle) hook abstract protected

Returns true when the handle names a live texture; JOID calls it with the current handle.

Supplier<H> getSupplier()

Returns the supplier of the handle.

this mipmap(boolean mipmap) fluent

Does nothing: the host decides the levels of its texture.

BorrowedTexture<H> allocate(int width, int height)

Throws:

  • UnsupportedOperationException: A borrowed texture belongs to its host: JOID reads it but never allocates it, create a texture with IRenderBridge.createTexture() to draw your own pixels

Throws an UnsupportedOperationException: JOID never allocates a texture of the host.

BorrowedTexture<H> upload(int[] pixels)

Throws:

  • UnsupportedOperationException: A borrowed texture belongs to its host: JOID reads it but never writes it, create a texture with IRenderBridge.createTexture() to draw your own pixels

Throws an UnsupportedOperationException: JOID never writes a texture of the host.

void delete()

Does nothing: the host deletes its texture.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page