• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_LAYERS_FLUTTER_SCENE_BUILDER_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_FLUTTER_SCENE_BUILDER_H
18 
19 #include "flutter/lib/ui/compositing/scene.h"
20 #include "flutter/lib/ui/compositing/scene_builder.h"
21 
22 #include "core/pipeline/layers/scene_builder.h"
23 
24 namespace OHOS::Ace::Flutter {
25 
26 class FlutterSceneBuilder : public SceneBuilder {
27     DECLARE_ACE_TYPE(FlutterSceneBuilder, SceneBuilder)
28 public:
29     FlutterSceneBuilder();
30     ~FlutterSceneBuilder() override = default;
31 
32     void AddPicture(double dx, double dy, fml::RefPtr<flutter::Picture> picture, int hints) override;
33     void AddTexture(
34         double dx, double dy, double width, double height, int64_t textureId, bool freeze, uint8_t opacity) override;
35     void PushTransform(const Matrix4& matrix4) override;
36     void PushClipRRect(const flutter::RRect& rrect, int32_t clipBehavior) override;
37     void PushClipPath(const flutter::CanvasPath* path, int32_t clipBehavior) override;
38     void PushOpacity(int32_t alpha, double dx = 0, double dy = 0) override;
39     void PushBackdropFilter(fml::RefPtr<flutter::ImageFilter> imageFilter) override;
40     void PushShaderMask(fml::RefPtr<flutter::Shader> shader, double maskRectLeft, double maskRectRight,
41         double maskRectTop, double maskRectBottom, int32_t blendMode) override;
42     void PushGradientColorMask(const SkPaint& maskPaint) override;
43     void PushSvgMask(const sk_sp<SkSVGDOM>& svgDom, double x, double y, double scaleX, double scaleY) override;
44     void PushPathMask(const SkPaint& maskPaint, const SkPath& maskPath) override;
45     void PushFilter(const SkPaint& filterPaint) override;
46     void PushHole(double dx, double dy, double width, double height, int32_t holeId) override;
47     void Pop() override;
48 
49     fml::RefPtr<flutter::Scene> Build();
50 
51 private:
52     fml::RefPtr<flutter::SceneBuilder> sceneBuilder_;
53 };
54 
55 } // namespace OHOS::Ace::Flutter
56 
57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_FLUTTER_SCENE_BUILDER_H
58