1 module modernui.ui.core;
2 
3 struct Size
4 {
5 	double width;
6 	double height;
7 }
8 
9 Size unionWith(Size a, Size b)
10 {
11 	import std.algorithm.comparison : max;
12 	return Size(max(a.width, b.width), max(a.height, b.height));
13 }
14 
15 Size shrink(Size a, Size b)
16 {
17 	return Size(a.width - b.width, a.height - b.height);
18 }
19 
20 struct Point
21 {
22 	double x;
23 	double y;
24 }
25 
26 Point offset(Point a, Point b)
27 {
28 	return Point(a.x+b.x, a.y+b.y);
29 }
30 
31 struct Rect
32 {
33 	Point location;
34 	Size size;
35 }
36 
37 struct Color {
38 	float r;
39 	float g;
40 	float b;
41 }
42 
43 struct Thickness 
44 {
45 	double left;
46 	double top;
47 	double right;
48 	double bottom;
49 }
50 
51 double widthContribution(Thickness t)
52 {
53 	return t.left + t.right;
54 }
55 
56 double heightContribution(Thickness t)
57 {
58 	return t.top + t.bottom;
59 }
60 
61 enum HorizontalAlignment 
62 {
63 	Stretch, Center, Left, Right
64 }
65 
66 enum VerticalAlignment 
67 {
68 	Stretch, Center, Top, Bottom
69 }