Jason Sams | f468700 | 2010-03-10 17:30:41 -0800 | [diff] [blame] | 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 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
| 27 | |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 28 | class Animation : public ObjectBase { |
Jason Sams | f468700 | 2010-03-10 17:30:41 -0800 | [diff] [blame] | 29 | public: |
| 30 | ~Animation(); |
| 31 | |
| 32 | static Animation * create(Context *rsc, |
| 33 | const float *inValues, const float *outValues, |
| 34 | uint32_t valueCount, RsAnimationInterpolation, |
| 35 | RsAnimationEdge pre, RsAnimationEdge post); |
| 36 | |
| 37 | float eval(float) const; |
Alex Sakhartchouk | aae74ad | 2010-06-04 10:06:50 -0700 | [diff] [blame] | 38 | |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 39 | virtual void serialize(OStream *stream) const; |
Alex Sakhartchouk | aae74ad | 2010-06-04 10:06:50 -0700 | [diff] [blame] | 40 | virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ANIMATION; } |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 41 | static Animation *createFromStream(Context *rsc, IStream *stream); |
Jason Sams | f468700 | 2010-03-10 17:30:41 -0800 | [diff] [blame] | 42 | |
| 43 | protected: |
| 44 | Animation(Context *rsc); |
| 45 | |
| 46 | |
| 47 | |
| 48 | float evalInRange(float) const; |
| 49 | |
| 50 | |
| 51 | |
| 52 | const float *mValuesInput; |
| 53 | const float *mValuesOutput; |
| 54 | uint32_t mValueCount; |
| 55 | RsAnimationInterpolation mInterpolation; |
| 56 | RsAnimationEdge mEdgePre; |
| 57 | RsAnimationEdge mEdgePost; |
| 58 | |
| 59 | // derived |
| 60 | float mInputMin; |
| 61 | float mInputMax; |
| 62 | }; |
| 63 | |
Jason Sams | f468700 | 2010-03-10 17:30:41 -0800 | [diff] [blame] | 64 | } |
| 65 | } |
| 66 | #endif //ANDROID_STRUCTURED_ELEMENT_H |
| 67 | |