ExternalTexture
Use an external texture for video, camera previews, or GPU output when HuxerUI should own layout, input, and composition.
Share one producer identity
Section titled “Share one producer identity”#include <huxerui/huxerui.h>
#include <memory>
using namespace huxerui;
View Preview(const std::shared_ptr<ExternalTexture>& texture) { if (!texture) { return Text("No preview"); } return Image(texture) .Fit(ImageFit::Cover) .With(Frame{.height = 180.0F});}The integration constructs a supported platform texture; consumers share the pointer. Publishing frames does not need per-frame State updates.
Lifetime and alternatives
Section titled “Lifetime and alternatives”IntrinsicSize() describes immutable logical geometry; frame pixels may have a different resolution. Revision() detects publications, and IsActive() is a hint that a Runtime is displaying the texture. The producer still owns start, pause, and finish policy.
Use a static Image for encoded resources, or PlatformView when the platform object must retain its own interaction and accessibility.
See producer integration and the API reference.
Separate consumer and producer lifetime
Section titled “Separate consumer and producer lifetime”Image holds shared texture ownership while mounted, but it does not own the media device or worker that produces frames. Start/stop that producer in its owning Lifecycle or platform service, publish through the backend’s supported texture API, and keep platform resource release on the thread required by that API. An IsActive() observation is useful for throttling; it is not a guarantee that the producer can forget its own shutdown path.
Intrinsic geometry belongs to the texture identity. A differently sized frame buffer is not an implicit layout update; create the appropriate logical texture identity when the layout contract changes. Revision() identifies new publications, not application State versions. Let publication invalidate rendering instead of writing a timestamp to State on every frame.
This path supplies pixels, not a platform control’s focus, keyboard, or semantic tree. Overlay ordinary HuxerUI controls and provide a meaningful semantic description on the consumer when necessary. Platform resource types and synchronization examples are in the ExternalTexture reference; do not cast one backend’s texture wrapper to another.

