1 /* libs/graphics/animator/SkDisplayApply.h 2 ** 3 ** Copyright 2006, The Android Open Source Project 4 ** 5 ** Licensed under the Apache License, Version 2.0 (the "License"); 6 ** you may not use this file except in compliance with the License. 7 ** You may obtain a copy of the License at 8 ** 9 ** http://www.apache.org/licenses/LICENSE-2.0 10 ** 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 */ 17 18 #ifndef SkDisplayApply_DEFINED 19 #define SkDisplayApply_DEFINED 20 21 #include "SkAnimateBase.h" 22 #include "SkDrawable.h" 23 #include "SkIntArray.h" 24 25 class SkActive; 26 27 class SkApply : public SkDrawable { 28 DECLARE_MEMBER_INFO(Apply); 29 public: 30 31 SkApply(); 32 virtual ~SkApply(); 33 34 enum Transition { 35 kTransition_normal, 36 kTransition_reverse 37 }; 38 39 enum Mode { 40 kMode_create, 41 kMode_immediate, 42 //kMode_once 43 }; 44 void activate(SkAnimateMaker& ); 45 void append(SkApply* apply); 46 void appendActive(SkActive* ); 47 void applyValues(int animatorIndex, SkOperand* values, int count, 48 SkDisplayTypes , SkMSec time); 49 virtual bool contains(SkDisplayable*); 50 // void createActive(SkAnimateMaker& ); 51 virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 52 void disable(); 53 virtual bool draw(SkAnimateMaker& ); 54 #ifdef SK_DUMP_ENABLED 55 virtual void dump(SkAnimateMaker* ); 56 #endif 57 virtual bool enable(SkAnimateMaker& ); 58 void enableCreate(SkAnimateMaker& ); 59 void enableDynamic(SkAnimateMaker& ); 60 void endSave(int index); getMode()61 Mode getMode() { return mode; } 62 virtual bool getProperty(int index, SkScriptValue* value) const; getScope()63 SkDrawable* getScope() { return scope; } 64 void getStep(SkScriptValue* ); 65 SkDrawable* getTarget(SkAnimateBase* ); 66 bool hasDelayedAnimator() const; 67 virtual bool hasEnable() const; 68 bool inactivate(SkAnimateMaker& maker); 69 virtual void initialize(); 70 bool interpolate(SkAnimateMaker& , SkMSec time); 71 virtual void onEndElement(SkAnimateMaker& ); 72 virtual const SkMemberInfo* preferredChild(SkDisplayTypes type); 73 void refresh(SkAnimateMaker& ); 74 void reset(); 75 virtual bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ); 76 bool resolveField(SkAnimateMaker& , SkDisplayable* parent, SkString* str); 77 void save(int index); setEmbedded()78 void setEmbedded() { fEmbedded = true; } 79 virtual bool setProperty(int index, SkScriptValue& ); 80 virtual void setSteps(int _steps); 81 // virtual void setTime(SkMSec time); 82 #ifdef SK_DEBUG 83 virtual void validate(); 84 #endif 85 private: 86 SkMSec begin; 87 SkBool dontDraw; 88 SkString dynamicScope; 89 SkMSec interval; 90 Mode mode; 91 #if 0 92 SkBool pickup; 93 #endif 94 SkBool restore; 95 SkDrawable* scope; 96 int32_t steps; 97 Transition transition; 98 SkActive* fActive; 99 SkTDAnimateArray fAnimators; 100 // SkDrawable* fCurrentScope; 101 SkMSec fLastTime; // used only to return script property time 102 SkTDDrawableArray fScopes; 103 SkBool fAppended : 1; 104 SkBool fContainsScope : 1; 105 SkBool fDeleteScope : 1; 106 SkBool fEmbedded : 1; 107 SkBool fEnabled : 1; 108 SkBool fEnabling : 1; // set if calling interpolate from enable 109 friend class SkActive; 110 friend class SkDisplayList; 111 typedef SkDrawable INHERITED; 112 }; 113 114 #endif // SkDisplayApply_DEFINED 115 116 117