1 /* 2 * Copyright (c) 2023-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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CANVAS_RENDERER_CANVAS_RENDERER_TYPE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CANVAS_RENDERER_CANVAS_RENDERER_TYPE_H 18 19 #include "base/geometry/ng/size_t.h" 20 #include "base/memory/ace_type.h" 21 #include "core/components/common/properties/paint_state.h" 22 #include "core/components/common/properties/text_style.h" 23 24 namespace OHOS::Ace::NG { 25 class SvgDomBase; 26 } 27 namespace OHOS::Ace { 28 struct BaseInfo { 29 bool isOffscreen; 30 bool anti; 31 PaintState paintState; 32 RefPtr<AceType> canvasPattern; 33 RefPtr<AceType> offscreenPattern; 34 }; 35 36 struct FillTextInfo { 37 std::string text; 38 double x; 39 double y; 40 std::optional<double> maxWidth; 41 }; 42 43 struct ImageInfo { 44 CanvasImage image; 45 double imgWidth; 46 double imgHeight; 47 RefPtr<PixelMap> pixelMap; 48 RefPtr<NG::SvgDomBase> svgDom; 49 bool isImage; 50 bool isSvg; 51 NG::SizeF imageSize; 52 ImageFit imageFit; 53 int32_t instanceId = 0; 54 }; 55 56 struct ImageSize { 57 double left; 58 double top; 59 double width; 60 double height; 61 }; 62 63 struct BitmapMeshInfo { 64 std::vector<double> mesh; 65 double column; 66 double row; 67 RefPtr<AceType> offscreenPattern; 68 RefPtr<AceType> pool; 69 }; 70 } // namespace OHOS::Ace 71 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CANVAS_RENDERER_CANVAS_RENDERER_TYPE_H 72