From 2d4857d518091f1f85ced9f8f60fd948dde9ab46 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Fri, 9 Jan 2009 00:42:36 +0100 Subject: [PATCH] [CpmlPair] Implemented cpml_pair_transform() shortcut --- cpml/cpml-pair.c | 16 ++++++++++++++++ cpml/cpml-pair.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/cpml/cpml-pair.c b/cpml/cpml-pair.c index b0628170..457078c6 100644 --- a/cpml/cpml-pair.c +++ b/cpml/cpml-pair.c @@ -73,6 +73,22 @@ cpml_pair_copy(CpmlPair *pair, const CpmlPair *src) } /** + * cpml_pair_transform: + * @pair: the destination #CpmlPair struct + * @matrix: the transformation matrix + * + * Shortcut to apply a specific transformation matrix to @pair. + * + * Return value: 1 if @pair was transformed, 0 on errors + **/ +cairo_bool_t +cpml_pair_transform(CpmlPair *pair, const cairo_matrix_t *matrix) +{ + cairo_matrix_transform_point(matrix, &pair->x, &pair->y); + return 1; +} + +/** * cpml_pair_distance: * @from: the first #CpmlPair struct * @to: the second #CpmlPair struct diff --git a/cpml/cpml-pair.h b/cpml/cpml-pair.h index c8b0d3b3..c3f09f4e 100644 --- a/cpml/cpml-pair.h +++ b/cpml/cpml-pair.h @@ -41,6 +41,8 @@ struct _CpmlPair { cairo_bool_t cpml_pair_copy (CpmlPair *pair, const CpmlPair *src); +cairo_bool_t cpml_pair_transform (CpmlPair *pair, + const cairo_matrix_t *matrix); cairo_bool_t cpml_pair_distance (double *distance, const CpmlPair *from, const CpmlPair *to); -- 2.11.4.GIT