Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
skottie::SlotManager Class Referencefinal

#include <SlotManager.h>

Inheritance diagram for skottie::SlotManager:
SkRefCnt SkRefCntBase

Classes

class  ImageAssetProxy
 
struct  SlotInfo
 

Public Types

using SlotID = SkString
 

Public Member Functions

 SlotManager (sk_sp< skottie::internal::SceneGraphRevalidator >)
 
 ~SlotManager () override
 
bool setColorSlot (const SlotID &, SkColor)
 
bool setImageSlot (const SlotID &, const sk_sp< skresources::ImageAsset > &)
 
bool setScalarSlot (const SlotID &, float)
 
bool setVec2Slot (const SlotID &, SkV2)
 
bool setTextSlot (const SlotID &, const TextPropertyValue &)
 
std::optional< SkColorgetColorSlot (const SlotID &) const
 
sk_sp< const skresources::ImageAssetgetImageSlot (const SlotID &) const
 
std::optional< float > getScalarSlot (const SlotID &) const
 
std::optional< SkV2getVec2Slot (const SlotID &) const
 
std::optional< TextPropertyValuegetTextSlot (const SlotID &) const
 
SlotInfo getSlotInfo () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Friends

class skottie::internal::AnimationBuilder
 
class skottie::internal::AnimatablePropertyContainer
 

Detailed Description

Definition at line 40 of file SlotManager.h.

Member Typedef Documentation

◆ SlotID

Definition at line 43 of file SlotManager.h.

Constructor & Destructor Documentation

◆ SlotManager()

skottie::SlotManager::SlotManager ( sk_sp< skottie::internal::SceneGraphRevalidator revalidator)

Definition at line 49 of file SlotManager.cpp.

50 : fRevalidator(std::move(revalidator)) {}

◆ ~SlotManager()

skottie::SlotManager::~SlotManager ( )
overridedefault

Member Function Documentation

◆ getColorSlot()

std::optional< SkColor > skottie::SlotManager::getColorSlot ( const SlotID slotID) const

Definition at line 120 of file SlotManager.cpp.

120 {
121 const auto valueGroup = fColorMap.find(slotID);
122 return valueGroup && !valueGroup->empty() ? std::optional<SkColor>(*(valueGroup->at(0).value))
123 : std::nullopt;
124}
Definition ref_ptr.h:256

◆ getImageSlot()

sk_sp< const skresources::ImageAsset > skottie::SlotManager::getImageSlot ( const SlotID slotID) const

Definition at line 126 of file SlotManager.cpp.

127 {
128 const auto imageGroup = fImageMap.find(slotID);
129 return imageGroup && !imageGroup->empty() ? imageGroup->at(0)->getImageAsset() : nullptr;
130}

◆ getScalarSlot()

std::optional< float > skottie::SlotManager::getScalarSlot ( const SlotID slotID) const

Definition at line 132 of file SlotManager.cpp.

132 {
133 const auto valueGroup = fScalarMap.find(slotID);
134 return valueGroup && !valueGroup->empty() ? std::optional<float>(*(valueGroup->at(0).value))
135 : std::nullopt;
136}

◆ getSlotInfo()

skottie::SlotManager::SlotInfo skottie::SlotManager::getSlotInfo ( ) const

Definition at line 180 of file SlotManager.cpp.

180 {
181 SlotInfo sInfo;
182 for (const auto& c : fColorMap) {
183 sInfo.fColorSlotIDs.push_back(c.first);
184 }
185 for (const auto& s : fScalarMap) {
186 sInfo.fScalarSlotIDs.push_back(s.first);
187 }
188 for (const auto& v : fVec2Map) {
189 sInfo.fVec2SlotIDs.push_back(v.first);
190 }
191 for (const auto& i : fImageMap) {
192 sInfo.fImageSlotIDs.push_back(i.first);
193 }
194 for (const auto& t : fTextMap) {
195 sInfo.fTextSlotIDs.push_back(t.first);
196 }
197 return sInfo;
198}
struct MyStruct s

◆ getTextSlot()

std::optional< skottie::TextPropertyValue > skottie::SlotManager::getTextSlot ( const SlotID slotID) const

Definition at line 144 of file SlotManager.cpp.

145 {
146 const auto adapterGroup = fTextMap.find(slotID);
147 return adapterGroup && !adapterGroup->empty() ?
148 std::optional<TextPropertyValue>(adapterGroup->at(0)->getText()) :
149 std::nullopt;
150}

◆ getVec2Slot()

std::optional< SkV2 > skottie::SlotManager::getVec2Slot ( const SlotID slotID) const

Definition at line 138 of file SlotManager.cpp.

138 {
139 const auto valueGroup = fVec2Map.find(slotID);
140 return valueGroup && !valueGroup->empty() ? std::optional<SkV2>(*(valueGroup->at(0).value))
141 : std::nullopt;
142}

◆ setColorSlot()

bool skottie::SlotManager::setColorSlot ( const SlotID slotID,
SkColor  c 
)

Definition at line 54 of file SlotManager.cpp.

54 {
55 auto c4f = SkColor4f::FromColor(c);
56 ColorValue v{c4f.fR, c4f.fG, c4f.fB, c4f.fA};
57 const auto valueGroup = fColorMap.find(slotID);
58 if (valueGroup) {
59 for (auto& cPair : *valueGroup) {
60 *(cPair.value) = v;
61 cPair.adapter->onSync();
62 }
63 fRevalidator->revalidate();
64 return true;
65 }
66 return false;
67}
static SkRGBA4f FromColor(SkColor color)

◆ setImageSlot()

bool skottie::SlotManager::setImageSlot ( const SlotID slotID,
const sk_sp< skresources::ImageAsset > &  i 
)

Definition at line 69 of file SlotManager.cpp.

70 {
71 const auto imageGroup = fImageMap.find(slotID);
72 if (imageGroup) {
73 for (auto& imageAsset : *imageGroup) {
74 imageAsset->setImageAsset(i);
75 }
76 fRevalidator->revalidate();
77 return true;
78 }
79 return false;
80}

◆ setScalarSlot()

bool skottie::SlotManager::setScalarSlot ( const SlotID slotID,
float  s 
)

Definition at line 82 of file SlotManager.cpp.

82 {
83 const auto valueGroup = fScalarMap.find(slotID);
84 if (valueGroup) {
85 for (auto& sPair : *valueGroup) {
86 *(sPair.value) = s;
87 sPair.adapter->onSync();
88 }
89 fRevalidator->revalidate();
90 return true;
91 }
92 return false;
93}

◆ setTextSlot()

bool skottie::SlotManager::setTextSlot ( const SlotID slotID,
const TextPropertyValue t 
)

Definition at line 108 of file SlotManager.cpp.

108 {
109 const auto adapterGroup = fTextMap.find(slotID);
110 if (adapterGroup) {
111 for (auto& textAdapter : *adapterGroup) {
112 textAdapter->setText(t);
113 }
114 fRevalidator->revalidate();
115 return true;
116 }
117 return false;
118}

◆ setVec2Slot()

bool skottie::SlotManager::setVec2Slot ( const SlotID slotID,
SkV2  v 
)

Definition at line 95 of file SlotManager.cpp.

95 {
96 const auto valueGroup = fVec2Map.find(slotID);
97 if (valueGroup) {
98 for (auto& vPair : *valueGroup) {
99 *(vPair.value) = v;
100 vPair.adapter->onSync();
101 }
102 fRevalidator->revalidate();
103 return true;
104 }
105 return false;
106}

Friends And Related Symbol Documentation

◆ skottie::internal::AnimatablePropertyContainer

Definition at line 108 of file SlotManager.h.

◆ skottie::internal::AnimationBuilder

Definition at line 107 of file SlotManager.h.


The documentation for this class was generated from the following files: