Skip to main content

emit_nines_geometry

Function emit_nines_geometry 

Source
pub fn emit_nines_geometry(
    size: (f32, f32),
    cell_rect: (f32, f32, f32, f32),
    margins: (f32, f32, f32, f32),
    fill_mode: NinesFillMode,
    out_box: &mut Vec<f32>,
    out_uv: &mut Vec<f32>,
    out_idx: &mut Vec<i32>,
) -> (u32, u32)
Expand description

Appends one Nine-Slice part’s geometry to the output buffers, ported from SsNines::createStretchPolygon / createTilePolygon.

out_box receives interleaved box coordinates (fx, fy) — 0 at the left / top edge, 1 at the right / bottom — which the caller maps into the part’s local-space box (and reuses to interpolate the four PartColor corners). out_uv receives interleaved texture-pixel UVs, out_idx triangle indices local to this part’s vertex range. Returns (vertex_count, index_count).

Tiling anchors the repeats the way the SDK does: horizontally from the left edge of each region and vertically from its bottom edge, so the clipped partial repeat lands on the right and at the top.