PlatformClutterAnimation.h [plain text]
#ifndef PlatformClutterAnimation_h
#define PlatformClutterAnimation_h
#if USE(ACCELERATED_COMPOSITING)
#include "Color.h"
#include "FilterOperation.h"
#include "FloatPoint3D.h"
#include "TransformationMatrix.h"
#include <glib-object.h>
#include <glib.h>
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
#include <wtf/gobject/GRefPtr.h>
typedef struct _ClutterActor ClutterActor;
typedef struct _ClutterTimeline ClutterTimeline;
typedef struct _GraphicsLayerActor GraphicsLayerActor;
namespace WebCore {
class FloatRect;
class PlatformClutterAnimation;
class TimingFunction;
class PlatformClutterAnimation : public RefCounted<PlatformClutterAnimation> {
public:
enum AnimationType { Basic, Keyframe };
enum AnimatedPropertyType { NoAnimatedPropertyType, Transform, Opacity, BackgroundColor };
enum FillModeType { NoFillMode, Forwards, Backwards, Both };
enum ValueFunctionType { NoValueFunction, RotateX, RotateY, RotateZ, ScaleX, ScaleY, ScaleZ, Scale, TranslateX, TranslateY, TranslateZ, Translate, Matrix };
static PassRefPtr<PlatformClutterAnimation> create(AnimationType, const String& keyPath);
static PassRefPtr<PlatformClutterAnimation> create(PlatformClutterAnimation*);
~PlatformClutterAnimation();
static bool supportsValueFunction();
static bool supportsAdditiveValueFunction();
AnimationType animationType() const { return m_type; }
double beginTime() const;
void setBeginTime(double);
double duration() const;
void setDuration(double);
float speed() const;
void setSpeed(float);
double timeOffset() const;
void setTimeOffset(double);
float repeatCount() const;
void setRepeatCount(float);
bool autoreverses() const;
void setAutoreverses(bool);
FillModeType fillMode() const;
void setFillMode(FillModeType);
void setTimingFunction(const TimingFunction*, bool reverse = false);
void copyTimingFunctionFrom(const PlatformClutterAnimation*);
bool isRemovedOnCompletion() const;
void setRemovedOnCompletion(bool);
bool isAdditive() const;
void setAdditive(bool);
ValueFunctionType valueFunction() const;
void setValueFunction(ValueFunctionType);
void setFromValue(float);
void setFromValue(const WebCore::TransformationMatrix&);
void setFromValue(const FloatPoint3D&);
void setFromValue(const WebCore::Color&);
void copyFromValueFrom(const PlatformClutterAnimation*);
void setToValue(float);
void setToValue(const WebCore::TransformationMatrix&);
void setToValue(const FloatPoint3D&);
void setToValue(const WebCore::Color&);
void copyToValueFrom(const PlatformClutterAnimation*);
void setValues(const Vector<float>&);
void setValues(const Vector<WebCore::TransformationMatrix>&);
void setValues(const Vector<FloatPoint3D>&);
void setValues(const Vector<WebCore::Color>&);
void copyValuesFrom(const PlatformClutterAnimation*);
void setKeyTimes(const Vector<float>&);
void copyKeyTimesFrom(const PlatformClutterAnimation*);
void setTimingFunctions(const Vector<const TimingFunction*>&, bool reverse = false);
void copyTimingFunctionsFrom(const PlatformClutterAnimation*);
void addAnimationForKey(GraphicsLayerActor*, const String&);
void removeAnimationForKey(GraphicsLayerActor*, const String&);
void animationDidStart();
protected:
PlatformClutterAnimation(AnimationType, const String& keyPath);
PlatformClutterAnimation(const PlatformClutterAnimation*);
private:
ClutterTimeline* timeline() const;
AnimatedPropertyType stringToAnimatedPropertyType(const String& keyPath) const;
void addClutterTransitionForProperty(const String& property, const float fromValue, const float toValue);
void addClutterTransitionForProperty(const String& property, const WebCore::TransformationMatrix&, const WebCore::TransformationMatrix&);
void addClutterTransitionForProperty(const String& property, const FloatPoint3D& fromValue, const FloatPoint3D& toValue);
void addClutterKeyframeTransitionForProperty(const String& property, const Vector<float>& values);
void addClutterKeyframeTransitionForProperty(const String& property, const Vector<WebCore::TransformationMatrix>& values);
void addClutterKeyframeTransitionForProperty(const String& property, const Vector<FloatPoint3D>& values);
void addOpacityTransition();
void addTransformTransition();
AnimationType m_type;
AnimatedPropertyType m_animatedPropertyType;
GRefPtr<GObject> m_animation;
GRefPtr<ClutterActor> m_layer;
bool m_additive;
float m_fromValue;
float m_toValue;
FloatPoint3D m_fromValue3D;
FloatPoint3D m_toValue3D;
WebCore::TransformationMatrix m_fromValueMatrix;
WebCore::TransformationMatrix m_toValueMatrix;
float m_repeatCount;
const TimingFunction* m_timingFunction;
ValueFunctionType m_valueFunctionType;
Vector<float> m_keyTimes;
Vector<const TimingFunction*> m_timingFunctions;
Vector<float> m_values;
Vector<FloatPoint3D> m_values3D;
Vector<WebCore::TransformationMatrix> m_valuesMatrix;
};
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif // PlatformClutterAnimation_h