• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 C_INCLUDE_DRAWING_H
17 #define C_INCLUDE_DRAWING_H
18 
19 /**
20  * @addtogroup Drawing
21  * @{
22  *
23  * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
24  *
25  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
26  *
27  * @since 8
28  * @version 1.0
29  */
30 
31 /**
32  * @file drawing_canvas.h
33  *
34  * @brief Declares functions related to the <b>canvas</b> object in the drawing module.
35  *
36  * @since 8
37  * @version 1.0
38  */
39 
40 #include "drawing_types.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @brief Creates an <b>OH_Drawing_Canvas</b> object.
48  *
49  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
50  * @return Returns the pointer to the <b>OH_Drawing_Canvas</b> object created.
51  * @since 8
52  * @version 1.0
53  */
54 OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void);
55 
56 /**
57  * @brief Destroys an <b>OH_Drawing_Canvas</b> object and reclaims the memory occupied by the object.
58  *
59  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
60  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
61  * @since 8
62  * @version 1.0
63  */
64 void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*);
65 
66 /**
67  * @brief Binds a bitmap to a canvas so that the content drawn on the canvas
68  * is output to the bitmap (this process is called CPU rendering).
69  *
70  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
71  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
72  * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object.
73  * @since 8
74  * @version 1.0
75  */
76 void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*);
77 
78 /**
79  * @brief Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape.
80  *
81  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
82  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
83  * @param OH_Drawing_Pen Indicates the pointer to an <b>OH_Drawing_Pen</b> object.
84  * @since 8
85  * @version 1.0
86  */
87 void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*);
88 
89 /**
90  * @brief Detaches the pen from a canvas so that the canvas will not use the style
91  * and color of the pen to outline a shape.
92  *
93  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
94  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
95  * @since 8
96  * @version 1.0
97  */
98 void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*);
99 
100 /**
101  * @brief Attaches a brush to a canvas so that the canvas will use the style and color of the brush to fill in a shape.
102  *
103  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
104  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
105  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
106  * @since 8
107  * @version 1.0
108  */
109 void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*);
110 
111 /**
112  * @brief Detaches the brush from a canvas so that the canvas will not use the style
113  * and color of the brush to fill in a shape.
114  *
115  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
116  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
117  * @since 8
118  * @version 1.0
119  */
120 void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*);
121 
122 /**
123  * @brief Saves the current canvas status (canvas matrix) to the top of the stack.
124  *
125  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
126  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
127  * @since 8
128  * @version 1.0
129  */
130 void OH_Drawing_CanvasSave(OH_Drawing_Canvas*);
131 
132 /**
133  * @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing.
134  * Calling restore discards changes to matrix and clip, and draws the bitmap.
135  *
136  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
137  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
138  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
139  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
140  * @since 12
141  * @version 1.0
142  */
143 void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*);
144 
145 /**
146  * @brief Restores the canvas status (canvas matrix) saved on the top of the stack.
147  *
148  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
149  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
150  * @since 8
151  * @version 1.0
152  */
153 void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*);
154 
155 /**
156  * @brief Gets the number of the canvas status (canvas matrix) saved in the stack.
157  *
158  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
159  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
160  * @return Returns a 32-bit variable that describes the number of canvas status.
161  * @since 11
162  * @version 1.0
163  */
164 uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*);
165 
166 /**
167  * @brief Restores the specific number of the canvas status (canvas matrix) saved in the stack.
168  *
169  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
170  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
171  * @param saveCount Indicates the specific number of canvas status.
172  * @since 11
173  * @version 1.0
174  */
175 void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount);
176 
177 /**
178  * @brief Draws a line segment.
179  *
180  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
181  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
182  * @param x1 Indicates the x coordinate of the start point of the line segment.
183  * @param y1 Indicates the y coordinate of the start point of the line segment.
184  * @param x2 Indicates the x coordinate of the end point of the line segment.
185  * @param y2 Indicates the y coordinate of the end point of the line segment.
186  * @since 8
187  * @version 1.0
188  */
189 void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, float y2);
190 
191 /**
192  * @brief Draws a path.
193  *
194  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
195  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
196  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
197  * @since 8
198  * @version 1.0
199  */
200 void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*);
201 
202 /**
203  * @brief Draws a bitmap.
204  *
205  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
206  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
207  * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object.
208  * @param left Indicates the left position of the <b>OH_Drawing_Bitmap</b>.
209  * @param top Indicates the top position of the <b>OH_Drawing_Bitmap</b>.
210  * @since 11
211  * @version 1.0
212  */
213 void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top);
214 
215 /**
216  * @brief Draws a rect.
217  *
218  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
219  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
220  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
221  * @since 11
222  * @version 1.0
223  */
224 void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*);
225 
226 /**
227  * @brief Draws a circle.
228  *
229  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
230  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
231  * @param OH_Drawing_Point Indicates the pointer to an <b>OH_Drawing_Point</b> object.
232  * @param radius Indicates the radius of the circle.
233  * @since 11
234  * @version 1.0
235  */
236 void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius);
237 
238 /**
239  * @brief Draws an oval.
240  *
241  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
242  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
243  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
244  * @since 11
245  * @version 1.0
246  */
247 void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*);
248 
249 /**
250  * @brief Draws an arc.
251  *
252  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
253  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
254  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
255  * @param startAngle Indicates the startAngle of the arc.
256  * @param sweepAngle Indicates the sweepAngle of the arc.
257  * @since 11
258  * @version 1.0
259  */
260 void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
261 
262 /**
263  * @brief Draws a roundrect.
264  *
265  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
266  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
267  * @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
268  * @since 11
269  * @version 1.0
270  */
271 void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*);
272 
273 /**
274  * @brief Draws a textblob.
275  *
276  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
277  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
278  * @param OH_Drawing_TextBlob Indicates the pointer to an <b>OH_Drawing_TextBlob</b> object.
279  * @param x Indicates the horizontal offset applied to blob.
280  * @param y Indicates the vertical offset applied to blob.
281  * @since 11
282  * @version 1.0
283  */
284 void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y);
285 
286 /**
287  * @brief Enumerates clip op.
288  *
289  * @since 11
290  * @version 1.0
291  */
292 typedef enum {
293     /**
294      * Clip with difference.
295      */
296     DIFFERENCE,
297     /**
298      * Clip with intersection.
299      */
300     INTERSECT,
301 } OH_Drawing_CanvasClipOp;
302 
303 /**
304  * @brief Clip a rect.
305  *
306  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
307  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
308  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
309  * @param clipOp Indicates the operation to apply to clip.
310  * @param doAntiAlias Indicates whether clip operation requires anti-aliased.
311  * @since 11
312  * @version 1.0
313  */
314 void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*,
315     OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
316 
317 /**
318  * @brief Clip a path.
319  *
320  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
321  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
322  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
323  * @param clipOp Indicates the operation to apply to clip.
324  * @param doAntiAlias Indicates whether clip operation requires anti-aliased.
325  * @since 11
326  * @version 1.0
327  */
328 void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*,
329     OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
330 
331 /**
332  * @brief Rotates by degrees. Positive degrees rotates clockwise.
333  *
334  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
335  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
336  * @param degrees Indicates the amount to rotate, in degrees.
337  * @param px Indicates the x-axis value of the point to rotate about.
338  * @param py Indicates the y-axis value of the point to rotate about.
339  * @since 11
340  * @version 1.0
341  */
342 void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py);
343 
344 /**
345  * @brief Translates by dx along the x-axis and dy along the y-axis.
346  *
347  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
348  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
349  * @param dx Indicates the distance to translate on x-axis.
350  * @param dy Indicates the distance to translate on y-axis.
351  * @since 11
352  * @version 1.0
353  */
354 void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy);
355 
356 /**
357  * @brief Scales by sx on the x-axis and sy on the y-axis.
358  *
359  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
360  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
361  * @param sx Indicates the amount to scale on x-axis.
362  * @param sy Indicates the amount to scale on y-axis.
363  * @since 11
364  * @version 1.0
365  */
366 void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy);
367 
368 /**
369  * @brief Clears a canvas by using a specified color.
370  *
371  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
372  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
373  * @param color Indicates the color, which is a 32-bit (ARGB) variable.
374  * @since 8
375  * @version 1.0
376  */
377 void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color);
378 
379 /**
380  * @brief Get the width of a canvas.
381  *
382  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
383  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
384  * @since 12
385  * @version 1.0
386  */
387 int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*);
388 
389 /**
390  * @brief Get the height of a canvas.
391  *
392  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
393  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
394  * @since 12
395  * @version 1.0
396  */
397 int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*);
398 
399 /**
400  * @brief Get the bounds of clip of a canvas.
401  *
402  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
403  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
404  * @return The pointer to an <b>OH_Drawing_Rect</b> object, represents the boundar of clip,
405  * transformed by inverse of matrix.
406  * @since 12
407  * @version 1.0
408  */
409 OH_Drawing_Rect* OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*);
410 
411 /**
412  * @brief Get a 3x3 matrix of the transform from local coordinates to 'device'
413  *
414  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
415  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
416  * @return The pointer to an <b>OH_Drawing_Matrix</b> object.
417  * @since 12
418  * @version 1.0
419  */
420 OH_Drawing_Matrix* OH_Drawing_CanvasGetLocalToDevice(OH_Drawing_Canvas*);
421 
422 /**
423  * @brief Use the passed matrix to transforming the geometry, then use existing matrix.
424  *
425  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
426  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
427  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object,
428  * represents the matrix which is passed.
429  * @since 12
430  * @version 1.0
431  */
432 void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*);
433 
434 /**
435  * @brief Enumerates of shadow flags.
436  *
437  * @since 12
438  * @version 1.0
439  */
440 typedef enum {
441     /**
442      * Use no shadow flags.
443      */
444     SHADOW_FLAGS_NONE,
445     /**
446      * The occluding object is transparent.
447      */
448     SHADOW_FLAGS_TRANSPARENT_OCCLUDER,
449     /**
450      * No need to analyze shadows.
451      */
452     SHADOW_FLAGS_GEOMETRIC_ONLY,
453     /**
454      * Use all shadow falgs.
455      */
456     SHADOW_FLAGS_ALL,
457 } OH_Drawing_CanvasShadowFlags;
458 
459 /**
460  * @brief Use circular light to draw an offset spot shadow and outlining ambient shadow for the given path.
461  *
462  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
463  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
464  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object, use to generate shadows.
465  * @param OH_Drawing_Point3 Indicates the pointer to an <b>OH_Drawing_Point3</b> object.
466  * represents the value of the function which returns Z offset of the occluder from the canvas based on x and y.
467  * @param OH_Drawing_Point3 Indicates the pointer to an <b>OH_Drawing_Point3</b> object.
468  * represents the position of the light relative to the canvas.
469  * @param lightRadius The radius of the circular light.
470  * @param ambientColor Ambient shadow's color.
471  * @param spotColor Spot shadow's color.
472  * @param flag Indicates the flag to control opaque occluder, shadow, and light position.
473  * @since 12
474  * @version 1.0
475  */
476 void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3*,
477     OH_Drawing_Point3*, float lightRadius, uint32_t ambientColor, uint32_t spotColor,
478     OH_Drawing_CanvasShadowFlags flag);
479 
480 /**
481  * @brief Sets matrix of canvas.
482  *
483  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
484  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
485  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
486  * @since 12
487  * @version 1.0
488  */
489 void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*);
490 
491 /**
492  * @brief Draws the specified source rectangle of the image onto the canvas,
493  * scaled and translated to the destination rectangle.
494  *
495  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
496  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
497  * @param OH_Drawing_Image Indicates the pointer to an <b>OH_Drawing_Image</b> object.
498  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
499  * @param OH_Drawing_SamplingOptions Indicates the pointer to an <b>OH_Drawing_SamplingOptions</b> object.
500  * @since 12
501  * @version 1.0
502  */
503 void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*,
504     OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*);
505 
506 /**
507  * @brief Read pixels data from canvas.
508  *
509  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
510  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
511  * @param OH_Drawing_Image_Info width, height, colorType, and alphaType of dstPixels.
512  * @param dstPixels destination pixel storage.
513  * @param dstRowBytes size of one row of pixels.
514  * @param srcX offset into canvas writable pixels on x-axis.
515  * @param srcY offset into canvas writable pixels on y-axis.
516  * @return true if pixels are copied to dstPixels.
517  * @since 12
518  * @version 1.0
519  */
520 bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*,
521     void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY);
522 
523 /**
524  * @brief Read pixels data to a bitmap from canvas.
525  *
526  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
527  * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
528  * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object.
529  * @param srcX offset into canvas writable pixels on x-axis.
530  * @param srcY offset into canvas writable pixels on y-axis.
531  * @return true if pixels are copied to dstBitmap.
532  * @since 12
533  * @version 1.0
534  */
535 bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY);
536 
537 #ifdef __cplusplus
538 }
539 #endif
540 /** @} */
541 #endif
542