1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-12-19 16:36:48 +02:00

Add fancy borders

This commit is contained in:
Kirill Primak
2024-06-24 07:40:17 +03:00
parent f590bd2b73
commit 8794cbdeb2
6 changed files with 188 additions and 4 deletions

View File

@@ -63,3 +63,17 @@ enum dp_file_format dp_ext_to_format(const char *ext) {
}
return DP_FILE_UNKNOWN;
}
void dp_matrix_compute_linear(cairo_matrix_t *matrix, double angle) {
double c = cos(angle), s = sin(angle);
double f = 1.0 / (fabs(c) + fabs(s));
cairo_matrix_init_translate(matrix, 0.5, 0.5);
cairo_matrix_scale(matrix, f, 1);
cairo_matrix_t tmp;
cairo_matrix_init(&tmp, c, s, -s, c, 0, 0);
cairo_matrix_multiply(matrix, &tmp, matrix);
cairo_matrix_translate(matrix, -0.5, -0.5);
}