1 /* 2 * Copyright (c) 2021-2025 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_error_code.h" 41 #include "drawing_sampling_options.h" 42 #include "drawing_types.h" 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief Enumeration defines the constraint type. 50 * 51 * @since 12 52 * @version 1.0 53 */ 54 typedef enum { 55 /** 56 * Using sampling only inside bounds in a slower manner. 57 */ 58 STRICT_SRC_RECT_CONSTRAINT, 59 /** 60 * Using sampling outside bounds in a faster manner. 61 */ 62 FAST_SRC_RECT_CONSTRAINT, 63 } OH_Drawing_SrcRectConstraint; 64 65 /** 66 * @brief Creates an <b>OH_Drawing_Canvas</b> object. 67 * 68 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 69 * @return Returns the pointer to the <b>OH_Drawing_Canvas</b> object created. 70 * @since 8 71 * @version 1.0 72 */ 73 OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); 74 75 /** 76 * @brief Creates an <b>OH_Drawing_Canvas</b> object from <b>OH_Drawing_PixelMap</b>. 77 * The OH_Drawing_PixelMap should be dissolved by OH_Drawing_PixelMapDissolve after the OH_Drawing_Canvas is destroyed. 78 * 79 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 80 * @param pixelMap Indicates the pointer to an <b>OH_Drawing_PixelMap</b> object. 81 * @return Returns the pointer to the <b>OH_Drawing_Canvas</b> object created. 82 * If nullptr is returned, the creation fails. 83 * The possible cause of the failure is that the available memory is empty or pixelMap is nullptr. 84 * @since 20 85 * @version 1.0 86 */ 87 OH_Drawing_Canvas* OH_Drawing_CanvasCreateWithPixelMap(OH_Drawing_PixelMap* pixelMap); 88 89 /** 90 * @brief Destroys an <b>OH_Drawing_Canvas</b> object and reclaims the memory occupied by the object. 91 * 92 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 93 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 94 * @since 8 95 * @version 1.0 96 */ 97 void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); 98 99 /** 100 * @brief Binds a bitmap to a canvas so that the content drawn on the canvas 101 * is output to the bitmap (this process is called CPU rendering). 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_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object. 106 * @since 8 107 * @version 1.0 108 */ 109 void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); 110 111 /** 112 * @brief Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape. 113 * 114 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 115 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 116 * @param OH_Drawing_Pen Indicates the pointer to an <b>OH_Drawing_Pen</b> object. 117 * @since 8 118 * @version 1.0 119 */ 120 void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); 121 122 /** 123 * @brief Detaches the pen from a canvas so that the canvas will not use the style 124 * and color of the pen to outline a shape. 125 * 126 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 127 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 128 * @since 8 129 * @version 1.0 130 */ 131 void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); 132 133 /** 134 * @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. 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_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object. 139 * @since 8 140 * @version 1.0 141 */ 142 void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); 143 144 /** 145 * @brief Detaches the brush from a canvas so that the canvas will not use the style 146 * and color of the brush to fill in a shape. 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_CanvasDetachBrush(OH_Drawing_Canvas*); 154 155 /** 156 * @brief Saves the current canvas status (canvas matrix) to the top of 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 * @since 8 161 * @version 1.0 162 */ 163 void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); 164 165 /** 166 * @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing. 167 * Calling restore discards changes to matrix and clip, and draws the bitmap. 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 OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 172 * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object. 173 * @since 12 174 * @version 1.0 175 */ 176 void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*); 177 178 /** 179 * @brief Restores the canvas status (canvas matrix) saved on the top of the stack. 180 * 181 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 182 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 183 * @since 8 184 * @version 1.0 185 */ 186 void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); 187 188 /** 189 * @brief Gets the number of the canvas status (canvas matrix) saved in the stack. 190 * 191 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 192 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 193 * @return Returns a 32-bit variable that describes the number of canvas status. 194 * @since 11 195 * @version 1.0 196 */ 197 uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); 198 199 /** 200 * @brief Restores the specific number of the canvas status (canvas matrix) saved in the stack. 201 * 202 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 203 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 204 * @param saveCount Indicates the specific number of canvas status. 205 * @since 11 206 * @version 1.0 207 */ 208 void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); 209 210 /** 211 * @brief Draws a line segment. 212 * 213 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 214 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 215 * @param x1 Indicates the x coordinate of the start point of the line segment. 216 * @param y1 Indicates the y coordinate of the start point of the line segment. 217 * @param x2 Indicates the x coordinate of the end point of the line segment. 218 * @param y2 Indicates the y coordinate of the end point of the line segment. 219 * @since 8 220 * @version 1.0 221 */ 222 void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, float y2); 223 224 /** 225 * @brief Draws a path. 226 * 227 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 228 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 229 * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object. 230 * @since 8 231 * @version 1.0 232 */ 233 void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); 234 235 /** 236 * @brief Divides the pixelmap into a grid with nine sections: four sides, four corners, and the center. 237 * Draws the specified section of the pixelmap onto the canvas, corners are unmodified or scaled down if they exceed 238 * the destination rectangle, center and four sides are scaled to fit remaining space. 239 * 240 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 241 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 242 * @param pixelMap Indicates the pointer to an <b>OH_Drawing_PixelMap</b> object. 243 * @param center Divides the pixelmap into nine sections: four sides, four corners, and the center. 244 * @param dst The area of destination canvas. 245 * @param mode Filter mode. 246 * @return Returns the error code. 247 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 248 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, pixelMap 249 * and dst is nullptr. 250 * @since 16 251 * @version 1.0 252 */ 253 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapNine(OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, 254 const OH_Drawing_Rect* center, const OH_Drawing_Rect* dst, OH_Drawing_FilterMode mode); 255 256 /** 257 * @brief Draw the specified area of the Media::PixelMap to the specified area of the canvas. 258 * 259 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 260 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 261 * @param OH_Drawing_PixelMap Indicates the pointer to an <b>OH_Drawing_PixelMap</b> object. 262 * @param src the area of source pixelmap. 263 * @param dst the area of destination canvas. 264 * @param OH_Drawing_SamplingOptions the sampling mode. 265 * @since 12 266 * @version 1.0 267 */ 268 void OH_Drawing_CanvasDrawPixelMapRect(OH_Drawing_Canvas*, OH_Drawing_PixelMap*, const OH_Drawing_Rect* src, 269 const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*); 270 271 /** 272 * @brief Draw the specified area of the Media::PixelMap to the specified area of the canvas. 273 * 274 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 275 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 276 * @param pixelMap Indicates the pointer to an <b>OH_Drawing_PixelMap</b> object. 277 * @param src Indicates the area of source pixelmap. 278 * @param dst Indicates the area of destination canvas. 279 * @param samplingOptions Indicates the sampling mode. 280 * @param constraint Indicates constraint type. 281 * @return Returns the error code. 282 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 283 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, pixelMap 284 * and dst is nullptr. 285 * @since 20 286 * @version 1.0 287 */ 288 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapRectConstraint(OH_Drawing_Canvas* canvas, 289 OH_Drawing_PixelMap* pixelMap, const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, 290 const OH_Drawing_SamplingOptions* samplingOptions, OH_Drawing_SrcRectConstraint constraint); 291 292 /** 293 * @brief Fills clipped canvas area with brush. 294 * 295 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 296 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 297 * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object. 298 * @since 12 299 * @version 1.0 300 */ 301 void OH_Drawing_CanvasDrawBackground(OH_Drawing_Canvas*, const OH_Drawing_Brush*); 302 303 /** 304 * @brief Draws region using clip, matrix and paint. 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_Region Indicates the pointer to an <b>OH_Drawing_Region</b> object. 309 * @since 12 310 * @version 1.0 311 */ 312 void OH_Drawing_CanvasDrawRegion(OH_Drawing_Canvas*, const OH_Drawing_Region*); 313 314 /** 315 * @brief Enumerates of scale to fit flags, selects if an array of points are drawn as discrete points, as lines, 316 * or as an open polygon. 317 * 318 * @since 12 319 * @version 1.0 320 */ 321 typedef enum { 322 /** 323 * Draw each point separately. 324 */ 325 POINT_MODE_POINTS, 326 /** 327 * Draw each pair of points as a line segment. 328 */ 329 POINT_MODE_LINES, 330 /** 331 * Draw the array of points as a open polygon. 332 */ 333 POINT_MODE_POLYGON, 334 } OH_Drawing_PointMode; 335 336 /** 337 * @brief Draws a point. 338 * 339 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 340 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 341 * @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 342 * @return Returns the error code. 343 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 344 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or point is nullptr. 345 * @since 12 346 * @version 1.0 347 */ 348 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint(OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point); 349 350 /** 351 * @brief Draws point array as separate point, line segment or open polygon according to given point mode. 352 * 353 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 354 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 355 * @param mode Draw points enum. 356 * @param count The point count. 357 * @param OH_Drawing_Point2D Point struct array. 358 * @since 12 359 * @version 1.0 360 */ 361 void OH_Drawing_CanvasDrawPoints(OH_Drawing_Canvas*, OH_Drawing_PointMode mode, 362 uint32_t count, const OH_Drawing_Point2D*); 363 364 /** 365 * @brief Draws a bitmap. 366 * 367 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 368 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 369 * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object. 370 * @param left Indicates the left position of the <b>OH_Drawing_Bitmap</b>. 371 * @param top Indicates the top position of the <b>OH_Drawing_Bitmap</b>. 372 * @since 11 373 * @version 1.0 374 */ 375 void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); 376 377 /** 378 * @brief Draw the specified area of the bitmap to the specified area of the canvas. 379 * 380 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 381 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 382 * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object. 383 * @param src the area of source bitmap, can be nullptr. 384 * @param dst the area of destination canvas. 385 * @param OH_Drawing_SamplingOptions the sampling mode. 386 * @since 12 387 * @version 1.0 388 */ 389 void OH_Drawing_CanvasDrawBitmapRect(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, const OH_Drawing_Rect* src, 390 const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*); 391 392 /** 393 * @brief Draws a rect. 394 * 395 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 396 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 397 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 398 * @since 11 399 * @version 1.0 400 */ 401 void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); 402 403 /** 404 * @brief Draws a circle. 405 * 406 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 407 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 408 * @param OH_Drawing_Point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 409 * @param radius Indicates the radius of the circle. 410 * @since 11 411 * @version 1.0 412 */ 413 void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); 414 415 /** 416 * @brief Fills the entire canvas with the specified color and blend mode. 417 * 418 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 419 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 420 * @param color Indicates the color, which is a 32-bit variable. 421 * @param blendMode Indicates the blend mode. 422 * @return Returns the error code. 423 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 424 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas is nullptr. 425 * @since 12 426 * @version 1.0 427 */ 428 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor(OH_Drawing_Canvas* canvas, uint32_t color, 429 OH_Drawing_BlendMode blendMode); 430 431 /** 432 * @brief Draws an oval. 433 * 434 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 435 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 436 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 437 * @since 11 438 * @version 1.0 439 */ 440 void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); 441 442 /** 443 * @brief Draws an arc. 444 * 445 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 446 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 447 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 448 * @param startAngle Indicates the startAngle of the arc. 449 * @param sweepAngle Indicates the sweepAngle of the arc. 450 * @since 11 451 * @version 1.0 452 */ 453 void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); 454 455 /** 456 * @brief Draws an arc with use center. 457 * 458 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 459 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 460 * @param rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 461 * @param startAngle Indicates the startAngle of the arc. 462 * @param sweepAngle Indicates the sweepAngle of the arc. 463 * @param useCenter If true, include the center of the oval in the arc, and close it if it is being stroked. 464 * @return Returns the error code. 465 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 466 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or rect is nullptr. 467 * @since 16 468 * @version 1.0 469 */ 470 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawArcWithCenter(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, 471 float startAngle, float sweepAngle, bool useCenter); 472 473 474 /** 475 * @brief Draws a roundrect. 476 * 477 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 478 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 479 * @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object. 480 * @since 11 481 * @version 1.0 482 */ 483 void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); 484 485 /** 486 * @brief Draw two nested rounded rectangles. 487 * 488 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 489 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 490 * @param outer Rounded rectangle object, representing the outer rounded rectangle boundary. 491 * @param inner Rounded rectangle object, representing the internal rounded rectangle boundary. 492 * @return Returns the error code. 493 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 494 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, outer 495 * and inner is nullptr. 496 * @since 16 497 * @version 1.0 498 */ 499 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawNestedRoundRect(OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* outer, 500 const OH_Drawing_RoundRect* inner); 501 502 /** 503 * @brief Draws a single character. 504 * 505 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 506 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 507 * @param str Indicates the single character encoded in UTF-8. 508 * @param OH_Drawing_Font Indicates the pointer to an <b>OH_Drawing_Font</b> object. 509 * @param x Indicates the horizontal offset applied to the single character. 510 * @param y Indicates the vertical offset applied to the single character. 511 * @return Returns the error code. 512 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 513 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, str 514 * and font is nullptr or strlen(str) is 0. 515 * @since 12 516 * @version 1.0 517 */ 518 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter(OH_Drawing_Canvas* canvas, const char* str, 519 const OH_Drawing_Font* font, float x, float y); 520 521 /** 522 * @brief Draws a single character with font features. 523 * 524 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 525 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 526 * @param str Indicates the single character encoded in UTF-8. 527 * @param font Indicates the pointer to an <b>OH_Drawing_Font</b> object. 528 * @param x Indicates the horizontal offset applied to the single character. 529 * @param y Indicates the vertical offset applied to the single character. 530 * @param fontFeatures Indicates the pointer to an <b>OH_Drawing_FontFeatures</b> object. 531 * @return Returns the error code. 532 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 533 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, str, font 534 * or fontFeatures is nullptr, or if strlen(str) is 0. 535 * @since 20 536 * @version 1.0 537 */ 538 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacterWithFeatures(OH_Drawing_Canvas* canvas, const char* str, 539 const OH_Drawing_Font* font, float x, float y, OH_Drawing_FontFeatures* fontFeatures); 540 541 /** 542 * @brief Draws a textblob. 543 * 544 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 545 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 546 * @param OH_Drawing_TextBlob Indicates the pointer to an <b>OH_Drawing_TextBlob</b> object. 547 * @param x Indicates the horizontal offset applied to blob. 548 * @param y Indicates the vertical offset applied to blob. 549 * @since 11 550 * @version 1.0 551 */ 552 void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y); 553 554 /** 555 * @brief Enumerates clip op. 556 * 557 * @since 11 558 * @version 1.0 559 */ 560 typedef enum { 561 /** 562 * Clip with difference. 563 */ 564 DIFFERENCE, 565 /** 566 * Clip with intersection. 567 */ 568 INTERSECT, 569 } OH_Drawing_CanvasClipOp; 570 571 /** 572 * @brief Clip a rect. 573 * 574 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 575 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 576 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 577 * @param clipOp Indicates the operation to apply to clip. 578 * @param doAntiAlias Indicates whether clip operation requires anti-aliased. 579 * @since 11 580 * @version 1.0 581 */ 582 void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, 583 OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); 584 585 /** 586 * @brief Clip a round rect. 587 * 588 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 589 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 590 * @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object. 591 * @param clipOp Indicates the operation to apply to clip. 592 * @param doAntiAlias Indicates whether clip operation requires anti-aliased. 593 * @since 12 594 * @version 1.0 595 */ 596 void OH_Drawing_CanvasClipRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*, 597 OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); 598 599 /** 600 * @brief Clip a path. 601 * 602 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 603 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 604 * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object. 605 * @param clipOp Indicates the operation to apply to clip. 606 * @param doAntiAlias Indicates whether clip operation requires anti-aliased. 607 * @since 11 608 * @version 1.0 609 */ 610 void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, 611 OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); 612 613 /** 614 * @brief Clips a region. 615 * 616 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 617 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 618 * @param region Indicates the pointer to an <b>OH_Drawing_Region</b> object. 619 * @param clipOp To apply to clip. 620 * @return Returns the error code. 621 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 622 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or region is nullptr. 623 * @since 12 624 * @version 1.0 625 */ 626 OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion(OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, 627 OH_Drawing_CanvasClipOp clipOp); 628 629 /** 630 * @brief Rotates by degrees. Positive degrees rotates clockwise. 631 * 632 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 633 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 634 * @param degrees Indicates the amount to rotate, in degrees. 635 * @param px Indicates the x-axis value of the point to rotate about. 636 * @param py Indicates the y-axis value of the point to rotate about. 637 * @since 11 638 * @version 1.0 639 */ 640 void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); 641 642 /** 643 * @brief Translates by dx along the x-axis and dy along the y-axis. 644 * 645 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 646 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 647 * @param dx Indicates the distance to translate on x-axis. 648 * @param dy Indicates the distance to translate on y-axis. 649 * @since 11 650 * @version 1.0 651 */ 652 void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); 653 654 /** 655 * @brief Scales by sx on the x-axis and sy on the y-axis. 656 * 657 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 658 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 659 * @param sx Indicates the amount to scale on x-axis. 660 * @param sy Indicates the amount to scale on y-axis. 661 * @since 11 662 * @version 1.0 663 */ 664 void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); 665 666 /** 667 * @brief Skew by sx on the x-axis and sy on the y-axis. 668 * 669 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 670 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 671 * @param sx Indicates the amount to skew on x-axis. 672 * @param sy Indicates the amount to skew on y-axis. 673 * @since 12 674 * @version 1.0 675 */ 676 void OH_Drawing_CanvasSkew(OH_Drawing_Canvas*, float sx, float sy); 677 678 /** 679 * @brief Get the width of a canvas. 680 * 681 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 682 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 683 * @since 12 684 * @version 1.0 685 */ 686 int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*); 687 688 /** 689 * @brief Get the height of a canvas. 690 * 691 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 692 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 693 * @since 12 694 * @version 1.0 695 */ 696 int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*); 697 698 /** 699 * @brief Get the bounds of clip of a canvas. 700 * 701 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 702 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 703 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 704 * @since 12 705 * @version 1.0 706 */ 707 void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*); 708 709 /** 710 * @brief Get a 3x3 matrix of the transform from local coordinates to 'device'. 711 * 712 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 713 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 714 * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object. 715 * @since 12 716 * @version 1.0 717 */ 718 void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); 719 720 /** 721 * @brief Use the passed matrix to transforming the geometry, then use existing matrix. 722 * 723 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 724 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 725 * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object, 726 * represents the matrix which is passed. 727 * @since 12 728 * @version 1.0 729 */ 730 void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); 731 732 /** 733 * @brief Enumerates of shadow flags. 734 * 735 * @since 12 736 * @version 1.0 737 */ 738 typedef enum { 739 /** 740 * Use no shadow flags. 741 */ 742 SHADOW_FLAGS_NONE, 743 /** 744 * The occluding object is transparent. 745 */ 746 SHADOW_FLAGS_TRANSPARENT_OCCLUDER, 747 /** 748 * No need to analyze shadows. 749 */ 750 SHADOW_FLAGS_GEOMETRIC_ONLY, 751 /** 752 * Use all shadow flags. 753 */ 754 SHADOW_FLAGS_ALL, 755 } OH_Drawing_CanvasShadowFlags; 756 757 /** 758 * @brief Use circular light to draw an offset spot shadow and outlining ambient shadow for the given path. 759 * 760 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 761 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 762 * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object, use to generate shadows. 763 * @param planeParams Represents the value of the function which returns Z offset of the occluder from the 764 * canvas based on x and y. 765 * @param devLightPos Represents the position of the light relative to the canvas. 766 * @param lightRadius The radius of the circular light. 767 * @param ambientColor Ambient shadow's color. 768 * @param spotColor Spot shadow's color. 769 * @param flag Indicates the flag to control opaque occluder, shadow, and light position. 770 * @since 12 771 * @version 1.0 772 */ 773 void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams, 774 OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, 775 OH_Drawing_CanvasShadowFlags flag); 776 777 /** 778 * @brief Clears a canvas by using a specified color. 779 * 780 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 781 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 782 * @param color Indicates the color, which is a 32-bit (ARGB) variable. 783 * @since 8 784 * @version 1.0 785 */ 786 void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); 787 788 /** 789 * @brief Sets matrix of canvas. 790 * 791 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 792 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 793 * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object. 794 * @since 12 795 * @version 1.0 796 */ 797 void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); 798 799 /** 800 * @brief Reset matrix to the idenmtity matrix, any prior matrix state is overwritten. 801 * 802 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 803 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 804 * @since 12 805 * @version 1.0 806 */ 807 void OH_Drawing_CanvasResetMatrix(OH_Drawing_Canvas*); 808 809 /** 810 * @brief Draws the specified source rectangle of the image onto the canvas, 811 * scaled and translated to the destination rectangle. 812 * 813 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 814 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 815 * @param OH_Drawing_Image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 816 * @param src The area of source image. 817 * @param dst The area of destination canvas. 818 * @param OH_Drawing_SamplingOptions Indicates the pointer to an <b>OH_Drawing_SamplingOptions</b> object. 819 * @param OH_Drawing_SrcRectConstraint Constraint type. 820 * @since 12 821 * @version 1.0 822 */ 823 void OH_Drawing_CanvasDrawImageRectWithSrc(OH_Drawing_Canvas*, const OH_Drawing_Image*, 824 const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*, 825 OH_Drawing_SrcRectConstraint); 826 827 /** 828 * @brief Draws the specified source rectangle of the image onto the canvas, 829 * scaled and translated to the destination rectangle. 830 * 831 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 832 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 833 * @param OH_Drawing_Image Indicates the pointer to an <b>OH_Drawing_Image</b> object. 834 * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 835 * @param OH_Drawing_SamplingOptions Indicates the pointer to an <b>OH_Drawing_SamplingOptions</b> object. 836 * @since 12 837 * @version 1.0 838 */ 839 void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*, 840 OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*); 841 842 /** 843 * @brief Enumerates of vertices flags. 844 * 845 * @since 12 846 * @version 1.0 847 */ 848 typedef enum { 849 /** 850 * The vertices are a triangle list. 851 */ 852 VERTEX_MODE_TRIANGLES, 853 /** 854 * The vertices are a triangle strip. 855 */ 856 VERTEX_MODE_TRIANGLES_STRIP, 857 /** 858 * The vertices are a triangle fan. 859 */ 860 VERTEX_MODE_TRIANGLE_FAN, 861 } OH_Drawing_VertexMode; 862 863 /** 864 * @brief Draw a triangular mesh with vertex descriptions. 865 * 866 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 867 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 868 * @param vertexMmode Draw a set of vertices. 869 * @param vertexCount Vertex count. 870 * @param positions Positions data pointer. 871 * @param texs Texture coordinate data pointer. 872 * @param colors Color data pointer. 873 * @param indexCount Index count. 874 * @param indices Index data pointer. 875 * @since 12 876 * @version 1.0 877 */ 878 void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas*, OH_Drawing_VertexMode vertexMmode, 879 int32_t vertexCount, const OH_Drawing_Point2D* positions, const OH_Drawing_Point2D* texs, 880 const uint32_t* colors, int32_t indexCount, const uint16_t* indices, OH_Drawing_BlendMode mode); 881 882 /** 883 * @brief Read pixels data from canvas. 884 * 885 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 886 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 887 * @param OH_Drawing_Image_Info width, height, colorType, and alphaType of dstPixels. 888 * @param dstPixels destination pixel storage. 889 * @param dstRowBytes size of one row of pixels. 890 * @param srcX offset into canvas writable pixels on x-axis. 891 * @param srcY offset into canvas writable pixels on y-axis. 892 * @return true if pixels are copied to dstPixels. 893 * @since 12 894 * @version 1.0 895 */ 896 bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*, 897 void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY); 898 899 /** 900 * @brief Read pixels data to a bitmap from canvas. 901 * 902 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 903 * @param OH_Drawing_Canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 904 * @param OH_Drawing_Bitmap Indicates the pointer to an <b>OH_Drawing_Bitmap</b> object. 905 * @param srcX offset into canvas writable pixels on x-axis. 906 * @param srcY offset into canvas writable pixels on y-axis. 907 * @return true if pixels are copied to dstBitmap. 908 * @since 12 909 * @version 1.0 910 */ 911 bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY); 912 913 /** 914 * @brief Checks whether the drawable area is empty. 915 * 916 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 917 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 918 * @param isClipEmpty Indicates if drawable area is empty. 919 * @return Returns the error code. 920 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 921 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or isClipEmpty is nullptr. 922 * @since 12 923 * @version 1.0 924 */ 925 OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, bool* isClipEmpty); 926 927 /** 928 * @brief Gets image info of canvas. 929 * 930 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 931 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 932 * @param imageInfo Indicates the pointer to an <b>OH_Drawing_Image_Info</b> object. 933 * @return Returns the error code. 934 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 935 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or imageInfo is nullptr. 936 * @since 12 937 * @version 1.0 938 */ 939 OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo); 940 941 /** 942 * @brief Replay drawing command. 943 * 944 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 945 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 946 * @param recordCmd Indicates the pointer to an <b>OH_Drawing_RecordCmd</b> object. 947 * @return Returns the error code. 948 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 949 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or recordCmd is nullptr. 950 * @since 13 951 * @version 1.0 952 */ 953 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd); 954 955 /** 956 * @brief Replay drawing command, support Nesting. 957 * 958 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 959 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 960 * @param recordCmd Indicates the pointer to an <b>OH_Drawing_RecordCmd</b> object. 961 * @return Returns the error code. 962 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 963 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or recordCmd is nullptr. 964 * @since 19 965 * @version 1.0 966 */ 967 OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmdNesting(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd); 968 969 /** 970 * @brief Checks if the path has been cut off. 971 * 972 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 973 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 974 * @param path Indicates the pointer to an <b>OH_Drawing_Paht</b> object. 975 * @param quickReject Indicates if the path has been cut off. 976 * @return Returns the error code. 977 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 978 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or path is nullptr, 979 * or quickReject is nullptr. 980 * @since 16 981 * @version 1.0 982 */ 983 OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectPath(OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, 984 bool* quickReject); 985 986 /** 987 * @brief Checks if the rect has been cut off. 988 * 989 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 990 * @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object. 991 * @param rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object. 992 * @param quickReject Indicates if the rect has been cut off. 993 * @return Returns the error code. 994 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 995 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or rect is nullptr, 996 * or quickReject is nullptr. 997 * @since 16 998 * @version 1.0 999 */ 1000 OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, 1001 bool* quickReject); 1002 #ifdef __cplusplus 1003 } 1004 #endif 1005 /** @} */ 1006 #endif 1007