summaryrefslogtreecommitdiff
path: root/src/cairo-matrix.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2003-12-15 18:02:03 +0000
committerCarl Worth <cworth@cworth.org>2003-12-15 18:02:03 +0000
commit9d4fe7e36990e39f849b0983daff6bf0b690458a (patch)
treee302769211939420169dd2609e2bb5e2691ad9e1 /src/cairo-matrix.c
parent0095dcb49d5a10f8ab62aeff1809587250a09575 (diff)
Move this function from cairo_ft_font.c (_get_scale_factors).
Diffstat (limited to 'src/cairo-matrix.c')
-rw-r--r--src/cairo-matrix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index 655bcde83..de89c0fd5 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -386,3 +386,22 @@ _cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, dou
return CAIRO_STATUS_SUCCESS;
}
+
+/* Compute the amount that each basis vector is scaled by. */
+cairo_status_t
+_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy)
+{
+ double x, y;
+
+ x = 1.0;
+ y = 0.0;
+ cairo_matrix_transform_distance (matrix, &x, &y);
+ *sx = sqrt(x*x + y*y);
+
+ x = 0.0;
+ y = 1.0;
+ cairo_matrix_transform_distance (matrix, &x, &y);
+ *sy = sqrt(x*x + y*y);
+
+ return CAIRO_STATUS_SUCCESS;
+}