Interpolator.h revision 315c329544d7c593d1072b071cbb92d9afe74021
1/* 2 * Copyright (C) 2014 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 INTERPOLATOR_H 17#define INTERPOLATOR_H 18 19#include <stddef.h> 20 21#include <cutils/compiler.h> 22 23namespace android { 24namespace uirenderer { 25 26class Interpolator { 27public: 28 virtual ~Interpolator() {} 29 30 virtual float interpolate(float input) = 0; 31 32 static Interpolator* createDefaultInterpolator(); 33 34protected: 35 Interpolator() {} 36}; 37 38class ANDROID_API AccelerateDecelerateInterpolator : public Interpolator { 39public: 40 AccelerateDecelerateInterpolator() {} 41 virtual ~AccelerateDecelerateInterpolator() {} 42 43 virtual float interpolate(float input); 44}; 45 46class ANDROID_API LUTInterpolator : public Interpolator { 47public: 48 LUTInterpolator(float* values, size_t size); 49 ~LUTInterpolator(); 50 51 virtual float interpolate(float input); 52 53private: 54 float* mValues; 55 size_t mSize; 56}; 57 58} /* namespace uirenderer */ 59} /* namespace android */ 60 61#endif /* INTERPOLATOR_H */ 62