public abstract class RemoteImageBitmap internal constructor(
public override val constantValueOrNull: ImageBitmap?,
cacheKey: RemoteStateCacheKey,
) : BaseRemoteState<ImageBitmap>(cacheKey)
Abstract base class for all remote bitmap representations in Compose Remote, this class extends RemoteState<ImageBitmap>.
RemoteImageBitmap represents an image value that can be a constant, a named variable, or an offscreen buffer.
Properties
width
public val width: RemoteFloat
The width of the bitmap as represented in the remote document.
height
public val height: RemoteFloat
The height of the bitmap as represented in the remote document.
Members
Companion
public companion object
Properties
IntrinsicSize
public val IntrinsicSize: IntSize = IntSize.Zero
Sentinel IntSize (0x0) indicating that a URL-backed RemoteImageBitmap should derive its dimensions from the loaded image at runtime rather than enforcing fixed bounds.
Functions
invoke
public operator fun invoke(value: ImageBitmap): RemoteImageBitmap
Creates a RemoteImageBitmap instance from a ImageBitmap value.
Parameters
| value | The ImageBitmap value. |
Return
A RemoteImageBitmap representing the provided bitmap.
invoke
public operator fun invoke(url: String): RemoteImageBitmap
Creates a RemoteImageBitmap from a URL.
Parameters
| url | The URL of the image. |
Return
A RemoteImageBitmap representing the image from the URL.
createNamedRemoteImageBitmap
public fun createNamedRemoteImageBitmap(
name: String,
defaultValue: ImageBitmap,
domain: RemoteState.Domain = RemoteState.Domain.User,
): RemoteImageBitmap
Creates a named RemoteImageBitmap with an initial value.
Named remote bitmaps can be set via AndroidRemoteContext.setNamedBitmap.
Parameters
| name | A unique name to identify this state within its domain. |
| defaultValue | The initial ImageBitmap value for the named remote bitmap. |
| domain | The domain for the named state. Defaults to RemoteState.Domain.User. |
Return
A RemoteImageBitmap representing the named bitmap.
createNamedRemoteImageBitmap
public fun createNamedRemoteImageBitmap(
name: String,
domain: RemoteState.Domain = RemoteState.Domain.User,
value: () -> ImageBitmap,
): RemoteImageBitmap
Creates a named RemoteImageBitmap from a lambda providing the initial ImageBitmap.
Parameters
| name | A unique name to identify this state within its domain. |
| domain | The domain for the named state. Defaults to RemoteState.Domain.User. |
| value | A lambda that provides the initial ImageBitmap. |
Return
A RemoteImageBitmap representing the named bitmap.
createNamedRemoteImageBitmap
public fun createNamedRemoteImageBitmap(
name: String,
url: String,
domain: RemoteState.Domain = RemoteState.Domain.User,
): RemoteImageBitmap
Creates a named RemoteImageBitmap backed by an image url.
Defaults to 1x1 dimensions for compatibility with existing players. Pass IntrinsicSize to the size overload to instruct updated players to take the actual size from the loaded image.
Parameters
| name | unique name to identify this state within its domain |
| url | URL of the image |
| domain | domain for the named state, defaults to RemoteState.Domain.User |
Return
a RemoteImageBitmap for the named bitmap