1 /*
2  * Copyright (c) 2021-2022 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_VIDEO_ROSEN_RENDER_TEXTURE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_VIDEO_ROSEN_RENDER_TEXTURE_H
18 
19 #include "core/components/common/layout/constants.h"
20 #include "core/components/common/properties/decoration.h"
21 #ifdef OHOS_STANDARD_SYSTEM
22 #include "surface.h"
23 #endif
24 
25 #include "core/components/video/render_texture.h"
26 
27 namespace OHOS::Ace {
28 
29 class RosenRenderTexture final : public RenderTexture {
30     DECLARE_ACE_TYPE(RosenRenderTexture, RenderTexture);
31 
32 public:
33     RosenRenderTexture() = default;
34     ~RosenRenderTexture() override = default;
35 
36     void Paint(RenderContext& context, const Offset& offset) override;
37 
38     void SyncGeometryProperties() override;
39 
40     std::shared_ptr<RSNode> CreateRSNode() const override;
41 
42     void Update(const RefPtr<Component>& component) override;
43     void UpdateOpacity(uint8_t opacity) override;
44     void DumpTree(int32_t depth) override;
45     void SetIsAddGaussianFuzzy(bool isAddGaussianFuzzy) override;
46 
47 #ifdef OHOS_STANDARD_SYSTEM
48     OHOS::sptr<OHOS::Surface> GetSurface();
49     void SyncProperties(const Size& videoSize, ImageFit imagefit, ImageObjectPosition imagePosition);
50 #endif
51 
52 private:
53     void AddGaussianFuzzy(RenderContext& context, const Offset& offset);
54     void InitGaussianFuzzyParas();
55 
56     RefPtr<Animator> controller_;
57     RefPtr<CurveAnimation<uint8_t>> moveAnimation_;
58     Color colorValue_;
59     Rect gaussianFuzzySize_;
60 };
61 
62 } // namespace OHOS::Ace
63 
64 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_VIDEO_ROSEN_RENDER_TEXTURE_H
65