1 /*
2  * Copyright (c) 2021-2022 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_BRIDGE_JS_FRONTEND_ENGINE_JSI_CANVAS_BRIDGE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_JSI_CANVAS_BRIDGE_H
18 
19 #include <map>
20 #include <string>
21 
22 #include "frameworks/bridge/common/dom/dom_canvas.h"
23 #include "frameworks/bridge/js_frontend/engine/common/base_canvas_bridge.h"
24 #include "frameworks/bridge/js_frontend/engine/jsi/jsi_engine.h"
25 
26 namespace OHOS::Ace::Framework {
27 
28 class JsiCanvasBridge : public BaseCanvasBridge {
29     DECLARE_ACE_TYPE(JsiCanvasBridge, BaseCanvasBridge)
30 
31 public:
32     virtual ~JsiCanvasBridge();
33     void HandleJsContext(const shared_ptr<JsRuntime>& runtime, NodeId id, const std::string& args);
34     void HandleToDataURL(const shared_ptr<JsRuntime>& runtime, NodeId id, const std::string& args);
35 
OnJsEngineDestroy()36     void OnJsEngineDestroy() override
37     {
38         renderContext_.reset();
39     }
40 
GetRenderContext()41     const shared_ptr<JsValue>& GetRenderContext() const
42     {
43         return renderContext_;
44     }
45 
GetDataURL()46     const shared_ptr<JsValue>& GetDataURL() const
47     {
48         return dataURL_;
49     }
50 
51     static shared_ptr<JsValue> JsCreateLinearGradient(const shared_ptr<JsRuntime>& runtime,
52         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
53     static shared_ptr<JsValue> JsCreateRadialGradient(const shared_ptr<JsRuntime>& runtime,
54         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
55     static shared_ptr<JsValue> JsAddColorStop(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
56         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
57 
58     // rect bridge
59     static shared_ptr<JsValue> JsFillRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
60         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
61     static shared_ptr<JsValue> JsStrokeRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
62         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
63     static shared_ptr<JsValue> JsClearRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
64         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
65 
66     // text bridge
67     static shared_ptr<JsValue> JsFillText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
68         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
69     static shared_ptr<JsValue> JsStrokeText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
70         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
71     static shared_ptr<JsValue> JsMeasureText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
72         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
73 
74     // path bridge
75     static shared_ptr<JsValue> JsBeginPath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
76         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
77     static shared_ptr<JsValue> JsClosePath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
78         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
79     static shared_ptr<JsValue> JsMoveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
80         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
81     static shared_ptr<JsValue> JsLineTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
82         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
83     static shared_ptr<JsValue> JsBezierCurveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
84         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
85     static shared_ptr<JsValue> JsQuadraticCurveTo(const shared_ptr<JsRuntime>& runtime,
86         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
87     static shared_ptr<JsValue> JsArc(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
88         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
89     static shared_ptr<JsValue> JsArcTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
90         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
91     static shared_ptr<JsValue> JsEllipse(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
92         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
93 
94     static shared_ptr<JsValue> JsRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
95         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
96     static shared_ptr<JsValue> JsFill(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
97         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
98     static shared_ptr<JsValue> JsStroke(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
99         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
100     static shared_ptr<JsValue> JsClip(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
101         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
102 
103     static shared_ptr<JsValue> JsSave(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
104         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
105     static shared_ptr<JsValue> JsRestore(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
106         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
107 
108     static shared_ptr<JsValue> JsRotate(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
109         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
110     static shared_ptr<JsValue> JsScale(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
111         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
112     static shared_ptr<JsValue> JsSetTransform(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
113         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
114     static shared_ptr<JsValue> JsTransform(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
115         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
116     static shared_ptr<JsValue> JsTranslate(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
117         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
118     static shared_ptr<JsValue> JsGetLineDash(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
119         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
120     static shared_ptr<JsValue> JsSetLineDash(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
121         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
122     static shared_ptr<JsValue> JsDrawImage(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
123         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
124     static shared_ptr<JsValue> JsCreatePath2D(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
125         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
126     static shared_ptr<JsValue> JsCreatePattern(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
127         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
128     static shared_ptr<JsValue> JsCreateImageData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
129         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
130     static shared_ptr<JsValue> JsPutImageData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
131         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
132     static shared_ptr<JsValue> JsGetImageData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
133         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
134     static shared_ptr<JsValue> JsGetPixelMap(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
135         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
136     static shared_ptr<JsValue> JsTransferFromImageBitmap(const shared_ptr<JsRuntime>& runtime,
137         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
138     static shared_ptr<JsValue> JsDrawBitmapMesh(const shared_ptr<JsRuntime>& runtime,
139         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
140     // support to read inner json data by lottie
141     static shared_ptr<JsValue> JsGetJsonData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
142         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
143 
144     // getter and setter
145     static shared_ptr<JsValue> JsFillStyleGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
146         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
147     static shared_ptr<JsValue> JsFillStyleSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
148         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
149     static shared_ptr<JsValue> JsStrokeStyleGetter(const shared_ptr<JsRuntime>& runtime,
150         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
151     static shared_ptr<JsValue> JsStrokeStyleSetter(const shared_ptr<JsRuntime>& runtime,
152         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
153     static shared_ptr<JsValue> JsLineCapGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
154         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
155     static shared_ptr<JsValue> JsLineCapSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
156         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
157     static shared_ptr<JsValue> JsLineJoinGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
158         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
159     static shared_ptr<JsValue> JsLineJoinSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
160         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
161     static shared_ptr<JsValue> JsMiterLimitGetter(const shared_ptr<JsRuntime>& runtime,
162         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
163     static shared_ptr<JsValue> JsMiterLimitSetter(const shared_ptr<JsRuntime>& runtime,
164         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
165     static shared_ptr<JsValue> JsLineWidthGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
166         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
167     static shared_ptr<JsValue> JsLineWidthSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
168         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
169     static shared_ptr<JsValue> JsTextAlignGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
170         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
171     static shared_ptr<JsValue> JsTextAlignSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
172         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
173     static shared_ptr<JsValue> JsTextBaselineGetter(const shared_ptr<JsRuntime>& runtime,
174         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
175     static shared_ptr<JsValue> JsTextBaselineSetter(const shared_ptr<JsRuntime>& runtime,
176         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
177     static shared_ptr<JsValue> JsFontGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
178         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
179     static shared_ptr<JsValue> JsFontSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
180         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
181     static shared_ptr<JsValue> JsAlphaGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
182         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
183     static shared_ptr<JsValue> JsAlphaSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
184         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
185     static shared_ptr<JsValue> JsCompositeOperationGetter(const shared_ptr<JsRuntime>& runtime,
186         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
187     static shared_ptr<JsValue> JsCompositeOperationSetter(const shared_ptr<JsRuntime>& runtime,
188         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
189     static shared_ptr<JsValue> JsLineDashOffsetGetter(const shared_ptr<JsRuntime>& runtime,
190         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
191     static shared_ptr<JsValue> JsLineDashOffsetSetter(const shared_ptr<JsRuntime>& runtime,
192         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
193     static shared_ptr<JsValue> JsShadowBlurGetter(const shared_ptr<JsRuntime>& runtime,
194         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
195     static shared_ptr<JsValue> JsShadowBlurSetter(const shared_ptr<JsRuntime>& runtime,
196         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
197     static shared_ptr<JsValue> JsShadowColorGetter(const shared_ptr<JsRuntime>& runtime,
198         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
199     static shared_ptr<JsValue> JsShadowColorSetter(const shared_ptr<JsRuntime>& runtime,
200         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
201     static shared_ptr<JsValue> JsShadowOffsetXGetter(const shared_ptr<JsRuntime>& runtime,
202         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
203     static shared_ptr<JsValue> JsShadowOffsetXSetter(const shared_ptr<JsRuntime>& runtime,
204         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
205     static shared_ptr<JsValue> JsShadowOffsetYGetter(const shared_ptr<JsRuntime>& runtime,
206         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
207     static shared_ptr<JsValue> JsShadowOffsetYSetter(const shared_ptr<JsRuntime>& runtime,
208         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
209     static shared_ptr<JsValue> JsSmoothingEnabledGetter(const shared_ptr<JsRuntime>& runtime,
210         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
211     static shared_ptr<JsValue> JsSmoothingEnabledSetter(const shared_ptr<JsRuntime>& runtime,
212         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
213     static shared_ptr<JsValue> JsSmoothingQualityGetter(const shared_ptr<JsRuntime>& runtime,
214         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
215     static shared_ptr<JsValue> JsSmoothingQualitySetter(const shared_ptr<JsRuntime>& runtime,
216         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
217 
218     // support only read attribute for lottie
219     static shared_ptr<JsValue> JsWidthGetter(const shared_ptr<JsRuntime>& runtime,
220         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
221     static shared_ptr<JsValue> JsHeightGetter(const shared_ptr<JsRuntime>& runtime,
222         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
223 
224     static shared_ptr<JsValue> JsPath2DAddPath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
225         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
226     static shared_ptr<JsValue> JsPath2DSetTransform(const shared_ptr<JsRuntime>& runtime,
227         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
228     static shared_ptr<JsValue> JsPath2DMoveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
229         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
230     static shared_ptr<JsValue> JsPath2DLineTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
231         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
232     static shared_ptr<JsValue> JsPath2DArc(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
233         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
234     static shared_ptr<JsValue> JsPath2DArcTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
235         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
236     static shared_ptr<JsValue> JsPath2DQuadraticCurveTo(const shared_ptr<JsRuntime>& runtime,
237         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
238     static shared_ptr<JsValue> JsPath2DBezierCurveTo(const shared_ptr<JsRuntime>& runtime,
239         const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
240     static shared_ptr<JsValue> JsPath2DEllipse(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
241         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
242     static shared_ptr<JsValue> JsPath2DRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
243         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
244     static shared_ptr<JsValue> JsPath2DClosePath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
245         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
246 
247 private:
248     static Gradient GetGradient(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value);
249     static Pattern GetPattern(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value);
250     static RefPtr<CanvasPath2D> GetPath2D(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value);
251     static void ParseDomImage(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, double& width,
252         double& height, std::string& src);
253     static void ParseImageData(const shared_ptr<JsRuntime>& runtime, const std::vector<shared_ptr<JsValue>>& argv,
254         int32_t argc, std::vector<std::string>& array, ImageData& imageData);
255     static void JsSetAntiAlias(const shared_ptr<JsRuntime>& runtime, NodeId id, const std::string& args);
256     static RefPtr<CanvasPath2D> JsMakePath2D(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value,
257         const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
258     void HandleWebglContext(const shared_ptr<JsRuntime>& runtime,
259         NodeId id, const std::string& args, CanvasRenderContextBase*& canvasRenderContext);
260     shared_ptr<JsValue> renderContext_;
261     shared_ptr<JsValue> dataURL_;
262 
263     CanvasRenderContextBase* webglRenderContext_ = nullptr;
264     CanvasRenderContextBase* webgl2RenderContext_ = nullptr;
265 
266     static int32_t gradientCount_;
267     static int32_t patternCount_;
268     static int32_t path2dCount_;
269     static std::unordered_map<int32_t, Gradient> gradientColors_;
270     static std::unordered_map<int32_t, Pattern> pattern_;
271     static std::unordered_map<int32_t, RefPtr<CanvasPath2D>> path2Ds_;
272 };
273 
274 } // namespace OHOS::Ace::Framework
275 
276 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_JSI_CANVAS_BRIDGE_H
277