1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// Metric
#define A4_WIDTH 210
#define A4_HEIGHT 297
#define US_LETTER_WIDTH 216
#define US_LETTER_HEIGHT 279
struct
dimensions {
int row_count; /* rows */
int column_count; /* columns */
double paper_width; /* paper width */
double paper_height; /* paper height */
double month_width; /* month width */
double month_height; /* month height */
double month_top_corner_x;
double month_top_corner_y;
double day_width; /* day box width */
double day_height; /* day box height */
double margin; /* margin */
double header_width;
double header_height;
};
int
fill_bg(cairo_t *c);
struct
RGB {
double r;
double g;
double b;
};
struct
month_info {
int month_position;
int first_day;
int num_of_days;
int column_count;
int row_count;
int minimum_rows;
};
struct
extents {
double x;
double y;
double width;
double height;
};
struct alignment {
double margin;
double padding;
};
struct
RGB hex_to_rgb(char *str);
int
set_color(cairo_t *c, char *hex);
int
draw_text(cairo_t *c, double x, double y, char *font_family, int font_size, char *text);
int
calculate_dimensions(double pw, double ph, struct dimensions *d);
//int
//draw_month_grid(cairo_t *c, struct month_info *m, struct dimensions *d);
int
draw_month_grid (cairo_t *c, struct month_info *m, struct extents *me, struct extents *de);
int
draw_month_dates(cairo_t *c, cairo_t *cd, cairo_surface_t *s, struct month_info *m, struct extents *me, struct extents *de);
int
day_of_week(int d, int m, int y);
int
draw_month_title(cairo_t *c, struct extents *he, struct alignment *pl, char *font_family, int font_size, char *name);
PangoRectangle
get_logical_extents(cairo_t *c, char *font_family, int font_size, char *text);
PangoRectangle
get_ink_extents (cairo_t *c, char *font_family, int font_size, char *text);
int
calculate_minimum_rows(struct month_info *m);
int
construct_day_box(cairo_t *cd, int month, int day, int week_day);
|