SK_API bool sk_path_get_last_point (const sk_path_t* cpath, sk_point_t* point);
+SK_API bool sk_pathop_op(const sk_path_t* one, const sk_path_t* two, sk_pathop_t op, sk_path_t* result);
+
+SK_API bool sk_pathop_simplify(const sk_path_t* path, sk_path_t* result);
+
+SK_API bool sk_pathop_tight_bounds(const sk_path_t* path, sk_rect_t* result);
+
+SK_API sk_opbuilder_t* sk_opbuilder_new();
+
+SK_API void sk_opbuilder_destroy(sk_opbuilder_t* builder);
+
+SK_API void sk_opbuilder_add(sk_opbuilder_t* builder, const sk_path_t* path, sk_pathop_t op);
+
+SK_API bool sk_opbuilder_resolve(sk_opbuilder_t* builder, sk_path_t* result);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
typedef void (*gr_gl_func_ptr)();
typedef gr_gl_func_ptr (*gr_gl_get_proc)(void* ctx, const char* name);
+typedef enum {
+ DIFFERENCE_SK_PATHOP,
+ INTERSECT_SK_PATHOP,
+ UNION_SK_PATHOP,
+ XOR_SK_PATHOP,
+ REVERSE_DIFFERENCE_SK_PATHOP,
+} sk_pathop_t;
+
+typedef struct sk_opbuilder_t sk_opbuilder_t;
+
SK_C_PLUS_PLUS_END_GUARD
#endif
* found in the LICENSE file.
*/
-#include "SkTypeface.h"
-#include "SkFontStyle.h"
-
#include "sk_types_priv.h"
#if __cplusplus >= 199711L
static_assert ((int)0 == (int)NONE_GR_CONTEXT_FLUSHBITS, ASSERT_MSG(GrContext::FlushBits, gr_context_flushbits_t));
static_assert ((int)GrContext::FlushBits::kDiscard_FlushBit == (int)DISCARD_GR_CONTEXT_FLUSHBITS, ASSERT_MSG(GrContext::FlushBits, gr_context_flushbits_t));
+// sk_pathop_t
+static_assert ((int)SkPathOp::kDifference_SkPathOp == (int)DIFFERENCE_SK_PATHOP, ASSERT_MSG(SkPathOp, sk_pathop_t));
+static_assert ((int)SkPathOp::kIntersect_SkPathOp == (int)INTERSECT_SK_PATHOP, ASSERT_MSG(SkPathOp, sk_pathop_t));
+static_assert ((int)SkPathOp::kUnion_SkPathOp == (int)UNION_SK_PATHOP, ASSERT_MSG(SkPathOp, sk_pathop_t));
+static_assert ((int)SkPathOp::kXOR_SkPathOp == (int)XOR_SK_PATHOP, ASSERT_MSG(SkPathOp, sk_pathop_t));
+static_assert ((int)SkPathOp::kReverseDifference_SkPathOp == (int)REVERSE_DIFFERENCE_SK_PATHOP, ASSERT_MSG(SkPathOp, sk_pathop_t));
+
#endif
*/
#include "SkPath.h"
+#include "SkPathOps.h"
#include "sk_path.h"
return false;
}
}
+
+bool sk_pathop_op(const sk_path_t* one, const sk_path_t* two, sk_pathop_t op, sk_path_t* result) {
+ return Op(AsPath(*one), AsPath(*two), (SkPathOp)op, AsPath(result));
+}
+
+bool sk_pathop_simplify(const sk_path_t* path, sk_path_t* result) {
+ return Simplify(AsPath(*path), AsPath(result));
+}
+
+bool sk_pathop_tight_bounds(const sk_path_t* path, sk_rect_t* result) {
+ return TightBounds(AsPath(*path), AsRect(result));
+}
+
+sk_opbuilder_t* sk_opbuilder_new() {
+ return ToOpBuilder(new SkOpBuilder());
+}
+
+void sk_opbuilder_destroy(sk_opbuilder_t* builder) {
+ delete AsOpBuilder(builder);
+}
+
+void sk_opbuilder_add(sk_opbuilder_t* builder, const sk_path_t* path, sk_pathop_t op) {
+ AsOpBuilder(builder)->add(AsPath(*path), (SkPathOp)op);
+}
+
+bool sk_opbuilder_resolve(sk_opbuilder_t* builder, sk_path_t* result) {
+ return AsOpBuilder(builder)->resolve(AsPath(result));
+}
#include "Sk1DPathEffect.h"
#include "SkFontStyle.h"
#include "GrContext.h"
+#include "SkPathOps.h"
+#include "SkTypeface.h"
#include "gl/GrGLInterface.h"
#include "sk_path.h"
return reinterpret_cast<const GrGLInterface*>(p);
}
+static inline sk_opbuilder_t* ToOpBuilder(SkOpBuilder* p) {
+ return reinterpret_cast<sk_opbuilder_t*>(p);
+}
+
+static inline SkOpBuilder* AsOpBuilder(sk_opbuilder_t* p) {
+ return reinterpret_cast<SkOpBuilder*>(p);
+}
+
static inline void from_c(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
matrix->setAll(
cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],