From 15d4e8e5cafdfd9432a43a6c3f834d391dbfc55e Mon Sep 17 00:00:00 2001 From: Bill Holmes Date: Thu, 7 Apr 2016 22:31:57 -0400 Subject: [PATCH] Adding sk_path_add_rect_start to the c api. --- include/c/sk_path.h | 5 +++++ src/c/sk_surface.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/include/c/sk_path.h b/include/c/sk_path.h index 54e8786..4a0d3c8 100644 --- a/include/c/sk_path.h +++ b/include/c/sk_path.h @@ -95,6 +95,11 @@ SK_API void sk_path_close(sk_path_t*); */ SK_API void sk_path_add_rect(sk_path_t*, const sk_rect_t*, sk_path_direction_t); /** + Add a closed rectangle contour to the path with an initial point of the contour + (startIndex) expressed as a corner index (0-3) + */ +SK_API void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex); +/** Add a closed oval contour to the path */ SK_API void sk_path_add_oval(sk_path_t*, const sk_rect_t*, sk_path_direction_t); diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp index d6f99f8..0cbb5be 100644 --- a/src/c/sk_surface.cpp +++ b/src/c/sk_surface.cpp @@ -140,6 +140,14 @@ void sk_path_add_rect(sk_path_t* cpath, const sk_rect_t* crect, sk_path_directio as_path(cpath)->addRect(AsRect(*crect), dir); } +void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex) { + SkPath::Direction dir; + if (!find_sk(cdir, &dir)) { + return; + } + as_path(cpath)->addRect(AsRect(*crect), dir, startIndex); +} + void sk_path_add_oval(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) { SkPath::Direction dir; if (!find_sk(cdir, &dir)) { -- 2.7.4