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_SCENE_BUILDER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_SCENE_BUILDER_H 18 19 #include "experimental/svg/model/SkSVGDOM.h" 20 #include "flutter/lib/ui/painting/image_filter.h" 21 #include "flutter/lib/ui/painting/path.h" 22 #include "flutter/lib/ui/painting/picture.h" 23 #include "flutter/lib/ui/painting/rrect.h" 24 #include "flutter/lib/ui/painting/shader.h" 25 26 #include "base/geometry/matrix4.h" 27 #include "base/memory/ace_type.h" 28 29 namespace OHOS::Ace::Flutter { 30 31 class SceneBuilder : public AceType { 32 DECLARE_ACE_TYPE(SceneBuilder, AceType) 33 public: 34 SceneBuilder() = default; 35 ~SceneBuilder() override = default; 36 37 virtual void AddPicture(double dx, double dy, fml::RefPtr<flutter::Picture> picture, int hints) = 0; 38 virtual void AddTexture( 39 double dx, double dy, double width, double height, int64_t textureId, bool freeze, uint8_t opacity) = 0; 40 virtual void PushTransform(const Matrix4& matrix4) = 0; 41 virtual void PushClipRRect(const flutter::RRect& rrect, int32_t clipBehavior) = 0; 42 virtual void PushClipPath(const flutter::CanvasPath* path, int32_t clipBehavior) = 0; 43 virtual void PushOpacity(int32_t alpha, double dx = 0, double dy = 0) = 0; 44 virtual void PushBackdropFilter(fml::RefPtr<flutter::ImageFilter> imageFilter) = 0; 45 virtual void PushShaderMask(fml::RefPtr<flutter::Shader> shader, double maskRectLeft, double maskRectRight, 46 double maskRectTop, double maskRectBottom, int32_t blendMode) = 0; 47 virtual void PushGradientColorMask(const SkPaint& maskPaint) = 0; 48 virtual void PushSvgMask(const sk_sp<SkSVGDOM>& svgDom, double x, double y, double scaleX, double scaleY) = 0; 49 virtual void PushPathMask(const SkPaint& maskPaint, const SkPath& maskPath) = 0; 50 virtual void PushFilter(const SkPaint& filterPaint) = 0; 51 virtual void PushHole(double dx, double dy, double width, double height, int32_t holeId) = 0; 52 virtual void Pop() = 0; 53 }; 54 55 } // namespace OHOS::Ace::Flutter 56 57 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_LAYERS_SCENE_BUILDER_H 58