1use libcamera_sys::*;
2
3#[derive(Debug, Clone, Copy)]
5pub struct Point {
6 pub x: i32,
7 pub y: i32,
8}
9
10impl From<libcamera_point_t> for Point {
11 fn from(p: libcamera_point_t) -> Self {
12 Self { x: p.x, y: p.y }
13 }
14}
15
16#[derive(Debug, Clone, Copy)]
18pub struct Size {
19 pub width: u32,
20 pub height: u32,
21}
22
23impl From<libcamera_size_t> for Size {
24 fn from(s: libcamera_size_t) -> Self {
25 Self {
26 width: s.width,
27 height: s.height,
28 }
29 }
30}
31
32impl From<Size> for libcamera_size_t {
33 fn from(s: Size) -> Self {
34 Self {
35 width: s.width,
36 height: s.height,
37 }
38 }
39}
40
41#[derive(Debug, Clone, Copy)]
43pub struct SizeRange {
44 pub min: Size,
45 pub max: Size,
46 pub h_step: u32,
47 pub v_step: u32,
48}
49
50impl From<libcamera_size_range_t> for SizeRange {
51 fn from(r: libcamera_size_range_t) -> Self {
52 Self {
53 min: r.min.into(),
54 max: r.max.into(),
55 h_step: r.hStep,
56 v_step: r.vStep,
57 }
58 }
59}
60
61impl From<SizeRange> for libcamera_size_range_t {
62 fn from(r: SizeRange) -> Self {
63 Self {
64 min: r.min.into(),
65 max: r.max.into(),
66 hStep: r.h_step,
67 vStep: r.v_step,
68 }
69 }
70}
71
72#[derive(Debug, Clone, Copy)]
74pub struct Rectangle {
75 pub x: i32,
76 pub y: i32,
77 pub width: u32,
78 pub height: u32,
79}
80
81impl From<libcamera_rectangle_t> for Rectangle {
82 fn from(r: libcamera_rectangle_t) -> Self {
83 Self {
84 x: r.x,
85 y: r.y,
86 width: r.width,
87 height: r.height,
88 }
89 }
90}
91
92impl From<Rectangle> for libcamera_rectangle_t {
93 fn from(r: Rectangle) -> Self {
94 Self {
95 x: r.x,
96 y: r.y,
97 width: r.width,
98 height: r.height,
99 }
100 }
101}