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 OHOS_ACE_FRAMEWORK_CJ_SHAPE_FFI_H
17 #define OHOS_ACE_FRAMEWORK_CJ_SHAPE_FFI_H
18 
19 #include <cstdint>
20 #include <vector>
21 
22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h"
23 
24 using VectorFloat64Ptr = void*;
25 using VectorInt32Ptr = void*;
26 
27 extern "C" {
28 struct FFIAtCViewPort {
29     int32_t unitX;
30     int32_t unitY;
31     int32_t unitWidth;
32     int32_t unitHeight;
33     double x;
34     double y;
35     double width;
36     double height;
37 };
38 
39 CJ_EXPORT void FfiOHOSAceFrameworkShapeCreate();
40 CJ_EXPORT void FfiOHOSAceFrameworkShapeCreateWithPixelMap(int64_t pixelMapId);
41 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetViewPort(FFIAtCViewPort viewPort);
42 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetFill(uint32_t color);
43 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetFillOpacity(double fillOpacity);
44 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStroke(uint32_t color);
45 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeDashArray(VectorFloat64Ptr vecValue, VectorInt32Ptr vecUnit);
46 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeDashOffset(double offset, int32_t offsetUnit);
47 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeLineCap(int32_t lineCap);
48 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeLineJoin(int32_t lineJoin);
49 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeMiterLimit(double miterLimit);
50 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeOpacity(double strokeOpacity);
51 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetStrokeWidth(double strokeWidth, int32_t widthUnit);
52 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetAntiAlias(bool antiAlias);
53 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetMesh(VectorFloat64Ptr vecValue, uint32_t column, uint32_t row);
54 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetWidth(double width, int32_t unit);
55 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetHeight(double height, int32_t unit);
56 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetSize(double width, int32_t widthUnit, double height, int32_t heightUnit);
57 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetInsWidth(int64_t shapeId, double value, int32_t unit);
58 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetInsHeight(int64_t shapeId, double value, int32_t unit);
59 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetInsSize(
60     int64_t shapeId, double width, int32_t widthUnit, double height, int32_t heightUnit);
61 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetInsOffset(int64_t shapeId, double x, int32_t xUnit, double y, int32_t yUnit);
62 CJ_EXPORT void FfiOHOSAceFrameworkShapeSetInsFill(int64_t shapeId, uint32_t color);
63 };
64 #endif
65