rsAnimation.h revision fb6b614bcea88a587a7ea4530be45ff0ffa0210e
1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_RS_ANIMATION_H
18#define ANDROID_RS_ANIMATION_H
19
20#include "rsUtils.h"
21#include "rsObjectBase.h"
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27
28class Animation : public ObjectBase
29{
30public:
31    ~Animation();
32
33    static Animation * create(Context *rsc,
34                              const float *inValues, const float *outValues,
35                              uint32_t valueCount, RsAnimationInterpolation,
36                              RsAnimationEdge pre, RsAnimationEdge post);
37
38    float eval(float) const;
39
40    virtual void serialize(OStream *stream) const;
41    virtual A3DClassID getClassId() const { return A3D_CLASS_ID_ANIMATION; }
42    static Animation *createFromStream(Context *rsc, IStream *stream);
43
44protected:
45    Animation(Context *rsc);
46
47
48
49    float evalInRange(float) const;
50
51
52
53    const float *mValuesInput;
54    const float *mValuesOutput;
55    uint32_t mValueCount;
56    RsAnimationInterpolation mInterpolation;
57    RsAnimationEdge mEdgePre;
58    RsAnimationEdge mEdgePost;
59
60    // derived
61    float mInputMin;
62    float mInputMax;
63};
64
65
66
67
68}
69}
70#endif //ANDROID_STRUCTURED_ELEMENT_H
71
72