1/* 2 * Copyright (c) 2021 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/** 17 * @file 18 * @kit ArkUI 19 */ 20 21/*** if arkts 1.2 */ 22import { ImageAIOptions, ImageAnalyzerConfig } from './imageCommon'; 23import { CommonMethod } from './common'; 24import { XComponentType } from './enums'; 25import { VoidCallback } from './units'; 26/*** endif */ 27 28/** 29 * Describes the rectangle of the surface held by the XComponent. 30 * 31 * @interface SurfaceRect 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 12 35 */ 36/** 37 * Surface Rectangle information. 38 * 39 * @interface SurfaceRect 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @atomicservice 43 * @since arkts {'1.1':'20','1.2':'20'} 44 * @arkts 1.1&1.2 45 */ 46declare interface SurfaceRect { 47 /** 48 * X coordinate of the surface rectangle relative to the upper left corner of the XComponent. 49 * Unit: px. 50 * If offsetX is not set, the surface rectangle is centered along the x-axis relative to the upper left corner of the XComponent. 51 * 52 * @type { ?number } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @atomicservice 55 * @since 12 56 */ 57 /** 58 * The horizontal offset of the surface relative to XComponent. 59 * 60 * @type { ?number } 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @crossplatform 63 * @atomicservice 64 * @since arkts {'1.1':'20','1.2':'20'} 65 * @arkts 1.1&1.2 66 */ 67 offsetX?: number; 68 69 /** 70 * Y coordinate of the surface rectangle relative to the upper left corner of the XComponent. 71 * Unit: px. 72 * If offsetY is not set, the surface rectangle is centered along the y-axis relative to the upper left corner of the XComponent. 73 * 74 * @type { ?number } 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @atomicservice 77 * @since 12 78 */ 79 /** 80 * The vertical offset of the surface relative to XComponent. 81 * 82 * @type { ?number } 83 * @syscap SystemCapability.ArkUI.ArkUI.Full 84 * @crossplatform 85 * @atomicservice 86 * @since arkts {'1.1':'20','1.2':'20'} 87 * @arkts 1.1&1.2 88 */ 89 offsetY?: number; 90 91 /** 92 * Width of the surface rectangle. 93 * Unit: px. 94 * 95 * @type { number } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @atomicservice 98 * @since 12 99 */ 100 /** 101 * The width of the surface created by XComponent 102 * 103 * @type { number } 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @crossplatform 106 * @atomicservice 107 * @since arkts {'1.1':'20','1.2':'20'} 108 * @arkts 1.1&1.2 109 */ 110 surfaceWidth: number; 111 112 /** 113 * Height of the surface rectangle. 114 * Unit: px. 115 * 116 * @type { number } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @atomicservice 119 * @since 12 120 */ 121 /** 122 * The height of the surface created by XComponent 123 * 124 * @type { number } 125 * @syscap SystemCapability.ArkUI.ArkUI.Full 126 * @crossplatform 127 * @atomicservice 128 * @since arkts {'1.1':'20','1.2':'20'} 129 * @arkts 1.1&1.2 130 */ 131 surfaceHeight: number; 132} 133 134/** 135 * Defines whether the orientation of the surface held by the current XComponent is locked when the screen rotates. 136 * 137 * @interface SurfaceRotationOptions 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @atomicservice 140 * @since 12 141 */ 142/** 143 * Surface rotation options. 144 * 145 * @interface SurfaceRotationOptions 146 * @syscap SystemCapability.ArkUI.ArkUI.Full 147 * @crossplatform 148 * @atomicservice 149 * @since arkts {'1.1':'20','1.2':'20'} 150 * @arkts 1.1&1.2 151 */ 152declare interface SurfaceRotationOptions { 153 /** 154 * Whether the orientation of the surface is locked when the screen rotates. 155 * If this parameter is not set, the default value false is used, indicating that the orientation is not locked. 156 * 157 * @type { ?boolean } 158 * @syscap SystemCapability.ArkUI.ArkUI.Full 159 * @atomicservice 160 * @since 12 161 */ 162 /** 163 * Lock property of the surface rotation. 164 * 165 * @type { ?boolean } 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @crossplatform 168 * @atomicservice 169 * @since arkts {'1.1':'20','1.2':'20'} 170 * @arkts 1.1&1.2 171 */ 172 lock?: boolean; 173} 174 175/** 176 * Defines the controller of the XComponent. 177 * You can bind the controller to the XComponent to call the component APIs through the controller. 178 * 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @since 8 181 */ 182/** 183 * Defines the controller of the XComponent. 184 * You can bind the controller to the XComponent to call the component APIs through the controller. 185 * 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @atomicservice 189 * @since arkts {'1.1':'12','1.2':'20'} 190 * @arkts 1.1&1.2 191 */ 192declare class XComponentController { 193 /** 194 * A constructor used to create a XComponentController instance. 195 * 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @since 8 198 */ 199 /** 200 * A constructor used to create a XComponentController instance. 201 * 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @crossplatform 204 * @atomicservice 205 * @since arkts {'1.1':'12','1.2':'20'} 206 * @arkts 1.1&1.2 207 */ 208 constructor(); 209 210 /** 211 * Obtains the ID of the surface held by the XComponent, which can then be used for @ohos APIs. 212 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 213 * 214 * @returns { string } ID of the surface held by the XComponent. 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @since 9 217 */ 218 /** 219 * Obtains the ID of the surface held by the XComponent, which can then be used for @ohos APIs. 220 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 221 * 222 * @returns { string } ID of the surface held by the XComponent. 223 * @syscap SystemCapability.ArkUI.ArkUI.Full 224 * @crossplatform 225 * @atomicservice 226 * @since arkts {'1.1':'12','1.2':'20'} 227 * @arkts 1.1&1.2 228 */ 229 getXComponentSurfaceId(): string; 230 231 /** 232 * Obtains the context of an XComponent object. 233 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 234 * 235 * @returns { Object } The context of native XComponent. 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @since 8 238 */ 239 /** 240 * Obtains the context of an XComponent object. 241 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 242 * 243 * @returns { Object } Context of the XComponent object. 244 * The APIs contained in the context are defined by developers. 245 * The context is passed in as the first parameter of the onLoad callback. 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @atomicservice 249 * @since arkts {'1.1':'12','1.2':'20'} 250 * @arkts 1.1&1.2 251 */ 252 getXComponentContext(): Object; 253 254 /** 255 * Sets the width and height of the surface held by the XComponent. 256 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 257 * 258 * @param { object } value - Width and Height of the surface held by the XComponent. 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @since 9 261 * @deprecated since 12 262 * @useinstead setXComponentSurfaceRect 263 */ 264 setXComponentSurfaceSize(value: { 265 surfaceWidth: number; 266 surfaceHeight: number; 267 }): void; 268 269 /** 270 * Sets the rectangle for the surface held by the XComponent. 271 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 272 * 273 * @param { SurfaceRect } rect - Rectangle of the surface held by the XComponent. 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @atomicservice 276 * @since 12 277 */ 278 /** 279 * Set the rectangle information of surface created by XComponent. 280 * 281 * @param { SurfaceRect } rect - The surface rectangle information. 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @atomicservice 285 * @since arkts {'1.1':'20','1.2':'20'} 286 * @arkts 1.1&1.2 287 */ 288 setXComponentSurfaceRect(rect: SurfaceRect): void; 289 290 /** 291 * Obtains the rectangle of the surface held by the XComponent. 292 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 293 * 294 * @returns { SurfaceRect } Rectangle of the surface held by the XComponent. 295 * @syscap SystemCapability.ArkUI.ArkUI.Full 296 * @atomicservice 297 * @since 12 298 */ 299 /** 300 * Get the rectangle information of surface created by XComponent. 301 * 302 * @returns { SurfaceRect } The surface rectangle information. 303 * @syscap SystemCapability.ArkUI.ArkUI.Full 304 * @crossplatform 305 * @atomicservice 306 * @since arkts {'1.1':'20','1.2':'20'} 307 * @arkts 1.1&1.2 308 */ 309 getXComponentSurfaceRect(): SurfaceRect; 310 311 /** 312 * Sets whether to lock the orientation of the surface held by this XComponent when the screen rotates. 313 * This API is effective only when the XComponent type is SURFACE ("surface"). 314 * 315 * @param { SurfaceRotationOptions } rotationOptions - Whether to lock the orientation of the surface held by the current XComponent when the screen rotates. 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @atomicservice 318 * @since 12 319 */ 320 /** 321 * Set the rotation options of the Surface created by XComponent. 322 * 323 * @param { SurfaceRotationOptions } rotationOptions - The surface rotation options. 324 * @syscap SystemCapability.ArkUI.ArkUI.Full 325 * @crossplatform 326 * @atomicservice 327 * @since arkts {'1.1':'20','1.2':'20'} 328 * @arkts 1.1&1.2 329 */ 330 setXComponentSurfaceRotation(rotationOptions: SurfaceRotationOptions): void; 331 332 /** 333 * Obtains whether the orientation of the surface held by this XComponent is locked when the screen rotates. 334 * This API is effective only when the XComponent type is SURFACE ("surface"). 335 * 336 * @returns { Required<SurfaceRotationOptions> } The surface rotation options result. 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @atomicservice 339 * @since 12 340 */ 341 /** 342 * Get the rotation options result of the Surface created by XComponent. 343 * 344 * @returns { Required<SurfaceRotationOptions> } The surface rotation options result. 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @crossplatform 347 * @atomicservice 348 * @since arkts {'1.1':'20','1.2':'20'} 349 * @arkts 1.1&1.2 350 */ 351 getXComponentSurfaceRotation(): Required<SurfaceRotationOptions>; 352 353 /** 354 * Triggered when the surface held by the XComponent is created. 355 * This API works only when type of the XComponent is set to SURFACE("surface") or TEXTURE. 356 * 357 * @param { string } surfaceId - ID of the surface held by the XComponent. 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @atomicservice 360 * @since 12 361 */ 362 /** 363 * Called after the surface is first created. 364 * 365 * @param { string } surfaceId - The id of the surface created by XComponent. 366 * @syscap SystemCapability.ArkUI.ArkUI.Full 367 * @crossplatform 368 * @atomicservice 369 * @since arkts {'1.1':'20','1.2':'20'} 370 * @arkts 1.1&1.2 371 */ 372 onSurfaceCreated(surfaceId: string): void; 373 374 /** 375 * Triggered when the surface held by the XComponent has its size changed (including the time when the XComponent is created with the specified size). 376 * This API works only when type of the XComponent is set to SURFACE ("surface") or TEXTURE. 377 * 378 * @param { string } surfaceId - ID of the surface held by the XComponent. 379 * @param { SurfaceRect } rect - Rectangle for displaying the surface held by the XComponent. 380 * @syscap SystemCapability.ArkUI.ArkUI.Full 381 * @atomicservice 382 * @since 12 383 */ 384 /** 385 * Called after the surface rectangle information is changed. 386 * 387 * @param { string } surfaceId - The id of the surface created by XComponent. 388 * @param { SurfaceRect } rect - The rectangle information of the surface created by XComponent. 389 * @syscap SystemCapability.ArkUI.ArkUI.Full 390 * @crossplatform 391 * @atomicservice 392 * @since arkts {'1.1':'20','1.2':'20'} 393 * @arkts 1.1&1.2 394 */ 395 onSurfaceChanged(surfaceId: string, rect: SurfaceRect): void; 396 397 /** 398 * Triggered when the surface held by the XComponent is destroyed. 399 * This API works only when type of the XComponent is set to SURFACE ("surface") or TEXTURE. 400 * 401 * @param { string } surfaceId - ID of the surface held by the XComponent. 402 * @syscap SystemCapability.ArkUI.ArkUI.Full 403 * @atomicservice 404 * @since 12 405 */ 406 /** 407 * Called when the surface is about to be destroyed. 408 * 409 * @param { string } surfaceId - The id of the surface created by XComponent. 410 * @syscap SystemCapability.ArkUI.ArkUI.Full 411 * @crossplatform 412 * @atomicservice 413 * @since arkts {'1.1':'20','1.2':'20'} 414 * @arkts 1.1&1.2 415 */ 416 onSurfaceDestroyed(surfaceId: string): void; 417 418 /** 419 * Starts AI image analysis in the given settings. 420 * Before calling this API, make sure the AI image analyzer is enabled. 421 * Because the image frame used for analysis is the one captured when this API is called, pay attention to the invoking time of this API. 422 * If this API is repeatedly called before the execution is complete, an error callback is triggered. 423 * 424 * @param { ImageAnalyzerConfig } config - Settings of the AI image analyzer. 425 * @returns { Promise<void> } Promise used to return the result. 426 * @throws { BusinessError } 110001 - Image analysis feature is unsupported. 427 * @throws { BusinessError } 110002 - Image analysis is currently being executed. 428 * @throws { BusinessError } 110003 - Image analysis is stopped. 429 * @syscap SystemCapability.ArkUI.ArkUI.Full 430 * @atomicservice 431 * @since arkts {'1.1':'12','1.2':'20'} 432 * @arkts 1.1&1.2 433 */ 434 startImageAnalyzer(config: ImageAnalyzerConfig): Promise<void>; 435 436 /** 437 * Stops AI image analysis. 438 * The content displayed by the AI image analyzer will be destroyed. 439 * 440 * @syscap SystemCapability.ArkUI.ArkUI.Full 441 * @atomicservice 442 * @since arkts {'1.1':'12','1.2':'20'} 443 * @arkts 1.1&1.2 444 */ 445 stopImageAnalyzer(): void; 446 447 /** 448 * Get a Canvas for drawing into the surface created by XComponent. 449 * 450 * @returns { DrawingCanvas | null} Returns a Canvas for drawing into the surface created by XComponent. 451 * Returns null if the surface is not available. 452 * @syscap SystemCapability.ArkUI.ArkUI.Full 453 * @atomicservice 454 * @since 20 455 */ 456 lockCanvas(): DrawingCanvas | null; 457 458 /** 459 * Posts the new contents of the Canvas to the surface created by XComponent and releases the Canvas. 460 * 461 * @param { DrawingCanvas } canvas - The canvas previously obtained from lockCanvas. 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @atomicservice 464 * @since 20 465 */ 466 unlockCanvasAndPost(canvas: DrawingCanvas):void; 467} 468 469/** 470 * Defines the options of the XComponent. 471 * 472 * @interface XComponentOptions 473 * @syscap SystemCapability.ArkUI.ArkUI.Full 474 * @atomicservice 475 * @since 12 476 */ 477/** 478 * Defines the xcomponent options. 479 * 480 * @interface XComponentOptions 481 * @syscap SystemCapability.ArkUI.ArkUI.Full 482 * @crossplatform 483 * @atomicservice 484 * @since arkts {'1.1':'20','1.2':'20'} 485 * @arkts 1.1&1.2 486 */ 487declare interface XComponentOptions { 488 /** 489 * Type of the component. 490 * 491 * @type { XComponentType } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @atomicservice 494 * @since 12 495 */ 496 /** 497 * The type of xcomponent 498 * 499 * @type { XComponentType } 500 * @syscap SystemCapability.ArkUI.ArkUI.Full 501 * @crossplatform 502 * @atomicservice 503 * @since arkts {'1.1':'20','1.2':'20'} 504 * @arkts 1.1&1.2 505 */ 506 type: XComponentType; 507 508 /** 509 * Controller bound to the component, which can be used to invoke methods of the component. 510 * This parameter is valid only when type is SURFACE or TEXTURE. 511 * 512 * @type { XComponentController } 513 * @syscap SystemCapability.ArkUI.ArkUI.Full 514 * @atomicservice 515 * @since 12 516 */ 517 /** 518 * The controller of xcomponent. 519 * 520 * @type { XComponentController } 521 * @syscap SystemCapability.ArkUI.ArkUI.Full 522 * @crossplatform 523 * @atomicservice 524 * @since arkts {'1.1':'20','1.2':'20'} 525 * @arkts 1.1&1.2 526 */ 527 controller: XComponentController; 528 529 /** 530 * AI image analysis options. 531 * You can configure the analysis type or bind an analyzer controller through this parameter. 532 * 533 * @type { ?ImageAIOptions } 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @atomicservice 536 * @since arkts {'1.1':'12','1.2':'20'} 537 * @arkts 1.1&1.2 538 */ 539 imageAIOptions?: ImageAIOptions; 540 541 /** 542 * Identifier of a screen. 543 * 544 * @type { ?number } 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @systemapi 547 * @since arkts {'1.1':'17','1.2':'20'} 548 * @arkts 1.1&1.2 549 */ 550 screenId?: number; 551} 552 553/** 554 * Defines the native xcomponent parameters. 555 * 556 * @interface NativeXComponentParameters 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @atomicservice 559 * @since arkts {'1.1':'19','1.2':'20'} 560 * @arkts 1.1&1.2 561 */ 562declare interface NativeXComponentParameters { 563 /** 564 * The type of xcomponent 565 * 566 * @type { XComponentType } 567 * @syscap SystemCapability.ArkUI.ArkUI.Full 568 * @atomicservice 569 * @since arkts {'1.1':'19','1.2':'20'} 570 * @arkts 1.1&1.2 571 */ 572 type: XComponentType; 573 574 /** 575 * Image ai options. 576 * 577 * @type { ?ImageAIOptions } 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @atomicservice 580 * @since arkts {'1.1':'19','1.2':'20'} 581 * @arkts 1.1&1.2 582 */ 583 imageAIOptions?: ImageAIOptions; 584} 585 586/** 587 * Defines XComponent. 588 * 589 * @interface XComponentInterface 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @since 8 592 */ 593/** 594 * Defines XComponent. 595 * 596 * @interface XComponentInterface 597 * @syscap SystemCapability.ArkUI.ArkUI.Full 598 * @crossplatform 599 * @atomicservice 600 * @since 12 601 */ 602interface XComponentInterface { 603 /** 604 * Constructor parameters 605 * 606 * @param { object } value - Indicates the options of the xcomponent. 607 * @returns { XComponentAttribute } 608 * @syscap SystemCapability.ArkUI.ArkUI.Full 609 * @since 8 610 * @deprecated since 12 611 */ 612 (value: { id: string; type: string; libraryname?: string; controller?: XComponentController }): XComponentAttribute; 613 614 /** 615 * Constructor parameters 616 * 617 * @param { object } value - Indicates the options of the xcomponent. 618 * @returns { XComponentAttribute } The attribute of the xcomponent. 619 * @syscap SystemCapability.ArkUI.ArkUI.Full 620 * @since 10 621 */ 622 /** 623 * Constructor parameters 624 * 625 * @param { object } value - Indicates the options of the xcomponent. 626 * @returns { XComponentAttribute } The attribute of the xcomponent. 627 * @syscap SystemCapability.ArkUI.ArkUI.Full 628 * @crossplatform 629 * @atomicservice 630 * @since 12 631 */ 632 (value: { id: string; type: XComponentType; libraryname?: string; controller?: XComponentController }): XComponentAttribute; 633 634 /** 635 * Constructor parameters 636 * 637 * @param { XComponentOptions } options - Indicates the options of the xcomponent. 638 * @returns { XComponentAttribute } The attribute of the xcomponent. 639 * @syscap SystemCapability.ArkUI.ArkUI.Full 640 * @atomicservice 641 * @since 12 642 */ 643 /** 644 * Constructor parameters 645 * 646 * @param { XComponentOptions } options - Indicates the options of the xcomponent. 647 * @returns { XComponentAttribute } The attribute of the xcomponent. 648 * @syscap SystemCapability.ArkUI.ArkUI.Full 649 * @crossplatform 650 * @atomicservice 651 * @since 20 652 */ 653 (options: XComponentOptions): XComponentAttribute; 654 655 /** 656 * Constructor parameters 657 * 658 * @param { NativeXComponentParameters } params - Indicates the constructor parameters of the xcomponent for native developing. 659 * @returns { XComponentAttribute } The attribute of the xcomponent. 660 * @syscap SystemCapability.ArkUI.ArkUI.Full 661 * @atomicservice 662 * @since 19 663 */ 664 (params: NativeXComponentParameters): XComponentAttribute; 665} 666 667/** 668 * Triggered after the surface held by the XComponent is created. 669 * 670 * @typedef { function } OnNativeLoadCallback 671 * @param { object } [event] - Context of the XComponent object. 672 * The APIs contained in the context are defined at the native layer by developers. 673 * @syscap SystemCapability.ArkUI.ArkUI.Full 674 * @crossplatform 675 * @atomicservice 676 * @since arkts {'1.1':'18','1.2':'20'} 677 * @arkts 1.1&1.2 678 */ 679declare type OnNativeLoadCallback = (event?: object) => void; 680 681/** 682 * Defines XComponentAttribute. 683 * 684 * @extends CommonMethod<XComponentAttribute> 685 * @syscap SystemCapability.ArkUI.ArkUI.Full 686 * @since 8 687 */ 688/** 689 * Defines XComponentAttribute. 690 * 691 * @extends CommonMethod<XComponentAttribute> 692 * @syscap SystemCapability.ArkUI.ArkUI.Full 693 * @crossplatform 694 * @atomicservice 695 * @since arkts {'1.1':'12','1.2':'20'} 696 * @arkts 1.1&1.2 697 */ 698declare class XComponentAttribute extends CommonMethod<XComponentAttribute> { 699 /** 700 * Triggered when the plug-in is loaded. 701 * 702 * @param { function } [callback] - Callback after the surface held by the XComponent is created. 703 * @returns { XComponentAttribute } 704 * @syscap SystemCapability.ArkUI.ArkUI.Full 705 * @since 8 706 */ 707 /** 708 * Triggered when the plug-in is loaded. 709 * 710 * @param { function } [callback] - Callback after the surface held by the XComponent is created. 711 * @returns { XComponentAttribute } 712 * @syscap SystemCapability.ArkUI.ArkUI.Full 713 * @crossplatform 714 * @atomicservice 715 * @since 12 716 */ 717 /** 718 * Triggered when the plug-in is loaded. 719 * Anonymous Object Rectification. 720 * 721 * @param { OnNativeLoadCallback } callback - Callback after the surface held by the XComponent is created. 722 * @returns { XComponentAttribute } 723 * @syscap SystemCapability.ArkUI.ArkUI.Full 724 * @crossplatform 725 * @atomicservice 726 * @since arkts {'1.1':'18','1.2':'20'} 727 * @arkts 1.1&1.2 728 */ 729 onLoad(callback: OnNativeLoadCallback): XComponentAttribute; 730 731 /** 732 * Triggered when the plug-in is destroyed. 733 * 734 * @param { function } event - Callback after the XComponent is destroyed. 735 * @returns { XComponentAttribute } 736 * @syscap SystemCapability.ArkUI.ArkUI.Full 737 * @since 8 738 */ 739 /** 740 * Triggered when the plug-in is destroyed. 741 * 742 * @param { function } event - Callback after the XComponent is destroyed. 743 * @returns { XComponentAttribute } 744 * @syscap SystemCapability.ArkUI.ArkUI.Full 745 * @crossplatform 746 * @atomicservice 747 * @since 12 748 */ 749 /** 750 * Triggered when the plug-in is destroyed. 751 * Anonymous Object Rectification. 752 * 753 * @param { VoidCallback } event - Callback after the XComponent is destroyed. 754 * @returns { XComponentAttribute } 755 * @syscap SystemCapability.ArkUI.ArkUI.Full 756 * @crossplatform 757 * @atomicservice 758 * @since arkts {'1.1':'18','1.2':'20'} 759 * @arkts 1.1&1.2 760 */ 761 onDestroy(event: VoidCallback): XComponentAttribute; 762 763 /** 764 * Sets whether to enable the AI image analyzer, which supports subject recognition, text recognition, and object lookup. 765 * For the settings to take effect, this attribute must be used together with StartImageAnalyzer and StopImageAnalyzer of XComponentController. 766 * This feature cannot be used together with the overlay attribute. 767 * If both are set, the CustomBuilder attribute in overlay has no effect. This feature also depends on device capabilities. 768 * 769 * @param { boolean } enable - Whether to enable the AI image analyzer. 770 * @returns { XComponentAttribute } 771 * @syscap SystemCapability.ArkUI.ArkUI.Full 772 * @atomicservice 773 * @since arkts {'1.1':'12','1.2':'20'} 774 * @arkts 1.1&1.2 775 */ 776 enableAnalyzer(enable: boolean): XComponentAttribute; 777 778 /** 779 * Sets whether to enable the secure surface to protect the content rendered within the component from being captured or recorded. 780 * 781 * @param { boolean } isSecure - Whether to enable the secure surface. 782 * @returns { XComponentAttribute } 783 * @syscap SystemCapability.ArkUI.ArkUI.Full 784 * @atomicservice 785 * @since arkts {'1.1':'13','1.2':'20'} 786 * @arkts 1.1&1.2 787 */ 788 enableSecure(isSecure: boolean): XComponentAttribute; 789 790 /** 791 * Set hdrBrightness for XComponent. 792 * 793 * @param { number } brightness - control the brightness of HDR video 794 * @returns { XComponentAttribute } 795 * @syscap SystemCapability.ArkUI.ArkUI.Full 796 * @systemapi 797 * @since 14 798 */ 799 /** 800 * Set hdrBrightness for XComponent. 801 * 802 * @param { number } brightness - control the brightness of HDR video 803 * @returns { XComponentAttribute } 804 * @syscap SystemCapability.ArkUI.ArkUI.Full 805 * @atomicservice 806 * @since 20 807 * @arkts 1.1&1.2 808 */ 809 hdrBrightness(brightness: number): XComponentAttribute; 810 811 /** 812 * Enable transparent layer for XComponent. 813 * 814 * @param { boolean } enabled - whether to enable transparent layer for XComponent. 815 * @returns { XComponentAttribute } 816 * @syscap SystemCapability.ArkUI.ArkUI.Full 817 * @systemapi 818 * @since arkts {'1.1':'18','1.2':'20'} 819 * @arkts 1.1&1.2 820 */ 821 enableTransparentLayer(enabled: boolean): XComponentAttribute; 822} 823 824/** 825 * Defines XComponent Component. 826 * 827 * @syscap SystemCapability.ArkUI.ArkUI.Full 828 * @since 8 829 */ 830/** 831 * Defines XComponent Component. 832 * 833 * @syscap SystemCapability.ArkUI.ArkUI.Full 834 * @crossplatform 835 * @atomicservice 836 * @since 12 837 */ 838declare const XComponent: XComponentInterface; 839 840/** 841 * Defines XComponent Component instance. 842 * 843 * @syscap SystemCapability.ArkUI.ArkUI.Full 844 * @since 8 845 */ 846/** 847 * Defines XComponent Component instance. 848 * 849 * @syscap SystemCapability.ArkUI.ArkUI.Full 850 * @crossplatform 851 * @atomicservice 852 * @since 12 853 */ 854declare const XComponentInstance: XComponentAttribute; 855 856/** 857 * Defines the XComponent parameter interface. 858 * 859 * @interface XComponentParameter 860 * @syscap SystemCapability.ArkUI.ArkUI.Full 861 * @crossplatform 862 * @atomicservice 863 * @since 20 864 * @arkts 1.2 865 */ 866declare interface XComponentParameter { 867 /** 868 * The id of xcomponent 869 * 870 * @type { string } 871 * @syscap SystemCapability.ArkUI.ArkUI.Full 872 * @crossplatform 873 * @atomicservice 874 * @since 20 875 * @arkts 1.2 876 */ 877 id: string; 878 /** 879 * The type of xcomponent 880 * 881 * @type { XComponentType } 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @crossplatform 884 * @atomicservice 885 * @since 20 886 * @arkts 1.2 887 */ 888 type: XComponentType; 889 /** 890 * The name of the dynamic library compiled and output by the native layer. 891 * 892 * @type { ?string } 893 * @syscap SystemCapability.ArkUI.ArkUI.Full 894 * @crossplatform 895 * @atomicservice 896 * @since 20 897 * @arkts 1.2 898 */ 899 libraryname?: string; 900 /** 901 * The controller of xcomponent. 902 * 903 * @type { ?XComponentController } 904 * @syscap SystemCapability.ArkUI.ArkUI.Full 905 * @crossplatform 906 * @atomicservice 907 * @since 20 908 * @arkts 1.2 909 */ 910 controller?: XComponentController; 911} 912 913/** 914 * Defines XComponent. 915 * 916 * @interface XComponentInterface 917 * @syscap SystemCapability.ArkUI.ArkUI.Full 918 * @crossplatform 919 * @atomicservice 920 * @since 20 921 * @arkts 1.2 922 */ 923interface XComponentInterface { 924 /** 925 * Constructor parameters 926 * 927 * @param { XComponentParameter } value - Indicates the options of the xcomponent. 928 * @returns { XComponentAttribute } The attribute of the xcomponent. 929 * @syscap SystemCapability.ArkUI.ArkUI.Full 930 * @crossplatform 931 * @atomicservice 932 * @since 20 933 * @arkts 1.2 934 */ 935 (value: XComponentParameter): XComponentAttribute; 936 937 /** 938 * Constructor parameters 939 * 940 * @param { XComponentOptions } options - Indicates the options of the xcomponent. 941 * @returns { XComponentAttribute } The attribute of the xcomponent. 942 * @syscap SystemCapability.ArkUI.ArkUI.Full 943 * @atomicservice 944 * @since 20 945 * @arkts 1.2 946 */ 947 (options: XComponentOptions): XComponentAttribute; 948 949 /** 950 * Constructor parameters 951 * 952 * @param { NativeXComponentParameters } params - Indicates the constructor parameters of the xcomponent for native developing. 953 * @returns { XComponentAttribute } The attribute of the xcomponent. 954 * @syscap SystemCapability.ArkUI.ArkUI.Full 955 * @atomicservice 956 * @since 20 957 * @arkts 1.2 958 */ 959 (params: NativeXComponentParameters): XComponentAttribute; 960}