summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-12-23 13:36:19 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-04-08 16:44:28 -0400
commit282be569f66ba0c5f89ba7c4e68e01392725b67f (patch)
tree4503d93458fac69241ed8912aed5174dd988b459
parentf2069508cfe3bd4bca62608b1664bbdf2748be5b (diff)
downloadgtk+-282be569f66ba0c5f89ba7c4e68e01392725b67f.tar.gz
curve: Add gsk_curve_get_normal
Its easy but thats no reason not to have this api.
-rw-r--r--gsk/gskcurve.c13
-rw-r--r--gsk/gskcurveprivate.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/gsk/gskcurve.c b/gsk/gskcurve.c
index b8cf96d7e9..768c493461 100644
--- a/gsk/gskcurve.c
+++ b/gsk/gskcurve.c
@@ -430,6 +430,19 @@ gsk_curve_curve_get_tangent (const GskCurve *curve,
graphene_vec2_normalize (tangent, tangent);
}
+void
+gsk_curve_get_normal (const GskCurve *curve,
+ float t,
+ graphene_vec2_t *normal)
+{
+ graphene_vec2_t tangent;
+
+ gsk_curve_get_tangent (curve, t, &tangent);
+ graphene_vec2_init (normal,
+ - graphene_vec2_get_y (&tangent),
+ graphene_vec2_get_x (&tangent));
+}
+
static void
gsk_curve_curve_split (const GskCurve *curve,
float progress,
diff --git a/gsk/gskcurveprivate.h b/gsk/gskcurveprivate.h
index ade1418f77..196cc3e17c 100644
--- a/gsk/gskcurveprivate.h
+++ b/gsk/gskcurveprivate.h
@@ -100,6 +100,9 @@ void gsk_curve_get_point (const GskCurve
void gsk_curve_get_tangent (const GskCurve *curve,
float progress,
graphene_vec2_t *tangent);
+void gsk_curve_get_normal (const GskCurve *curve,
+ float progress,
+ graphene_vec2_t *normal);
void gsk_curve_split (const GskCurve *curve,
float progress,
GskCurve *start,