1 #pragma once 2 3 #include <memory> 4 #include <utility> 5 6 #include <jsi/jsi.h> 7 8 #include "JsiSkHostObjects.h" 9 10 #pragma clang diagnostic push 11 #pragma clang diagnostic ignored "-Wdocumentation" 12 13 #include "SkPathEffect.h" 14 15 #pragma clang diagnostic pop 16 17 namespace RNSkia { 18 19 namespace jsi = facebook::jsi; 20 21 class JsiSkPathEffect : public JsiSkWrappingSkPtrHostObject<SkPathEffect> { 22 public: JsiSkPathEffect(std::shared_ptr<RNSkPlatformContext> context,sk_sp<SkPathEffect> pathEffect)23 JsiSkPathEffect(std::shared_ptr<RNSkPlatformContext> context, 24 sk_sp<SkPathEffect> pathEffect) 25 : JsiSkWrappingSkPtrHostObject<SkPathEffect>(std::move(context), 26 std::move(pathEffect)) {} 27 28 // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? JSI_PROPERTY_GET(__typename__)29 JSI_PROPERTY_GET(__typename__) { 30 return jsi::String::createFromUtf8(runtime, "PathEffect"); 31 } 32 JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET (JsiSkPathEffect,__typename__))33 JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkPathEffect, 34 __typename__)) 35 36 /** 37 Returns the underlying object from a host object of this type 38 */ 39 static sk_sp<SkPathEffect> fromValue(jsi::Runtime &runtime, 40 const jsi::Value &obj) { 41 return obj.asObject(runtime) 42 .asHostObject<JsiSkPathEffect>(runtime) 43 ->getObject(); 44 } 45 }; 46 47 } // namespace RNSkia 48