1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RENDER_SERVICE_CLIENT_CORE_RENDER_RS_HPS_BLUR_H
17 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_HPS_BLUR_H
18 
19 #include "draw/canvas.h"
20 #include "effect/color_filter.h"
21 #include "effect/runtime_effect.h"
22 #include "image/image.h"
23 #include "utils/matrix.h"
24 #include "utils/rect.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 class HpsBlurFilter {
29 public:
30     ~HpsBlurFilter() = default;
31     bool ApplyHpsBlur(Drawing::Canvas& canvas, const std::shared_ptr<Drawing::Image>& image,
32         const Drawing::HpsBlurParameter& param, float alpha) const;
GetHpsBlurFilter()33     const static HpsBlurFilter& GetHpsBlurFilter()
34     {
35         static HpsBlurFilter filter;
36         return filter;
37     }
38 
39 private:
40     HpsBlurFilter() = default;
41     static Drawing::Matrix GetShaderTransform(const Drawing::Rect& blurRect, float scaleW = 1.0f, float scaleH = 1.0f);
42 };
43 } // namespace Rosen
44 } // namespace OHOS
45 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_HPS_BLUR_H