1 /* 2 * Copyright (c) 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 FRAMEWORKS_BRIDGE_CJ_FRONTEND_CPP_VIEW_CAVANS_PATH_H 17 #define FRAMEWORKS_BRIDGE_CJ_FRONTEND_CPP_VIEW_CAVANS_PATH_H 18 19 #include "ffi_remote_data.h" 20 21 #include "base/memory/referenced.h" 22 #include "core/components/common/properties/decoration.h" 23 24 namespace OHOS::Ace::Framework { 25 26 class ACE_EXPORT NativeCanvasPath : public OHOS::FFI::FFIData { 27 public: 28 NativeCanvasPath(); 29 explicit NativeCanvasPath(const std::string& capStr); 30 ~NativeCanvasPath() override; 31 32 void AddPath(const sptr<NativeCanvasPath>& path); 33 void SetTransform(double scaleX, double skewX, double skewY, double scaleY, double translateX, double translateY); 34 void MoveTo(double x, double y); 35 void LineTo(double x, double y); 36 void Arc(double x, double y, double radius, double startAngle, double endAngle, bool anticlockwise); 37 void ArcTo(double x1, double y1, double x2, double y2, double radius); 38 void QuadraticCurveTo(double cpx, double cpy, double x, double y); 39 void BezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); 40 void Ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, 41 double endAngle, bool anticlockwise); 42 void Rect(double x, double y, double width, double height); 43 void ClosePath(); GetCanvasPath2d()44 RefPtr<CanvasPath2D> GetCanvasPath2d() const 45 { 46 return path2d_; 47 } 48 49 protected: 50 RefPtr<CanvasPath2D> path2d_; 51 }; 52 53 } // namespace OHOS::Ace::Framework 54 #endif // FRAMEWORKS_BRIDGE_CJ_FRONTEND_CPP_VIEW_CAVANS_PATH_H 55