Expand description
图片基础设施(阶段 6:图片渲染)
架构:
- core 只持有 解码后的 RGBA 数据(
ImageData)与texture_id(全局原子分配,0 保留给 glyph atlas)。文件 IO 与 PNG/JPEG/WebP 解码在mgui-components::image_loader(image-decodefeature)完成, core 不碰文件系统与图像解码器。 - paint 输出复用 B2 的
PaintCommand::TexturedRect(uv 全图[0,0,1,1], texture_id = 图片纹理)。runtime 端按 texture_id 分段 set bind group。 BoxFit::Fill拉伸铺满 widget;BoxFit::Contain等比缩放居中 (letterbox,绘制矩形在 layout 时算好存dst_rect)。
ImageWidget 已迁移到 mgui-components crate。
Structs§
- Image
Data - 解码后的位图(直排 RGBA8,每像素 4 字节)
- Image
Render Object - 图片 RO:paint 输出一条
TexturedRect(uv 全图,texture_id 非 0)
Enums§
- BoxFit
- 图片填充模式
Functions§
- next_
image_ id - 分配一个全局唯一的图片 texture id