Assets
APIs for image assets and rendering options.
Image
Drawable image asset. In GPU shader workflows, an image can also expose a GPUTextureView through image:view().
Attributes
| Attribute | Type | Description |
|---|---|---|
width | number | Width in pixels (read-only) |
height | number | Height in pixels (read-only) |
Methods
image:view()
Returns a GPUTextureView for sampling the image from a shader.
Release tier: Preview / rollout-dependent
image:view(): GPUTextureView
Example:
local image = context:image("portrait")
if image then
local view = image:view()
end
Use the returned view in a shader bind group:
textures = {{ slot = 1, view = image:view() }}
See Also: Renderer.drawImage, GPU Shaders
ImageFilter
Defines image sampling behavior during scaling or transformation.
Values
| Value | Description |
|---|---|
bilinear | Smooth filtering (default) |
nearest | Pixel-perfect, no interpolation |
See Also: Image, ImageSampler
ImageSampler
Sampling parameters applied when drawing an image, combining wrapping and filtering behavior.
Constructor
ImageSampler(wrapX, wrapY, filter)
Creates an ImageSampler with the specified wrapping and filtering options.
ImageSampler(wrapX: ImageWrap, wrapY: ImageWrap, filter: ImageFilter): ImageSampler
Example
local sampler = ImageSampler("clamp", "clamp", "bilinear")
renderer:drawImage(image, sampler, "srcOver", 1.0)
See Also: ImageFilter, ImageWrap
ImageWrap
Defines how texture coordinates outside the [0, 1] range are handled.
Values
| Value | Description |
|---|---|
clamp | Clamps coordinates to [0, 1] range |
repeat | Tiles the texture by repeating |
mirror | Mirrors the texture at boundaries |
See Also: ImageSampler, Image
Blob
Binary data asset accessed via context:blob(name).
Attributes
| Attribute | Type | Description |
|---|---|---|
name | string | Asset name (read-only) |
size | number | Data size in bytes (read-only) |
data | buffer | Raw binary data (read-only) |
See Also: Context
DecodedImage
Raw decoded pixel payload returned by context:decodeImage(buffer).
Release tier: Officially released (advanced surface)
Attributes
| Attribute | Type | Description |
|---|---|---|
data | buffer | Premultiplied RGBA8 bytes (width * height * 4) |
width | number | Width in pixels |
height | number | Height in pixels |
Example
local run = async(function()
local ok, decoded = await(context:decodeImage(blob.data))
if ok and decoded then
print(decoded.width, decoded.height)
end
end)
See Also: Context.decodeImage, Promise, Runtime Compatibility Baseline
AudioSource
Opaque audio asset reference obtained via context:audio(name). Pass to Audio.play() to produce an AudioSound.
Attributes
| Attribute | Type | Description |
|---|---|---|
duration | number | Source duration in seconds (read-only) |
Example
function init(self: MyScript, context: Context): boolean
local source = context:audio("click")
if source then
print("duration:", source.duration)
end
return true
end
See Also: Audio, AudioSound, Context
AudioSound
A playing audio instance returned by Audio.play() and related methods.
Attributes
| Attribute | Type | Access | Description |
|---|---|---|---|
volume | number | read/write | Playback volume |
Methods
sound:stop()
Stops playback.
sound:stop()
sound:seek(seconds)
Seeks to a specific time in seconds.
sound:seek(seconds: number)
sound:seekFrame(frame)
Seeks to a specific frame.
sound:seekFrame(frame: number)
sound:completed()
Returns true if playback has finished.
sound:completed(): boolean
sound:time()
Returns current playback time in seconds.
sound:time(): number
sound:timeFrame()
Returns current playback time in frames.
sound:timeFrame(): number
See Also: Audio, AudioSource
Next Steps
- Continue to Path Effects
- Verify version status in Runtime Compatibility Baseline
- Need a refresher? Review Quick Reference