diff --git a/src/ink/widget/image.rs b/src/ink/widget/image.rs new file mode 100644 index 0000000..97d020b --- /dev/null +++ b/src/ink/widget/image.rs @@ -0,0 +1,34 @@ +use serde::{Deserialize, Serialize}; + +use crate::DepotPath; + +use super::Flags; + + +#[allow(non_camel_case_types)] +#[derive(Debug, Serialize, Clone, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct inkTextureAtlas { + depot_path: DepotPath, + flags: Flags, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub enum inkBrushMirrorType +{ + NoMirror = 0, + Horizontal = 1, + Vertical = 2, + Both = 3 +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub enum inkBrushTileType +{ + NoTile = 0, + Horizontal = 1, + Vertical = 2, + Both = 3 +} \ No newline at end of file diff --git a/src/ink/widget/mod.rs b/src/ink/widget/mod.rs index 83d14a2..0ca1f3b 100644 --- a/src/ink/widget/mod.rs +++ b/src/ink/widget/mod.rs @@ -5,6 +5,7 @@ mod font; pub(crate) mod implementation; +mod image; mod layout; mod properties; @@ -12,6 +13,7 @@ use enum_dispatch::enum_dispatch; pub use implementation::*; use serde::{Deserialize, Serialize}; +use serde_aux::prelude::deserialize_bool_from_anything; use crate::{DepotPath, Name}; @@ -19,8 +21,7 @@ use self::{ font::{ fontStyle, inkFontFamilyResource, textHorizontalAlignment, textLetterCase, textOverflowPolicy, textVerticalAlignment, - }, - layout::{inkEHorizontalAlign, inkEVerticalAlign, textJustificationType}, + }, image::{inkBrushMirrorType, inkBrushTileType, inkTextureAtlas}, layout::{inkEHorizontalAlign, inkEVerticalAlign, inkMargin, textJustificationType} }; use super::{HandleId, InkWrapper, LocalizationString}; @@ -106,7 +107,24 @@ native_leaf_widget!(inkTextWidget { pub scroll_delay: u16, pub scroll_text_speed: f32, }); -native_leaf_widget!(inkImageWidget); +native_leaf_widget!(inkImageWidget { + #[serde(deserialize_with = "deserialize_bool_from_anything")] + pub use_external_dynamic_texture: bool, + pub external_dynamic_texture: Name, + #[serde(deserialize_with = "deserialize_bool_from_anything")] + pub use_nine_slice_scale: bool, + pub nine_slice_scale: inkMargin, + pub mirror_type: inkBrushMirrorType, + pub tile_type: inkBrushTileType, + pub horizontal_tile_crop: f32, + pub vertical_tile_crop: f32, + pub texture_atlas: inkTextureAtlas, + pub texture_part: Name, + pub content_h_align: inkEHorizontalAlign, + pub content_v_align: inkEVerticalAlign, + pub tile_h_align: inkEHorizontalAlign, + pub tile_v_align: inkEVerticalAlign, +}); native_leaf_widget!(inkVideoWidget); native_leaf_widget!(inkMaskWidget); native_leaf_widget!(inkBorderWidget);