IntrinsicBlurFilter.h revision 744f5739019d1fd917f981e740b353c3d73fd1a8
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
17#ifndef INTRINSIC_BLUR_FILTER_H_
18#define INTRINSIC_BLUR_FILTER_H_
19
20#include "RenderScript.h"
21#include "SimpleFilter.h"
22
23namespace android {
24
25struct IntrinsicBlurFilter : public SimpleFilter {
26public:
27    IntrinsicBlurFilter() : mBlurRadius(1.f) {};
28
29    virtual status_t start();
30    virtual void reset();
31    virtual status_t setParameters(const sp<AMessage> &msg);
32    virtual status_t processBuffers(
33            const sp<ABuffer> &srcBuffer, const sp<ABuffer> &outBuffer);
34
35protected:
36    virtual ~IntrinsicBlurFilter() {};
37
38private:
39    RSC::sp<RSC::RS> mRS;
40    RSC::sp<RSC::Allocation> mAllocIn;
41    RSC::sp<RSC::Allocation> mAllocOut;
42    RSC::sp<RSC::ScriptIntrinsicBlur> mBlur;
43    float mBlurRadius;
44};
45
46}   // namespace android
47
48#endif  // INTRINSIC_BLUR_FILTER_H_
49