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_BRIDGE_JS_FRONTEND_ENGINE_JSI_JSI_OFFSCREEN_CANVAS_BRIDGE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_JSI_JSI_OFFSCREEN_CANVAS_BRIDGE_H 18 19 #include <map> 20 #include <string> 21 22 #include "core/components/custom_paint/offscreen_canvas.h" 23 #include "frameworks/bridge/common/dom/dom_canvas.h" 24 #include "frameworks/bridge/js_frontend/engine/common/base_canvas_bridge.h" 25 #include "frameworks/bridge/js_frontend/engine/jsi/jsi_engine.h" 26 27 namespace OHOS::Ace::Framework { 28 29 class JsiOffscreenCanvasBridge : public BaseCanvasBridge { 30 DECLARE_ACE_TYPE(JsiOffscreenCanvasBridge, BaseCanvasBridge) 31 32 public: 33 JsiOffscreenCanvasBridge() = default; 34 JsiOffscreenCanvasBridge(const RefPtr<PipelineBase>& pipeContext, int32_t width, int32_t height); 35 ~JsiOffscreenCanvasBridge() override = default; 36 37 shared_ptr<JsValue> GetBridge(const shared_ptr<JsRuntime>& runtime); 38 GetBridgeId()39 int32_t GetBridgeId() const 40 { 41 return bridgeId_; 42 } 43 GetOffscreenCanvas()44 const RefPtr<OffscreenCanvas>& GetOffscreenCanvas() const 45 { 46 return offscreenCanvas_; 47 } 48 49 // method of OffscreenCanvas 50 static shared_ptr<JsValue> JsGetContext(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 51 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 52 static shared_ptr<JsValue> JsTransferToImageBitmap(const shared_ptr<JsRuntime>& runtime, 53 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 54 static shared_ptr<JsValue> JsToDataURL(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 55 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 56 57 // method of OffscreenCanvasContext 58 static shared_ptr<JsValue> JsCreateLinearGradient(const shared_ptr<JsRuntime>& runtime, 59 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 60 static shared_ptr<JsValue> JsCreateRadialGradient(const shared_ptr<JsRuntime>& runtime, 61 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 62 static shared_ptr<JsValue> JsCreatePattern(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 63 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 64 static shared_ptr<JsValue> JsAddColorStop(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 65 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 66 static shared_ptr<JsValue> JsFillRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 67 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 68 static shared_ptr<JsValue> JsClearRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 69 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 70 static shared_ptr<JsValue> JsStrokeRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 71 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 72 static shared_ptr<JsValue> JsFillText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 73 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 74 static shared_ptr<JsValue> JsStrokeText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 75 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 76 static shared_ptr<JsValue> JsMeasureText(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 77 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 78 static shared_ptr<JsValue> JsRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 79 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 80 static shared_ptr<JsValue> JsFill(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 81 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 82 static shared_ptr<JsValue> JsClip(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 83 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 84 static shared_ptr<JsValue> JsCreateImageData(const shared_ptr<JsRuntime>& runtime, 85 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 86 static shared_ptr<JsValue> JsPutImageData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 87 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 88 static shared_ptr<JsValue> JsGetImageData(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 89 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 90 static shared_ptr<JsValue> JsDrawImage(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 91 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 92 static shared_ptr<JsValue> JsSave(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 93 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 94 static shared_ptr<JsValue> JsRestore(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> JsCreatePath2D(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> JsIsPointInStroke(const shared_ptr<JsRuntime>& runtime, 99 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 100 static shared_ptr<JsValue> JsIsPointInPath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 101 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 102 static shared_ptr<JsValue> JsResetTransform(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 103 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 104 105 // priority of OffscreenCanvasContext 106 static shared_ptr<JsValue> JsFillStyleGetter(const shared_ptr<JsRuntime>& runtime, 107 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 108 static shared_ptr<JsValue> JsFillStyleSetter(const shared_ptr<JsRuntime>& runtime, 109 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 110 static shared_ptr<JsValue> JsStrokeStyleGetter(const shared_ptr<JsRuntime>& runtime, 111 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 112 static shared_ptr<JsValue> JsStrokeStyleSetter(const shared_ptr<JsRuntime>& runtime, 113 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 114 static shared_ptr<JsValue> JsLineCapGetter(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> JsLineCapSetter(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> JsLineJoinGetter(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> JsLineJoinSetter(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> JsMiterLimitGetter(const shared_ptr<JsRuntime>& runtime, 123 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 124 static shared_ptr<JsValue> JsMiterLimitSetter(const shared_ptr<JsRuntime>& runtime, 125 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 126 static shared_ptr<JsValue> JsLineWidthGetter(const shared_ptr<JsRuntime>& runtime, 127 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 128 static shared_ptr<JsValue> JsLineWidthSetter(const shared_ptr<JsRuntime>& runtime, 129 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 130 static shared_ptr<JsValue> JsTextAlignGetter(const shared_ptr<JsRuntime>& runtime, 131 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 132 static shared_ptr<JsValue> JsTextAlignSetter(const shared_ptr<JsRuntime>& runtime, 133 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 134 static shared_ptr<JsValue> JsTextBaselineGetter(const shared_ptr<JsRuntime>& runtime, 135 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 136 static shared_ptr<JsValue> JsTextBaselineSetter(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> JsFontGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 139 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 140 static shared_ptr<JsValue> JsFontSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 141 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 142 static shared_ptr<JsValue> JsAlphaGetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 143 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 144 static shared_ptr<JsValue> JsAlphaSetter(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 145 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 146 static shared_ptr<JsValue> JsCompositeOperationGetter(const shared_ptr<JsRuntime>& runtime, 147 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 148 static shared_ptr<JsValue> JsCompositeOperationSetter(const shared_ptr<JsRuntime>& runtime, 149 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 150 static shared_ptr<JsValue> JsLineDashOffsetGetter(const shared_ptr<JsRuntime>& runtime, 151 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 152 static shared_ptr<JsValue> JsLineDashOffsetSetter(const shared_ptr<JsRuntime>& runtime, 153 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 154 static shared_ptr<JsValue> JsShadowBlurGetter(const shared_ptr<JsRuntime>& runtime, 155 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 156 static shared_ptr<JsValue> JsShadowBlurSetter(const shared_ptr<JsRuntime>& runtime, 157 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 158 static shared_ptr<JsValue> JsShadowColorGetter(const shared_ptr<JsRuntime>& runtime, 159 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 160 static shared_ptr<JsValue> JsShadowColorSetter(const shared_ptr<JsRuntime>& runtime, 161 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 162 static shared_ptr<JsValue> JsShadowOffsetXGetter(const shared_ptr<JsRuntime>& runtime, 163 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 164 static shared_ptr<JsValue> JsShadowOffsetXSetter(const shared_ptr<JsRuntime>& runtime, 165 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 166 static shared_ptr<JsValue> JsShadowOffsetYGetter(const shared_ptr<JsRuntime>& runtime, 167 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 168 static shared_ptr<JsValue> JsShadowOffsetYSetter(const shared_ptr<JsRuntime>& runtime, 169 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 170 static shared_ptr<JsValue> JsSmoothingEnabledGetter(const shared_ptr<JsRuntime>& runtime, 171 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 172 static shared_ptr<JsValue> JsSmoothingEnabledSetter(const shared_ptr<JsRuntime>& runtime, 173 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 174 static shared_ptr<JsValue> JsSmoothingQualityGetter(const shared_ptr<JsRuntime>& runtime, 175 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 176 static shared_ptr<JsValue> JsSmoothingQualitySetter(const shared_ptr<JsRuntime>& runtime, 177 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 178 static shared_ptr<JsValue> JsFilterParamGetter(const shared_ptr<JsRuntime>& runtime, 179 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 180 static shared_ptr<JsValue> JsFilterParamSetter(const shared_ptr<JsRuntime>& runtime, 181 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 182 static shared_ptr<JsValue> JsBeginPath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 183 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 184 static shared_ptr<JsValue> JsArc(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 185 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 186 static shared_ptr<JsValue> JsStroke(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 187 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 188 static shared_ptr<JsValue> JsArcTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 189 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 190 static shared_ptr<JsValue> JsMoveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 191 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 192 static shared_ptr<JsValue> JsClosePath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 193 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 194 static shared_ptr<JsValue> JsRotate(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 195 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 196 static shared_ptr<JsValue> JsScale(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 197 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 198 static shared_ptr<JsValue> JsLineTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 199 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 200 static shared_ptr<JsValue> JsBezierCurveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 201 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 202 static shared_ptr<JsValue> JsQuadraticCurveTo(const shared_ptr<JsRuntime>& runtime, 203 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 204 static shared_ptr<JsValue> JsEllipse(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 205 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 206 static shared_ptr<JsValue> JsSetTransform(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 207 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 208 static shared_ptr<JsValue> JsTransform(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 209 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 210 static shared_ptr<JsValue> JsTranslate(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 211 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 212 static shared_ptr<JsValue> JsGetLineDash(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 213 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 214 static shared_ptr<JsValue> JsSetLineDash(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 215 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 216 217 static shared_ptr<JsValue> JsPath2DAddPath(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 218 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 219 static shared_ptr<JsValue> JsPath2DSetTransform(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> JsPath2DMoveTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 222 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 223 static shared_ptr<JsValue> JsPath2DLineTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 224 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 225 static shared_ptr<JsValue> JsPath2DArc(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 226 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 227 static shared_ptr<JsValue> JsPath2DArcTo(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 228 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 229 static shared_ptr<JsValue> JsPath2DQuadraticCurveTo(const shared_ptr<JsRuntime>& runtime, 230 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 231 static shared_ptr<JsValue> JsPath2DBezierCurveTo(const shared_ptr<JsRuntime>& runtime, 232 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 233 static shared_ptr<JsValue> JsPath2DEllipse(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 234 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 235 static shared_ptr<JsValue> JsPath2DRect(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 236 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 237 static shared_ptr<JsValue> JsPath2DClosePath(const shared_ptr<JsRuntime>& runtime, 238 const shared_ptr<JsValue>& value, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 239 240 private: 241 static Gradient GetGradient(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value); 242 static Pattern GetPattern(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value); 243 static RefPtr<CanvasPath2D> GetPath2D(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value); 244 static void ParseDomImage(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, double& width, 245 double& height, std::string& src); 246 static void ParseImageData(const shared_ptr<JsRuntime>& runtime, const std::vector<shared_ptr<JsValue>>& argv, 247 int32_t argc, std::vector<std::string>& array, ImageData& imageData); 248 static RefPtr<CanvasPath2D> JsMakePath2D(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& value, 249 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc); 250 251 static int32_t path2dCount_; 252 static int32_t gradientCount_; 253 static int32_t patternCount_; 254 static int32_t globalBridgeId_; 255 static std::unordered_map<int32_t, Gradient> gradientColors_; 256 static std::unordered_map<int32_t, Pattern> pattern_; 257 static std::unordered_map<int32_t, RefPtr<CanvasPath2D>> path2Ds_; 258 259 int32_t width_ = 0; 260 int32_t height_ = 0; 261 int32_t bridgeId_ = 0; 262 RefPtr<OffscreenCanvas> offscreenCanvas_ = nullptr; 263 }; 264 265 } // namespace OHOS::Ace::Framework 266 267 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_JSI_JSI_OFFSCREEN_CANVAS_BRIDGE_H