add <image> widget

This commit is contained in:
galister
2025-12-23 22:10:46 +09:00
parent 17453ae1d9
commit b352269556
19 changed files with 686 additions and 26 deletions
+16 -1
View File
@@ -9,7 +9,10 @@ use crate::{
event::EventAlterables,
globals::Globals,
layout::Widget,
renderer_vk::text::{TextShadow, custom_glyph::CustomGlyph},
renderer_vk::text::{
custom_glyph::{CustomGlyph, CustomGlyphData},
TextShadow,
},
stack::{self, ScissorBoundary, ScissorStack, TransformStack},
widget::{self, ScrollbarInfo, WidgetState},
};
@@ -175,6 +178,17 @@ pub struct Rectangle {
pub round_units: u8,
}
#[derive(Clone)]
pub struct ImagePrimitive {
pub content: CustomGlyphData,
pub content_key: usize,
pub border: f32, // width in pixels
pub border_color: Color,
pub round_units: u8,
}
pub struct PrimitiveExtent {
pub(super) boundary: Boundary,
pub(super) transform: Mat4,
@@ -185,6 +199,7 @@ pub enum RenderPrimitive {
Rectangle(PrimitiveExtent, Rectangle),
Text(PrimitiveExtent, Rc<RefCell<Buffer>>, Option<TextShadow>),
Sprite(PrimitiveExtent, Option<CustomGlyph>), //option because we want as_slice
Image(PrimitiveExtent, ImagePrimitive),
ScissorSet(ScissorBoundary),
}