1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #ifndef SkDisplayApply_DEFINED 11 #define SkDisplayApply_DEFINED 12 13 #include "SkAnimateBase.h" 14 #include "SkDrawable.h" 15 #include "SkIntArray.h" 16 17 class SkActive; 18 19 class SkApply : public SkDrawable { 20 DECLARE_MEMBER_INFO(Apply); 21 public: 22 23 SkApply(); 24 virtual ~SkApply(); 25 26 enum Transition { 27 kTransition_normal, 28 kTransition_reverse 29 }; 30 31 enum Mode { 32 kMode_create, 33 kMode_immediate, 34 //kMode_once 35 }; 36 void activate(SkAnimateMaker& ); 37 void append(SkApply* apply); 38 void appendActive(SkActive* ); 39 void applyValues(int animatorIndex, SkOperand* values, int count, 40 SkDisplayTypes , SkMSec time); 41 virtual bool contains(SkDisplayable*); 42 // void createActive(SkAnimateMaker& ); 43 virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 44 void disable(); 45 virtual bool draw(SkAnimateMaker& ); 46 #ifdef SK_DUMP_ENABLED 47 virtual void dump(SkAnimateMaker* ); 48 #endif 49 virtual bool enable(SkAnimateMaker& ); 50 void enableCreate(SkAnimateMaker& ); 51 void enableDynamic(SkAnimateMaker& ); 52 void endSave(int index); getMode()53 Mode getMode() { return mode; } 54 virtual bool getProperty(int index, SkScriptValue* value) const; getScope()55 SkDrawable* getScope() { return scope; } 56 void getStep(SkScriptValue* ); 57 SkDrawable* getTarget(SkAnimateBase* ); 58 bool hasDelayedAnimator() const; 59 virtual bool hasEnable() const; 60 bool inactivate(SkAnimateMaker& maker); 61 virtual void initialize(); 62 bool interpolate(SkAnimateMaker& , SkMSec time); 63 virtual void onEndElement(SkAnimateMaker& ); 64 virtual const SkMemberInfo* preferredChild(SkDisplayTypes type); 65 void refresh(SkAnimateMaker& ); 66 void reset(); 67 virtual bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ); 68 bool resolveField(SkAnimateMaker& , SkDisplayable* parent, SkString* str); 69 void save(int index); setEmbedded()70 void setEmbedded() { fEmbedded = true; } 71 virtual bool setProperty(int index, SkScriptValue& ); 72 virtual void setSteps(int _steps); 73 // virtual void setTime(SkMSec time); 74 #ifdef SK_DEBUG 75 virtual void validate(); 76 #endif 77 private: 78 SkMSec begin; 79 SkBool dontDraw; 80 SkString dynamicScope; 81 SkMSec interval; 82 Mode mode; 83 #if 0 84 SkBool pickup; 85 #endif 86 SkBool restore; 87 SkDrawable* scope; 88 int32_t steps; 89 Transition transition; 90 SkActive* fActive; 91 SkTDAnimateArray fAnimators; 92 // SkDrawable* fCurrentScope; 93 SkMSec fLastTime; // used only to return script property time 94 SkTDDrawableArray fScopes; 95 SkBool fAppended : 1; 96 SkBool fContainsScope : 1; 97 SkBool fDeleteScope : 1; 98 SkBool fEmbedded : 1; 99 SkBool fEnabled : 1; 100 SkBool fEnabling : 1; // set if calling interpolate from enable 101 friend class SkActive; 102 friend class SkDisplayList; 103 typedef SkDrawable INHERITED; 104 }; 105 106 #endif // SkDisplayApply_DEFINED 107 108 109