pub fn by_margins_with_content(
        top_margin: u32,
        bottom_margin: u32,
        left_margin: u32,
        right_margin: u32,
        content: T,
    ) -> Self {
        let top = vec![
            Patch {
                original_size: Size::new(left_margin as i32, top_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    top_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(right_margin as i32, top_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
        ];
        let middle = vec![
            Patch {
                original_size: Size::new(
                    left_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Undefined, Val::Auto),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Auto),
                content: Some(content),
            },
            Patch {
                original_size: Size::new(
                    right_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Undefined, Val::Auto),
                content: None,
            },
        ];
        let bottom = vec![
            Patch {
                original_size: Size::new(left_margin as i32, bottom_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    bottom_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(right_margin as i32, bottom_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
        ];
        Self {
            patches: vec![top, middle, bottom],
            patch_textures: None,
            original_texture: None,
        }
    }
/// Create a simple nine patch split by creating fixed patch for the margins, and growing patches inside
Create a simple nine patch split by creating fixed patch for the margins, and growing patches inside
Create a simple nine patch split by creating fixed patch for the margins and growing patches inside
pub fn by_margins_with_content(
        top_margin: u32,
        bottom_margin: u32,
        left_margin: u32,
        right_margin: u32,
        content: T,
    ) -> Self {
        let top = vec![
            Patch {
                original_size: Size::new(left_margin as i32, top_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    top_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(right_margin as i32, top_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
        ];
        let middle = vec![
            Patch {
                original_size: Size::new(
                    left_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Undefined, Val::Auto),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Auto),
                content: Some(content),
            },
            Patch {
                original_size: Size::new(
                    right_margin as i32,
                    -(top_margin as i32) - bottom_margin as i32,
                ),
                target_size: Size::new(Val::Undefined, Val::Auto),
                content: None,
            },
        ];
        let bottom = vec![
            Patch {
                original_size: Size::new(left_margin as i32, bottom_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(
                    -(left_margin as i32) - right_margin as i32,
                    bottom_margin as i32,
                ),
                target_size: Size::new(Val::Auto, Val::Undefined),
                content: None,
            },
            Patch {
                original_size: Size::new(right_margin as i32, bottom_margin as i32),
                target_size: Size::new(Val::Undefined, Val::Undefined),
                content: None,
            },
        ];
        Self {
            patches: vec![top, middle, bottom],
            patch_textures: None,
            original_texture: None,
        }
    }
pub fn by_margins_with_content ( top_margin : u32 , bottom_margin : u32 , left_margin : u32 , right_margin : u32 , content : T , ) -> Self { let top = vec ! [ Patch { original_size Size new ( left_margin as i32 top_margin as i32 ) target_size Size new ( Val Undefined Val Undefined ) content None } Patch { original_size Size new ( ( left_margin as i32 ) right_margin as i32 top_margin as i32 ) target_size Size new ( Val Auto Val Undefined ) content None } Patch { original_size Size new ( right_margin as i32 top_margin as i32 ) target_size Size new ( Val Undefined Val Undefined ) content None } ] ; let middle = vec ! [ Patch { original_size Size new ( left_margin as i32 ( top_margin as i32 ) bottom_margin as i32 ) target_size Size new ( Val Undefined Val Auto ) content None } Patch { original_size Size new ( ( left_margin as i32 ) right_margin as i32 ( top_margin as i32 ) bottom_margin as i32 ) target_size Size new ( Val Auto Val Auto ) content Some ( content ) } Patch { original_size Size new ( right_margin as i32 ( top_margin as i32 ) bottom_margin as i32 ) target_size Size new ( Val Undefined Val Auto ) content None } ] ; let bottom = vec ! [ Patch { original_size Size new ( left_margin as i32 bottom_margin as i32 ) target_size Size new ( Val Undefined Val Undefined ) content None } Patch { original_size Size new ( ( left_margin as i32 ) right_margin as i32 bottom_margin as i32 ) target_size Size new ( Val Auto Val Undefined ) content None } Patch { original_size Size new ( right_margin as i32 bottom_margin as i32 ) target_size Size new ( Val Undefined Val Undefined ) content None } ] ; Self { patches : vec ! [ top middle bottom ] , patch_textures : None , original_texture : None , } }
Create a simple nine patch split by creating fixed patch for the margins, and growing patches inside
Create a simple nine patch split by creating fixed patch for the margins and growing patches inside
top_margin
u32
bottom_margin
u32
left_margin
u32
right_margin
u32
content
T