use super::types::PixelRect;
pub fn get_geometric_shape_rect(
ch: char,
cell_x: f32,
cell_y: f32,
cell_w: f32,
cell_h: f32,
) -> Option<PixelRect> {
match ch {
'\u{25A0}' => {
let size = cell_w;
Some(PixelRect {
x: cell_x,
y: cell_y + (cell_h - size) / 2.0,
width: size,
height: size,
})
}
'\u{25AA}' => {
let size = cell_w * 0.5;
Some(PixelRect {
x: cell_x + (cell_w - size) / 2.0,
y: cell_y + (cell_h - size) / 2.0,
width: size,
height: size,
})
}
'\u{25AC}' => {
let h = cell_h * 0.33;
Some(PixelRect {
x: cell_x,
y: cell_y + (cell_h - h) / 2.0,
width: cell_w,
height: h,
})
}
'\u{25AE}' => {
let w = cell_w * 0.5;
Some(PixelRect {
x: cell_x + (cell_w - w) / 2.0,
y: cell_y,
width: w,
height: cell_h,
})
}
'\u{25FC}' => {
let size = cell_w * 0.75;
Some(PixelRect {
x: cell_x + (cell_w - size) / 2.0,
y: cell_y + (cell_h - size) / 2.0,
width: size,
height: size,
})
}
'\u{25FE}' => {
let size = cell_w * 0.625;
Some(PixelRect {
x: cell_x + (cell_w - size) / 2.0,
y: cell_y + (cell_h - size) / 2.0,
width: size,
height: size,
})
}
_ => None,
}
}