Added some more path members
authorMatthew Leibowitz <mattleibow@live.com>
Tue, 7 Feb 2017 12:37:27 +0000 (06:37 -0600)
committerMatthew Leibowitz <mattleibow@live.com>
Tue, 7 Feb 2017 12:37:27 +0000 (06:37 -0600)
include/c/sk_path.h
include/c/sk_types.h
src/c/sk_enums.cpp
src/c/sk_path.cpp

index 16d9ada..8106170 100644 (file)
@@ -267,6 +267,10 @@ SK_C_API bool sk_pathmeasure_is_closed(sk_pathmeasure_t* pathMeasure);
 
 SK_C_API bool sk_pathmeasure_next_contour(sk_pathmeasure_t* pathMeasure);
 
+SK_C_API void sk_path_add_poly(sk_path_t* cpath, const sk_point_t* points, int count, bool close);
+
+SK_C_API uint32_t sk_path_get_segment_masks(sk_path_t* cpath);
+
 SK_C_PLUS_PLUS_END_GUARD
 
 #endif
index db43f1e..1bd6646 100644 (file)
@@ -493,6 +493,13 @@ typedef enum {
 } sk_path_add_mode_t;
 
 typedef enum {
+    LINE_SK_PATH_SEGMENT_MASK  = 1 << 0,
+    QUAD_SK_PATH_SEGMENT_MASK  = 1 << 1,
+    CONIC_SK_PATH_SEGMENT_MASK = 1 << 2,
+    CUBIC_SK_PATH_SEGMENT_MASK = 1 << 3,
+} sk_path_segment_mask_t;
+
+typedef enum {
     TRANSLATE_SK_PATH_EFFECT_1D_STYLE,
     ROTATE_SK_PATH_EFFECT_1D_STYLE,
     MORPH_SK_PATH_EFFECT_1D_STYLE,
index 42059e5..ee8da4e 100644 (file)
@@ -59,6 +59,12 @@ static_assert ((int)SkPath::FillType::kEvenOdd_FillType          == (int)EVENODD
 static_assert ((int)SkPath::FillType::kInverseWinding_FillType   == (int)INVERSE_WINDING_SK_PATH_FILLTYPE,   ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
 static_assert ((int)SkPath::FillType::kInverseEvenOdd_FillType   == (int)INVERSE_EVENODD_SK_PATH_FILLTYPE,   ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
 
+// sk_path_segment_mask_t
+static_assert ((int)SkPath::SegmentMask::kLine_SegmentMask    == (int)LINE_SK_PATH_SEGMENT_MASK,    ASSERT_MSG(SkPath::SegmentMask, sk_path_segment_mask_t));
+static_assert ((int)SkPath::SegmentMask::kQuad_SegmentMask    == (int)QUAD_SK_PATH_SEGMENT_MASK,    ASSERT_MSG(SkPath::SegmentMask, sk_path_segment_mask_t));
+static_assert ((int)SkPath::SegmentMask::kConic_SegmentMask   == (int)CONIC_SK_PATH_SEGMENT_MASK,   ASSERT_MSG(SkPath::SegmentMask, sk_path_segment_mask_t));
+static_assert ((int)SkPath::SegmentMask::kCubic_SegmentMask   == (int)CUBIC_SK_PATH_SEGMENT_MASK,   ASSERT_MSG(SkPath::SegmentMask, sk_path_segment_mask_t));
+
 // sk_text_align_t
 static_assert ((int)SkPaint::Align::kLeft_Align     == (int)LEFT_SK_TEXT_ALIGN,     ASSERT_MSG(SkPaint::Align, sk_text_align_t));
 static_assert ((int)SkPaint::Align::kCenter_Align   == (int)CENTER_SK_TEXT_ALIGN,   ASSERT_MSG(SkPaint::Align, sk_text_align_t));
index 3894c1f..2188121 100644 (file)
@@ -360,3 +360,11 @@ bool sk_pathmeasure_is_closed(sk_pathmeasure_t* pathMeasure) {
 bool sk_pathmeasure_next_contour(sk_pathmeasure_t* pathMeasure) {
     return AsPathMeasure(pathMeasure)->nextContour();
 }
+
+void sk_path_add_poly(sk_path_t* cpath, const sk_point_t* points, int count, bool close) {
+    AsPath(cpath)->addPoly(AsPoint(points), count, close);
+}
+
+uint32_t sk_path_get_segment_masks(sk_path_t* cpath) {
+    return AsPath(cpath)->getSegmentMasks();
+}