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.
Description
Section titled “Description”The handle comes from a supplier, read again at each use, so that the host can recreate its texture.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| BorrowedTexture(Supplier | Creates the texture over the supplier of the handle of the host. |
Methods
Section titled “Methods”Position and size
Section titled “Position and size”| Returns | Signature | Summary |
|---|---|---|
int | getWidth() | Returns the width of the current handle, or 0 when the supplier returns null. |
int | getHeight() | Returns the height of the current handle, or 0 when the supplier returns null. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
boolean | isMipmapped() | If true, the current handle has mipmap levels. |
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. |
Supplier<H> | getSupplier() | Returns the supplier of the handle. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
this | mipmap(boolean mipmap) fluent | Does 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. |
void | delete() | Does nothing: the host deletes its texture. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
int | getWidth(H handle) hook abstract protected | Returns the width of the handle, in pixels; JOID calls it with the current handle. |
int | getHeight(H handle) hook abstract protected | Returns the height of the handle, in pixels; JOID calls it with the current handle. |
boolean | isValid(H handle) hook abstract protected | Returns true when the handle names a live texture; JOID calls it with the current handle. |
boolean | isMipmapped(H handle) hook abstract protected | Returns true when the handle has mipmap levels; JOID calls it with the current handle. |
Inherited from ITexture (1)
Creation details
Section titled “Creation details”BorrowedTexture
Section titled “BorrowedTexture”BorrowedTexture(Supplier<H> supplier) protected
Creates the texture over the supplier of the handle of the host.
Method details
Section titled “Method details”getWidth
Section titled “getWidth”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.
getHeight
Section titled “getHeight”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.
isMipmapped
Section titled “isMipmapped”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.
getHandle
Section titled “getHandle”H getHandle()
Returns the current handle of the host, or null.
isValid
Section titled “isValid”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.
getSupplier
Section titled “getSupplier”Supplier<H> getSupplier()
Returns the supplier of the handle.
mipmap
Section titled “mipmap”this mipmap(boolean mipmap) fluent
Does nothing: the host decides the levels of its texture.
allocate
Section titled “allocate”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.
upload
Section titled “upload”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.
delete
Section titled “delete”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
