1 /*
2  * Copyright (c) 2022-2023 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_RENDER_DRAWING_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_DRAWING_H
18 
19 #ifndef ACE_UNITTEST
20 #include "draw/canvas.h"
21 #include "draw/shadow.h"
22 #include "drawing/engine_adapter/skia_adapter/skia_canvas.h"
23 #include "drawing/engine_adapter/skia_adapter/skia_path.h"
24 #include "image/image.h"
25 #include "rosen_text/symbol_animation_config.h"
26 #include "render_service_client/core/animation/rs_symbol_animation.h"
27 
28 // win API conflict handle
29 #ifdef DIFFERENCE
30 #undef DIFFERENCE
31 #endif
32 #ifdef DrawText
33 #undef DrawText
34 #endif
35 #ifdef GetMessage
36 #undef GetMessage
37 #endif
38 #ifdef LoadImage
39 #undef LoadImage
40 #endif
41 #ifdef GetCurrentTime
42 #undef GetCurrentTime
43 #endif
44 #ifdef DOUBLE_CLICK
45 #undef DOUBLE_CLICK
46 #endif
47 
48 #ifdef USE_ROSEN_DRAWING
49 #include "pipeline/rs_recording_canvas.h"
50 #endif
51 #ifndef USE_GRAPHIC_TEXT_GINE
52 #include "rosen_text/properties/text_style.h"
53 #include "rosen_text/ui/font_collection.h"
54 #include "rosen_text/ui/typography.h"
55 #include "rosen_text/ui/typography_create.h"
56 #else
57 #include "rosen_text/font_collection.h"
58 #include "rosen_text/typography.h"
59 #include "rosen_text/typography_create.h"
60 #include "rosen_text/typography_types.h"
61 #include "rosen_text/text_style.h"
62 #endif
63 #include "utils/camera3d.h"
64 #include "utils/point3.h"
65 #include "utils/scalar.h"
66 
67 namespace OHOS::Ace {
68 namespace RSDrawing = Rosen::Drawing;
69 using RSCanvas = Rosen::Drawing::Canvas;
70 using RSImage = Rosen::Drawing::Image;
71 using RSBrush = Rosen::Drawing::Brush;
72 using RSFilter = Rosen::Drawing::Filter;
73 using RSColorFilter = Rosen::Drawing::ColorFilter;
74 using RSColorMatrix = Rosen::Drawing::ColorMatrix;
75 using RSPen = Rosen::Drawing::Pen;
76 using RSColor = Rosen::Drawing::Color;
77 using RSRect = Rosen::Drawing::Rect;
78 using RSPoint = Rosen::Drawing::Point;
79 using RSPoint3 = Rosen::Drawing::Point3;
80 using RSShadowFlags = Rosen::Drawing::ShadowFlags;
81 using RSBlendMode = Rosen::Drawing::BlendMode;
82 using RSSamplingOptions = Rosen::Drawing::SamplingOptions;
83 using RSRoundRect = Rosen::Drawing::RoundRect;
84 using RSPath = Rosen::Drawing::Path;
85 using RSPathOp = Rosen::Drawing::PathOp;
86 using RSBitmap = Rosen::Drawing::Bitmap;
87 using RSBitmapFormat = Rosen::Drawing::BitmapFormat;
88 using RSColorType = Rosen::Drawing::ColorType;
89 using RSAlphaType = Rosen::Drawing::AlphaType;
90 using RSScalar = Rosen::Drawing::scalar;
91 using RSClipOp = Rosen::Drawing::ClipOp;
92 using RSSkCanvas = Rosen::Drawing::SkiaCanvas;
93 using RSMatrix = Rosen::Drawing::Matrix;
94 using RSCamera3D = Rosen::Drawing::Camera3D;
95 using RSMaskFilter = Rosen::Drawing::MaskFilter;
96 using RSBlurType = Rosen::Drawing::BlurType;
97 using RSPathFillType = Rosen::Drawing::PathFillType;
98 using RSSkPath = Rosen::Drawing::SkiaPath;
99 using RSColorQuad = Rosen::Drawing::ColorQuad;
100 using RSShaderEffect = Rosen::Drawing::ShaderEffect;
101 using RSTileMode = Rosen::Drawing::TileMode;
102 using RSFont = Rosen::Drawing::Font;
103 using RSXform = Rosen::Drawing::RSXform;
104 using RSTextBlob = Rosen::Drawing::TextBlob;
105 using RSTextEncoding = Rosen::Drawing::TextEncoding;
106 using RSTypeface = Rosen::Drawing::Typeface;
107 using RSEncodedImageFormat = Rosen::Drawing::EncodedImageFormat;
108 #ifdef USE_ROSEN_DRAWING
109 using RSAutoCanvasRestore = Rosen::Drawing::AutoCanvasRestore;
110 using RSCubicResampler = Rosen::Drawing::CubicResampler;
111 using RSColorSpace = Rosen::Drawing::ColorSpace;
112 using RSData = Rosen::Drawing::Data;
113 using RSDrawCmdList = Rosen::Drawing::DrawCmdList;
114 using RSFilterMode = Rosen::Drawing::FilterMode;
115 using RSImageFilter = Rosen::Drawing::ImageFilter;
116 using RSMipmapMode = Rosen::Drawing::MipmapMode;
117 using RSPathDashStyle = Rosen::Drawing::PathDashStyle;
118 using RSPathDirection = Rosen::Drawing::PathDirection;
119 using RSPathEffect = Rosen::Drawing::PathEffect;
120 using RSPicture = Rosen::Drawing::Picture;
121 using RSRecordingCanvas = Rosen::ExtendRecordingCanvas;
122 using RSRecordingColorFilter = Rosen::Drawing::ColorFilter;
123 using RSRecordingColorSpace = Rosen::Drawing::ColorSpace;
124 using RSRecordingImageFilter = Rosen::Drawing::ImageFilter;
125 using RSRecordingMaskFilter = Rosen::Drawing::MaskFilter;
126 using RSRecordingPath = Rosen::Drawing::Path;
127 using RSRecordingPathEffect = Rosen::Drawing::PathEffect;
128 using RSRecordingRegion = Rosen::Drawing::Region;
129 using RSRecordingShaderEffect = Rosen::Drawing::ShaderEffect;
130 using RSSaveLayerOps = Rosen::Drawing::SaveLayerOps;
131 using RSSize = Rosen::Drawing::Size;
132 using RSSrcRectConstraint = Rosen::Drawing::SrcRectConstraint;
133 using RSPixmap = Rosen::Drawing::Pixmap;
134 using RSImageInfo = Rosen::Drawing::ImageInfo;
135 using RSRectI = Rosen::Drawing::RectI;
136 using RSImageBlurType = Rosen::Drawing::ImageBlurType;
137 #endif
138 #ifndef USE_GRAPHIC_TEXT_GINE
139 using RSPathEffect = rosen::PathEffect;
140 using RSPathDirection = rosen::PathDirection;
141 using RSPathDashStyle = rosen::PathDashStyle;
142 using RSParagraph = rosen::Typography;
143 using RSTypographyProperties = rosen::TypographyProperties;
144 using RSParagraphBuilder = rosen::TypographyCreate;
145 using RSFontCollection = rosen::FontCollection;
146 using RSParagraphStyle = rosen::TypographyStyle;
147 using RSColorQuad = rosen::ColorQuad;
148 using RSShaderEffect = rosen::ShaderEffect;
149 using RSTileMode = rosen::TileMode;
150 using RSTextDirection = rosen::TextDirection;
151 using RSTextAlign = rosen::TextAlign;
152 using RSWordBreakType = rosen::WordBreakType;
153 using RSTextStyle = rosen::TextStyle;
154 using RSTextDecoration = rosen::TextDecoration;
155 using RSTextDecorationStyle = rosen::TextDecorationStyle;
156 using RSFontWeight = rosen::FontWeight;
157 using RSFontStyle = rosen::FontStyle;
158 using RSTextBaseline = rosen::TextBaseline;
159 #else
160 using RSColorQuad = Rosen::Drawing::ColorQuad;
161 using RSShaderEffect = Rosen::Drawing::ShaderEffect;
162 using RSTileMode = Rosen::Drawing::TileMode;
163 using RSTextDirection = Rosen::TextDirection;
164 using RSTextAlign = Rosen::TextAlign;
165 using RSWordBreakType = Rosen::WordBreakType;
166 using RSTextBaseline = Rosen::TextBaseline;
167 using RSTextStyle = Rosen::TextStyle;
168 using RSTextDecoration = Rosen::TextDecoration;
169 using RSTextDecorationStyle = Rosen::TextDecorationStyle;
170 using RSFontWeight = Rosen::FontWeight;
171 using RSFontStyle = Rosen::FontStyle;
172 using RSPathEffect = Rosen::Drawing::PathEffect;
173 using RSPathDirection = Rosen::Drawing::PathDirection;
174 using RSPathDashStyle = Rosen::Drawing::PathDashStyle;
175 using RSParagraph = Rosen::Typography;
176 using RSParagraphBuilder = Rosen::TypographyCreate;
177 using RSFontCollection = Rosen::FontCollection;
178 using RSParagraphStyle = Rosen::TypographyStyle;
179 using RSTextRectHeightStyle = Rosen::TextRectHeightStyle;
180 using RSTextRectWidthStyle = Rosen::TextRectWidthStyle;
181 using RSTextRect = Rosen::TextRect;
182 using RSEllipsisMode = Rosen::EllipsisModal;
183 using RSSymbolAnimation = Rosen::RSSymbolAnimation;
184 using RSSymbolAnimationConfig = Rosen::TextEngine::SymbolAnimationConfig;
185 #endif
186 } // namespace OHOS::Ace
187 #else
188 #include "core/components_ng/render/drawing_mock.h"
189 #endif
190 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_DRAWING_H
191