656 {
657
658 class_<skottie::Animation>("Animation")
661 return std::string(
self.version().c_str());
662 }))
667 }))
672 }))
675 }))
680 }), allow_raw_pointers());
681
684 }));
685 constant("skottie", true);
686
687 class_<ManagedAnimation>("ManagedAnimation")
690 .function(
"_size", optional_override([](ManagedAnimation&
self,
694 }))
696 .function("fps" , &ManagedAnimation::fps)
697 .function(
"_render", optional_override([](ManagedAnimation&
self,
SkCanvas* canvas,
701 }), allow_raw_pointers())
705 damageRect[0] =
self.seek(t);
706 }))
707 .function(
"_seekFrame", optional_override([](ManagedAnimation&
self,
double frame,
711 }))
712 .function("seekFrame" , &ManagedAnimation::seekFrame)
713 .function(
"_setColor" , optional_override([](ManagedAnimation&
self,
const std::string&
key,
WASMPointerF32 cPtr) {
714 float* fourFloats = reinterpret_cast<float*>(cPtr);
715 SkColor4f color = { fourFloats[0], fourFloats[1], fourFloats[2], fourFloats[3] };
717 }))
718 .function(
"_setTransform" , optional_override([](ManagedAnimation&
self,
719 const std::string&
key,
721
722
726 }))
727 .function("getMarkers" , &ManagedAnimation::getMarkers)
728 .function("getColorProps" , &ManagedAnimation::getColorProps)
729 .function("getOpacityProps" , &ManagedAnimation::getOpacityProps)
730 .function("setOpacity" , &ManagedAnimation::setOpacity)
731 .function("getTextProps" , &ManagedAnimation::getTextProps)
732 .function("setText" , &ManagedAnimation::setText)
733 .function("getTransformProps", &ManagedAnimation::getTransformProps)
734 .function("getSlotInfo" , &ManagedAnimation::getSlotInfo)
735 .function("_getColorSlot" , &ManagedAnimation::getColorSlot)
736 .function(
"_setColorSlot" , optional_override([](ManagedAnimation&
self,
const std::string&
key,
WASMPointerF32 cPtr) {
739 }))
740 .function("_getVec2Slot" , &ManagedAnimation::getVec2Slot)
741 .function(
"_setVec2Slot" , optional_override([](ManagedAnimation&
self,
const std::string&
key,
WASMPointerF32 vPtr) {
742 float* twoFloats = reinterpret_cast<float*>(vPtr);
743 SkV2 vec2 = {twoFloats[0], twoFloats[1]};
744 return self.setVec2Slot(
key, vec2);
745 }))
746 .function("getScalarSlot" , &ManagedAnimation::getScalarSlot)
747 .function("setScalarSlot" , &ManagedAnimation::setScalarSlot)
748 .function("attachEditor" , &ManagedAnimation::attachEditor)
749 .function("enableEditor" , &ManagedAnimation::enableEditor)
750 .function("dispatchEditorKey" , &ManagedAnimation::dispatchEditorKey)
751 .function("dispatchEditorPointer", &ManagedAnimation::dispatchEditorPointer)
752 .function("setEditorCursorWeight", &ManagedAnimation::setEditorCursorWeight)
753 .function("getTextSlot" , &ManagedAnimation::getTextSlot)
754 .function("_setTextSlot" , &ManagedAnimation::setTextSlot)
755 .function("setImageSlot" , &ManagedAnimation::setImageSlot);
756
757 function(
"_MakeManagedAnimation", optional_override([](std::string json,
758 size_t assetCount,
762 std::string prop_prefix,
763 emscripten::val soundMap,
766 const auto assetNames = reinterpret_cast<char** >(nptr);
767 const auto assetDatas = reinterpret_cast<uint8_t**>(dptr);
768 const auto assetSizes = reinterpret_cast<size_t* >(sptr);
769
770 SkottieAssetProvider::AssetVec assets;
771 assets.reserve(assetCount);
772
773 for (
size_t i = 0;
i < assetCount;
i++) {
776 assets.push_back(std::make_pair(std::move(
name), std::move(bytes)));
777 }
778
779
780
782 once([] {
783#if defined(SK_CODEC_DECODES_PNG)
785#endif
786#if defined(SK_CODEC_DECODES_JPEG)
788#endif
789#if defined(SK_CODEC_DECODES_GIF)
791#endif
792#if defined(SK_CODEC_DECODES_WEBP)
794#endif
795 });
796
798#if !defined(CK_NO_FONTS)
800#endif
801
805 std::move(soundMap)),
807 std::move(fontmgr)),
808 prop_prefix, std::move(
logger));
809 }));
810
811 enum_<skui::InputState>("InputState")
817
818 enum_<skui::ModifierKey>("ModifierKey")
825
826 enum_<skottie::Shaper::VAlign>("VerticalTextAlign")
832
833 enum_<skottie::Shaper::ResizePolicy>("ResizePolicy")
837
838 value_object<SimpleSlottableTextProperty>("SlottableTextProperty")
839 .field("typeface", &SimpleSlottableTextProperty::typeface)
841 .field("textSize", &SimpleSlottableTextProperty::textSize)
842 .field("minTextSize", &SimpleSlottableTextProperty::minTextSize)
843 .field("maxTextSize", &SimpleSlottableTextProperty::maxTextSize)
845 .field("lineHeight", &SimpleSlottableTextProperty::lineHeight)
846 .field("lineShift", &SimpleSlottableTextProperty::lineShift)
848 .field("maxLines", &SimpleSlottableTextProperty::maxLines)
849 .field("horizAlign", &SimpleSlottableTextProperty::horizAlign)
850 .field("vertAlign", &SimpleSlottableTextProperty::vertAlign)
851 .field("strokeJoin", &SimpleSlottableTextProperty::strokeJoin)
852 .field("direction", &SimpleSlottableTextProperty::direction)
853 .field("linebreak", &SimpleSlottableTextProperty::lineBreak)
854 .field("resize", &SimpleSlottableTextProperty::resize)
855 .field("_fillColorPtr", &SimpleSlottableTextProperty::fillColorPtr)
856 .field("_strokeColorPtr", &SimpleSlottableTextProperty::strokeColorPtr)
857 .field("_boundingBoxPtr", &SimpleSlottableTextProperty::boundingBoxPtr);
858
859 constant("managed_skottie", true);
860}
static const int strokeWidth
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
SkColor4f ptrToSkColor4f(WASMPointerF32 cPtr)
static sk_sp< SkData > MakeFromMalloc(const void *data, size_t length)
static sk_sp< Animation > Make(const char *data, size_t length)
static sk_sp< DataURIResourceProviderProxy > Make(sk_sp< ResourceProvider > rp, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode, sk_sp< const SkFontMgr > fontMgr=nullptr)
Dart_NativeFunction function
void SK_API Register(Decoder d)
constexpr SkCodecs::Decoder Decoder()
constexpr SkCodecs::Decoder Decoder()
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
constexpr SkCodecs::Decoder Decoder()
constexpr SkCodecs::Decoder Decoder()
DEF_SWITCHES_START aot vmservice shared library name
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)