ass_renderer/layout/positioning/
coords.rs1pub fn scale_coordinates(
3 x: f32,
4 y: f32,
5 play_res_x: f32,
6 play_res_y: f32,
7 screen_width: f32,
8 screen_height: f32,
9) -> (f32, f32) {
10 let scale_x = screen_width / play_res_x;
11 let scale_y = screen_height / play_res_y;
12 (x * scale_x, y * scale_y)
13}
14
15pub fn convert_ssa_alignment(ssa_align: u8) -> u8 {
17 let h_align = ssa_align & 3;
20 let v_align = (ssa_align >> 2) & 3;
21
22 let h_part = match h_align {
23 1 => 1, 2 => 2, 3 => 3, _ => 2, };
28
29 let v_part = match v_align {
30 0 => 0, 1 | 3 => 3, 2 => 6, _ => 0, };
35
36 h_part + v_part
37}