• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "pipeline/rs_recording_canvas.h"
49 #include "rosen_text/font_collection.h"
50 #include "rosen_text/text_effect.h"
51 #include "rosen_text/text_style.h"
52 #include "rosen_text/typography.h"
53 #include "rosen_text/typography_create.h"
54 #include "rosen_text/typography_types.h"
55 #include "utils/camera3d.h"
56 #include "utils/canvas_utils.h"
57 #include "utils/point3.h"
58 #include "utils/scalar.h"
59 #include "utils/picture_recorder.h"
60 
61 namespace OHOS::Ace {
62 namespace RSDrawing = Rosen::Drawing;
63 using RSCanvas = Rosen::Drawing::Canvas;
64 using RSImage = Rosen::Drawing::Image;
65 using RSBrush = Rosen::Drawing::Brush;
66 using RSFilter = Rosen::Drawing::Filter;
67 using RSColorFilter = Rosen::Drawing::ColorFilter;
68 using RSColorMatrix = Rosen::Drawing::ColorMatrix;
69 using RSPen = Rosen::Drawing::Pen;
70 using RSColor = Rosen::Drawing::Color;
71 using RSRect = Rosen::Drawing::Rect;
72 using RSPoint = Rosen::Drawing::Point;
73 using RSPoint3 = Rosen::Drawing::Point3;
74 using RSShadowFlags = Rosen::Drawing::ShadowFlags;
75 using RSBlendMode = Rosen::Drawing::BlendMode;
76 using RSSamplingOptions = Rosen::Drawing::SamplingOptions;
77 using RSRoundRect = Rosen::Drawing::RoundRect;
78 using RSPath = Rosen::Drawing::Path;
79 using RSPathOp = Rosen::Drawing::PathOp;
80 using RSBitmap = Rosen::Drawing::Bitmap;
81 using RSBitmapFormat = Rosen::Drawing::BitmapFormat;
82 using RSColorType = Rosen::Drawing::ColorType;
83 using RSAlphaType = Rosen::Drawing::AlphaType;
84 using RSScalar = Rosen::Drawing::scalar;
85 using RSClipOp = Rosen::Drawing::ClipOp;
86 using RSSkCanvas = Rosen::Drawing::SkiaCanvas;
87 using RSCanvasUtils = Rosen::Drawing::CanvasUtils;
88 using RSMatrix = Rosen::Drawing::Matrix;
89 using RSCamera3D = Rosen::Drawing::Camera3D;
90 using RSMaskFilter = Rosen::Drawing::MaskFilter;
91 using RSBlurType = Rosen::Drawing::BlurType;
92 using RSPathFillType = Rosen::Drawing::PathFillType;
93 using RSSkPath = Rosen::Drawing::SkiaPath;
94 using RSColorQuad = Rosen::Drawing::ColorQuad;
95 using RSColor4f = Rosen::Drawing::Color4f;
96 using RSShaderEffect = Rosen::Drawing::ShaderEffect;
97 using RSTileMode = Rosen::Drawing::TileMode;
98 using RSFont = Rosen::Drawing::Font;
99 using RSXform = Rosen::Drawing::RSXform;
100 using RSTextBlob = Rosen::Drawing::TextBlob;
101 using RSTextEncoding = Rosen::Drawing::TextEncoding;
102 using RSTypeface = Rosen::Drawing::Typeface;
103 using RSEncodedImageFormat = Rosen::Drawing::EncodedImageFormat;
104 using RSAutoCanvasRestore = Rosen::Drawing::AutoCanvasRestore;
105 using RSCubicResampler = Rosen::Drawing::CubicResampler;
106 using RSColorSpace = Rosen::Drawing::ColorSpace;
107 using RSData = Rosen::Drawing::Data;
108 using RSDrawCmdList = Rosen::Drawing::DrawCmdList;
109 using RSHybridRenderType = Rosen::Drawing::DrawCmdList::HybridRenderType;
110 using RSFilterMode = Rosen::Drawing::FilterMode;
111 using RSImageFilter = Rosen::Drawing::ImageFilter;
112 using RSMipmapMode = Rosen::Drawing::MipmapMode;
113 using RSPathDashStyle = Rosen::Drawing::PathDashStyle;
114 using RSPathDirection = Rosen::Drawing::PathDirection;
115 using RSPathEffect = Rosen::Drawing::PathEffect;
116 using RSPicture = Rosen::Drawing::Picture;
117 using RSRecordingCanvas = Rosen::ExtendRecordingCanvas;
118 using RSRecordingColorFilter = Rosen::Drawing::ColorFilter;
119 using RSRecordingColorSpace = Rosen::Drawing::ColorSpace;
120 using RSRecordingImageFilter = Rosen::Drawing::ImageFilter;
121 using RSRecordingMaskFilter = Rosen::Drawing::MaskFilter;
122 using RSRecordingPath = Rosen::Drawing::Path;
123 using RSRecordingPathEffect = Rosen::Drawing::PathEffect;
124 using RSRecordingRegion = Rosen::Drawing::Region;
125 using RSRecordingShaderEffect = Rosen::Drawing::ShaderEffect;
126 using RSSaveLayerOps = Rosen::Drawing::SaveLayerOps;
127 using RSSize = Rosen::Drawing::Size;
128 using RSSrcRectConstraint = Rosen::Drawing::SrcRectConstraint;
129 using RSPixmap = Rosen::Drawing::Pixmap;
130 using RSImageInfo = Rosen::Drawing::ImageInfo;
131 using RSRectI = Rosen::Drawing::RectI;
132 using RSImageBlurType = Rosen::Drawing::ImageBlurType;
133 using RSColorQuad = Rosen::Drawing::ColorQuad;
134 using RSShaderEffect = Rosen::Drawing::ShaderEffect;
135 using RSTileMode = Rosen::Drawing::TileMode;
136 using RSTextDirection = Rosen::TextDirection;
137 using RSTextAlign = Rosen::TextAlign;
138 using RSWordBreakType = Rosen::WordBreakType;
139 using RSTextBaseline = Rosen::TextBaseline;
140 using RSTextEffect = Rosen::TextEffect;
141 using RSTextEffectFactoryCreator = Rosen::TextEffectFactoryCreator;
142 using RSTextStyle = Rosen::TextStyle;
143 using RSTextDecoration = Rosen::TextDecoration;
144 using RSTextDecorationStyle = Rosen::TextDecorationStyle;
145 using RSFontWeight = Rosen::FontWeight;
146 using RSFontStyle = Rosen::FontStyle;
147 using RSPathEffect = Rosen::Drawing::PathEffect;
148 using RSPathDirection = Rosen::Drawing::PathDirection;
149 using RSPathDashStyle = Rosen::Drawing::PathDashStyle;
150 using RSParagraph = Rosen::Typography;
151 using RSParagraphBuilder = Rosen::TypographyCreate;
152 using RSFontCollection = Rosen::FontCollection;
153 using RSParagraphStyle = Rosen::TypographyStyle;
154 using RSTextRectHeightStyle = Rosen::TextRectHeightStyle;
155 using RSTextRectWidthStyle = Rosen::TextRectWidthStyle;
156 using RSTextRect = Rosen::TextRect;
157 using RSEllipsisMode = Rosen::EllipsisModal;
158 using RSSymbolAnimation = Rosen::RSSymbolAnimation;
159 using RSSymbolAnimationConfig = Rosen::TextEngine::SymbolAnimationConfig;
160 using RSPictureRecorder = Rosen::Drawing::PictureRecorder;
161 using RSCMSTransferFuncType = Rosen::Drawing::CMSTransferFuncType;
162 using RSCMSMatrixType = Rosen::Drawing::CMSMatrixType;
163 using RSClamp = Rosen::Drawing::Clamp;
164 struct RSDataWrapper {
165     std::shared_ptr<RSData> data;
166 };
167 
RSDataWrapperReleaseProc(const void *,void * context)168 inline void RSDataWrapperReleaseProc(const void*, void* context)
169 {
170     RSDataWrapper* wrapper = reinterpret_cast<RSDataWrapper*>(context);
171     delete wrapper;
172 }
173 } // namespace OHOS::Ace
174 #else
175 #include "core/components_ng/render/drawing_mock.h"
176 #endif
177 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_RENDER_DRAWING_H
178