graphics/
types.rs

1//! Contains type aliases used in this library
2
3pub use crate::math::{Matrix2d, Scalar, Vec2d};
4
5/// The type used for area.
6pub type Area<T = Scalar> = T;
7
8/// [red, green, blue, alpha]
9///
10/// All values are between 0.0 and 1.0.
11/// For example, black is `[0.0, 0.0, 0.0, 1.0]` and white is `[1.0, 1.0, 1.0, 1.0]`.
12pub type Color = [ColorComponent; 4];
13
14/// The type used for color component.
15pub type ColorComponent = f32;
16
17/// [x1, y1, x2, y2]
18pub type Line<T = Scalar> = [T; 4];
19
20/// [x, y, w, h]
21pub type SourceRectangle<T = Scalar> = [T; 4];
22
23/// [p0, p1, ...]
24pub type Polygon<'a, T = Scalar> = &'a [Vec2d<T>];
25
26/// A slice of polygons.
27pub type Polygons<'a, T = Scalar> = &'a [Polygon<'a, T>];
28
29/// The type used for radius.
30pub type Radius<T = Scalar> = T;
31
32/// The type used for resolution.
33pub type Resolution = u32;
34
35/// [x, y, dir_x, dir_y]
36pub type Ray<T = Scalar> = [T; 4];
37
38/// Rectangle dimensions: [x, y, w, h]
39pub type Rectangle<T = Scalar> = [T; 4];
40
41/// [x1, y1, x2, y2, x3, y3]
42pub type Triangle<T = Scalar> = [Vec2d<T>; 3];
43
44/// The type used for width.
45pub type Width<T = Scalar> = T;
46
47/// The type used for font size.
48pub type FontSize = u32;