valo
Reference

Image

A GPU texture the host uploaded, then drew into a rectangle.

Valo never decodes files. The host supplies decoded RGBA8 pixels (or a GPU texture it already owns). The result is an Image you record with draw_image_rect.

use valo::ImageDesc;

let image = context.upload_image(
    ImageDesc {
        size: [width, height],
        premultiplied: false,
        mips: true,
    },
    &pixels, // width * height * 4 bytes, straight RGBA8
);
builder.draw_image_rect(&image, src, dst, Sampling::default(), &paint);
const image = renderer.uploadRgba(width, height, pixels, false, true);
builder.drawImageRect(
  image,
  0, 0, width, height,
  40, 40, 240, 140,
  0, 1, 0, 0, // filter, mipmap, tileX, tileY
  paint,
);

Upload needs a renderer, which the scene widget does not expose. Record geometry on Paint or Path instead; those canvases share the same device.

The paint's alpha, blend mode, and mask blur apply; its RGB channels are ignored. Enable mips when the image may be drawn smaller than its source size.

Browser uploads

JavaScript can also upload an ImageBitmap or copy a live DOM source (HTMLImageElement, canvas, video, VideoFrame):

const image = renderer.uploadImageBitmap(bitmap);
renderer.refreshExternalImage(image, video); // after each video frame

Display lists retain the image. Dropping every JavaScript handle releases the texture after in-flight GPU use finishes.

Next: FontCollection.

On this page