rsAnimation.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef ANDROID_RS_ANIMATION_H
  17. #define ANDROID_RS_ANIMATION_H
  18. #include "rsUtils.h"
  19. #include "rsObjectBase.h"
  20. #include "rsInternalDefines.h"
  21. // ---------------------------------------------------------------------------
  22. namespace android {
  23. namespace renderscript {
  24. class Animation : public ObjectBase {
  25. public:
  26. ~Animation();
  27. static Animation * create(Context *rsc,
  28. const float *inValues, const float *outValues,
  29. uint32_t valueCount, RsAnimationInterpolation,
  30. RsAnimationEdge pre, RsAnimationEdge post);
  31. float eval(float) const;
  32. virtual void serialize(Context *rsc, OStream *stream) const;
  33. virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ANIMATION; }
  34. static Animation *createFromStream(Context *rsc, IStream *stream);
  35. protected:
  36. explicit Animation(Context *rsc);
  37. float evalInRange(float) const;
  38. const float *mValuesInput;
  39. const float *mValuesOutput;
  40. uint32_t mValueCount;
  41. RsAnimationInterpolation mInterpolation;
  42. RsAnimationEdge mEdgePre;
  43. RsAnimationEdge mEdgePost;
  44. // derived
  45. float mInputMin;
  46. float mInputMax;
  47. };
  48. } // namespace renderscript
  49. } // namespace android
  50. #endif //ANDROID_STRUCTURED_ELEMENT_H