1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::canvas::OH_Drawing_CanvasClipOp;
use crate::drawing::types::{
OH_Drawing_Bitmap, OH_Drawing_BlendMode, OH_Drawing_Brush, OH_Drawing_Canvas, OH_Drawing_Image,
OH_Drawing_Image_Info, OH_Drawing_Matrix, OH_Drawing_Path, OH_Drawing_PixelMap,
OH_Drawing_Point2D, OH_Drawing_Point3D, OH_Drawing_Rect, OH_Drawing_Region,
OH_Drawing_RoundRect, OH_Drawing_SamplingOptions,
};
impl OH_Drawing_SrcRectConstraint {
/// Using sampling only inside bounds in a slower manner.
pub const STRICT_SRC_RECT_CONSTRAINT: OH_Drawing_SrcRectConstraint =
OH_Drawing_SrcRectConstraint(0);
}
impl OH_Drawing_SrcRectConstraint {
/// Using sampling outside bounds in a faster manner.
pub const FAST_SRC_RECT_CONSTRAINT: OH_Drawing_SrcRectConstraint =
OH_Drawing_SrcRectConstraint(1);
}
#[repr(transparent)]
/** @brief Enumeration defines the constraint type.
@since 12
@version 1.0*/
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_Drawing_SrcRectConstraint(pub ::core::ffi::c_uint);
impl OH_Drawing_PointMode {
/// Draw each point separately.
pub const POINT_MODE_POINTS: OH_Drawing_PointMode = OH_Drawing_PointMode(0);
}
impl OH_Drawing_PointMode {
/// Draw each pair of points as a line segment.
pub const POINT_MODE_LINES: OH_Drawing_PointMode = OH_Drawing_PointMode(1);
}
impl OH_Drawing_PointMode {
/// Draw the array of points as a open polygon.
pub const POINT_MODE_POLYGON: OH_Drawing_PointMode = OH_Drawing_PointMode(2);
}
#[repr(transparent)]
/** @brief Enumerates of scale to fit flags, selects if an array of points are drawn as discrete points, as lines,
or as an open polygon.
@since 12
@version 1.0*/
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_Drawing_PointMode(pub ::core::ffi::c_uint);
impl OH_Drawing_CanvasShadowFlags {
/// Use no shadow flags.
pub const SHADOW_FLAGS_NONE: OH_Drawing_CanvasShadowFlags = OH_Drawing_CanvasShadowFlags(0);
}
impl OH_Drawing_CanvasShadowFlags {
/// The occluding object is transparent.
pub const SHADOW_FLAGS_TRANSPARENT_OCCLUDER: OH_Drawing_CanvasShadowFlags =
OH_Drawing_CanvasShadowFlags(1);
}
impl OH_Drawing_CanvasShadowFlags {
/// No need to analyze shadows.
pub const SHADOW_FLAGS_GEOMETRIC_ONLY: OH_Drawing_CanvasShadowFlags =
OH_Drawing_CanvasShadowFlags(2);
}
impl OH_Drawing_CanvasShadowFlags {
/// Use all shadow flags.
pub const SHADOW_FLAGS_ALL: OH_Drawing_CanvasShadowFlags = OH_Drawing_CanvasShadowFlags(3);
}
#[repr(transparent)]
/** @brief Enumerates of shadow flags.
@since 12
@version 1.0*/
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_Drawing_CanvasShadowFlags(pub ::core::ffi::c_uint);
impl OH_Drawing_VertexMode {
/// The vertices are a triangle list.
pub const VERTEX_MODE_TRIANGLES: OH_Drawing_VertexMode = OH_Drawing_VertexMode(0);
}
impl OH_Drawing_VertexMode {
/// The vertices are a triangle strip.
pub const VERTEX_MODE_TRIANGLES_STRIP: OH_Drawing_VertexMode = OH_Drawing_VertexMode(1);
}
impl OH_Drawing_VertexMode {
/// The vertices are a triangle fan.
pub const VERTEX_MODE_TRIANGLE_FAN: OH_Drawing_VertexMode = OH_Drawing_VertexMode(2);
}
#[repr(transparent)]
/** @brief Enumerates of vertices flags.
@since 12
@version 1.0*/
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_Drawing_VertexMode(pub ::core::ffi::c_uint);
extern "C" {
/** @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing.
Calling restore discards changes to matrix and clip, and draws the bitmap.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
@param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasSaveLayer(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_Rect,
arg3: *const OH_Drawing_Brush,
);
/** @brief Draw the specified area of the Media::PixelMap to the specified area of the canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_PixelMap Indicates the pointer to an <b>OH_Drawing_PixelMap</b> object.
@param src the area of source pixelmap.
@param dst the area of destination canvas.
@param OH_Drawing_SamplingOptions the sampling mode.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawPixelMapRect(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_PixelMap,
src: *const OH_Drawing_Rect,
dst: *const OH_Drawing_Rect,
arg3: *const OH_Drawing_SamplingOptions,
);
/** @brief Fills clipped canvas area with brush.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawBackground(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_Brush,
);
/** @brief Draws region using clip, matrix and paint.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Region Indicates the pointer to an <b>OH_Drawing_Region</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawRegion(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_Region,
);
/** @brief Draws point array as separate point, line segment or open polygon according to given point mode.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param mode Draw points enum.
@param count The point count.
@param OH_Drawing_Point2D Point struct array.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawPoints(
arg1: *mut OH_Drawing_Canvas,
mode: OH_Drawing_PointMode,
count: u32,
arg2: *const OH_Drawing_Point2D,
);
/** @brief Draw the specified area of the bitmap to the specified area of the canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object.
@param src the area of source bitmap, can be nullptr.
@param dst the area of destination canvas.
@param OH_Drawing_SamplingOptions the sampling mode.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawBitmapRect(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_Bitmap,
src: *const OH_Drawing_Rect,
dst: *const OH_Drawing_Rect,
arg3: *const OH_Drawing_SamplingOptions,
);
/** @brief Clip a round rect.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
@param clipOp Indicates the operation to apply to clip.
@param doAntiAlias Indicates whether clip operation requires anti-aliased.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasClipRoundRect(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_RoundRect,
clipOp: OH_Drawing_CanvasClipOp,
doAntiAlias: bool,
);
/** @brief Skew by sx on the x-axis and sy on the y-axis.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param sx Indicates the amount to skew on x-axis.
@param sy Indicates the amount to skew on y-axis.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasSkew(arg1: *mut OH_Drawing_Canvas, sx: f32, sy: f32);
/** @brief Get the width of a canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasGetWidth(arg1: *mut OH_Drawing_Canvas) -> i32;
/** @brief Get the height of a canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasGetHeight(arg1: *mut OH_Drawing_Canvas) -> i32;
/** @brief Get the bounds of clip of a canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasGetLocalClipBounds(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Rect,
);
/** @brief Get a 3x3 matrix of the transform from local coordinates to 'device'.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasGetTotalMatrix(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Matrix,
);
/** @brief Use the passed matrix to transforming the geometry, then use existing matrix.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object,
represents the matrix which is passed.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasConcatMatrix(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Matrix,
);
/** @brief Use circular light to draw an offset spot shadow and outlining ambient shadow for the given path.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object, use to generate shadows.
@param planeParams Represents the value of the function which returns Z offset of the occluder from the
canvas based on x and y.
@param devLightPos Represents the position of the light relative to the canvas.
@param lightRadius The radius of the circular light.
@param ambientColor Ambient shadow's color.
@param spotColor Spot shadow's color.
@param flag Indicates the flag to control opaque occluder, shadow, and light position.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawShadow(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Path,
planeParams: OH_Drawing_Point3D,
devLightPos: OH_Drawing_Point3D,
lightRadius: f32,
ambientColor: u32,
spotColor: u32,
flag: OH_Drawing_CanvasShadowFlags,
);
/** @brief Sets matrix of canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasSetMatrix(arg1: *mut OH_Drawing_Canvas, arg2: *mut OH_Drawing_Matrix);
/** @brief Reset matrix to the idenmtity matrix, any prior matrix state is overwritten.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasResetMatrix(arg1: *mut OH_Drawing_Canvas);
/** @brief Draws the specified source rectangle of the image onto the canvas,
scaled and translated to the destination rectangle.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Image Indicates the pointer to an <b>OH_Drawing_Image</b> object.
@param src The area of source image.
@param dst The area of destination canvas.
@param OH_Drawing_SamplingOptions Indicates the pointer to an <b>OH_Drawing_SamplingOptions</b> object.
@param OH_Drawing_SrcRectConstraint Constraint type.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawImageRectWithSrc(
arg1: *mut OH_Drawing_Canvas,
arg2: *const OH_Drawing_Image,
src: *const OH_Drawing_Rect,
dst: *const OH_Drawing_Rect,
arg3: *const OH_Drawing_SamplingOptions,
arg4: OH_Drawing_SrcRectConstraint,
);
/** @brief Draws the specified source rectangle of the image onto the canvas,
scaled and translated to the destination rectangle.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Image Indicates the pointer to an <b>OH_Drawing_Image</b> object.
@param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
@param OH_Drawing_SamplingOptions Indicates the pointer to an <b>OH_Drawing_SamplingOptions</b> object.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawImageRect(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Image,
dst: *mut OH_Drawing_Rect,
arg3: *mut OH_Drawing_SamplingOptions,
);
/** @brief Draw a triangular mesh with vertex descriptions.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param vertexMmode Draw a set of vertices.
@param vertexCount Vertex count.
@param positions Positions data pointer.
@param texs Texture coordinate data pointer.
@param colors Color data pointer.
@param indexCount Index count.
@param indices Index data pointer.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasDrawVertices(
arg1: *mut OH_Drawing_Canvas,
vertexMmode: OH_Drawing_VertexMode,
vertexCount: i32,
positions: *const OH_Drawing_Point2D,
texs: *const OH_Drawing_Point2D,
colors: *const u32,
indexCount: i32,
indices: *const u16,
mode: OH_Drawing_BlendMode,
);
/** @brief Read pixels data from canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Image_Info width, height, colorType, and alphaType of dstPixels.
@param dstPixels destination pixel storage.
@param dstRowBytes size of one row of pixels.
@param srcX offset into canvas writable pixels on x-axis.
@param srcY offset into canvas writable pixels on y-axis.
@return true if pixels are copied to dstPixels.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasReadPixels(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Image_Info,
dstPixels: *mut ::core::ffi::c_void,
dstRowBytes: u32,
srcX: i32,
srcY: i32,
) -> bool;
/** @brief Read pixels data to a bitmap from canvas.
@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
@param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
@param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object.
@param srcX offset into canvas writable pixels on x-axis.
@param srcY offset into canvas writable pixels on y-axis.
@return true if pixels are copied to dstBitmap.
@since 12
@version 1.0*/
pub fn OH_Drawing_CanvasReadPixelsToBitmap(
arg1: *mut OH_Drawing_Canvas,
arg2: *mut OH_Drawing_Bitmap,
srcX: i32,
srcY: i32,
) -> bool;
}