1/* 2 * Copyright (c) 2024-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 17// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! 18 19import { ResourceColor, Position, Length, SizeOptions, ResourceStr, Font } from "./units" 20import { Color, TextOverflow, BorderStyle, TextHeightAdaptivePolicy } from "./enums" 21import { FontOptions, FontInfo } from "@ohos/font" 22import { MeasureOptions } from "@ohos/measure" 23import { Resource } from "global.resource" 24import { TypeChecker, ArkUIGeneratedNativeModule } from "#components" 25import { Finalizable, runtimeType, RuntimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KPointer, MaterializedBase, NativeBuffer, KInt, KBoolean, KStringPtr } from "@koalaui/interop" 26import { unsafeCast, int32, int64, float32 } from "@koalaui/common" 27import { Serializer } from "./peers/Serializer" 28import { CallbackKind } from "./peers/CallbackKind" 29import { Deserializer } from "./peers/Deserializer" 30import { CallbackTransformer } from "./peers/CallbackTransformer" 31import { PixelMap, PixelMapInternal } from "./arkui-pixelmap" 32import { NodeAttach, remember } from "@koalaui/runtime" 33import { Matrix4Transit } from "./arkui-matrix4" 34import { EffectScope } from "./symbolglyph" 35 36export class WebviewControllerInternal { 37 public static fromPtr(ptr: KPointer): WebviewController { 38 const obj : WebviewController = new WebviewController() 39 obj.peer = new Finalizable(ptr, WebviewController.getFinalizer()) 40 return obj 41 } 42} 43export class WebviewController implements MaterializedBase { 44 peer?: Finalizable | undefined = undefined 45 public getPeer(): Finalizable | undefined { 46 return this.peer 47 } 48 static ctor_webviewcontroller(): KPointer { 49 const retval = ArkUIGeneratedNativeModule._WebviewController_ctor() 50 return retval 51 } 52 constructor() { 53 // Constructor does not have parameters. 54 // It means that the static method call invokes ctor method as well 55 // when all arguments are undefined. 56 const ctorPtr : KPointer = WebviewController.ctor_webviewcontroller() 57 this.peer = new Finalizable(ctorPtr, WebviewController.getFinalizer()) 58 } 59 static getFinalizer(): KPointer { 60 return ArkUIGeneratedNativeModule._WebviewController_getFinalizer() 61 } 62 public static initializeWebEngine(): void { 63 WebviewController.initializeWebEngine_serialize() 64 return 65 } 66 public loadUrl(url: string | Resource, headers?: Array<WebHeader>): void { 67 const url_casted = url as (string | Resource) 68 const headers_casted = headers as (Array<WebHeader> | undefined) 69 this.loadUrl_serialize(url_casted, headers_casted) 70 return 71 } 72 private static initializeWebEngine_serialize(): void { 73 ArkUIGeneratedNativeModule._WebviewController_initializeWebEngine() 74 } 75 private loadUrl_serialize(url: string | Resource, headers?: Array<WebHeader>): void { 76 const thisSerializer : Serializer = Serializer.hold() 77 let url_type : int32 = RuntimeType.UNDEFINED 78 url_type = runtimeType(url) 79 if (RuntimeType.STRING == url_type) { 80 thisSerializer.writeInt8(0 as int32) 81 const url_0 = url as string 82 thisSerializer.writeString(url_0) 83 } 84 else if (RuntimeType.OBJECT == url_type) { 85 thisSerializer.writeInt8(1 as int32) 86 const url_1 = url as Resource 87 thisSerializer.writeResource(url_1) 88 } 89 let headers_type : int32 = RuntimeType.UNDEFINED 90 headers_type = runtimeType(headers) 91 thisSerializer.writeInt8(headers_type as int32) 92 if ((RuntimeType.UNDEFINED) != (headers_type)) { 93 const headers_value = headers! 94 thisSerializer.writeInt32(headers_value.length as int32) 95 for (let i = 0; i < headers_value.length; i++) { 96 const headers_value_element : WebHeader = headers_value[i] 97 thisSerializer.writeWebHeader(headers_value_element) 98 } 99 } 100 ArkUIGeneratedNativeModule._WebviewController_loadUrl(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 101 thisSerializer.release() 102 } 103} 104export class GlobalScope_ohos_arkui_componentSnapshot { 105 public static get(id: string, callback: ((result: PixelMap) => void), options?: SnapshotOptions): void { 106 const id_casted = id as (string) 107 const callback_casted = callback as (((result: PixelMap) => void)) 108 const options_casted = options as (SnapshotOptions | undefined) 109 GlobalScope_ohos_arkui_componentSnapshot.get_serialize(id_casted, callback_casted, options_casted) 110 return 111 } 112 private static get_serialize(id: string, callback: ((result: PixelMap) => void), options?: SnapshotOptions): void { 113 const thisSerializer : Serializer = Serializer.hold() 114 thisSerializer.holdAndWriteCallback(callback) 115 let options_type : int32 = RuntimeType.UNDEFINED 116 options_type = runtimeType(options) 117 thisSerializer.writeInt8(options_type as int32) 118 if ((RuntimeType.UNDEFINED) != (options_type)) { 119 const options_value = options! 120 thisSerializer.writeSnapshotOptions(options_value) 121 } 122 ArkUIGeneratedNativeModule._GlobalScope_ohos_arkui_componentSnapshot_get(id, thisSerializer.asBuffer(), thisSerializer.length()) 123 thisSerializer.release() 124 } 125} 126export class GlobalScope_ohos_arkui_performanceMonitor { 127 public static begin(scene: string, startInputType: PerfMonitorActionType, note?: string): void { 128 const scene_casted = scene as (string) 129 const startInputType_casted = startInputType as (PerfMonitorActionType) 130 const note_casted = note as (string | undefined) 131 GlobalScope_ohos_arkui_performanceMonitor.begin_serialize(scene_casted, startInputType_casted, note_casted) 132 return 133 } 134 public static end(scene: string): void { 135 const scene_casted = scene as (string) 136 GlobalScope_ohos_arkui_performanceMonitor.end_serialize(scene_casted) 137 return 138 } 139 public static recordInputEventTime(actionType: PerfMonitorActionType, sourceType: PerfMonitorSourceType, time: int64): void { 140 const actionType_casted = actionType as (PerfMonitorActionType) 141 const sourceType_casted = sourceType as (PerfMonitorSourceType) 142 const time_casted = time as (int64) 143 GlobalScope_ohos_arkui_performanceMonitor.recordInputEventTime_serialize(actionType_casted, sourceType_casted, time_casted) 144 return 145 } 146 private static begin_serialize(scene: string, startInputType: PerfMonitorActionType, note?: string): void { 147 const thisSerializer : Serializer = Serializer.hold() 148 let note_type : int32 = RuntimeType.UNDEFINED 149 note_type = runtimeType(note) 150 thisSerializer.writeInt8(note_type as int32) 151 if ((RuntimeType.UNDEFINED) != (note_type)) { 152 const note_value = note! 153 thisSerializer.writeString(note_value) 154 } 155 ArkUIGeneratedNativeModule._GlobalScope_ohos_arkui_performanceMonitor_begin(scene, TypeChecker.PerfMonitorActionType_ToNumeric(startInputType), thisSerializer.asBuffer(), thisSerializer.length()) 156 thisSerializer.release() 157 } 158 private static end_serialize(scene: string): void { 159 ArkUIGeneratedNativeModule._GlobalScope_ohos_arkui_performanceMonitor_end(scene) 160 } 161 private static recordInputEventTime_serialize(actionType: PerfMonitorActionType, sourceType: PerfMonitorSourceType, time: int64): void { 162 ArkUIGeneratedNativeModule._GlobalScope_ohos_arkui_performanceMonitor_recordInputEventTime(TypeChecker.PerfMonitorActionType_ToNumeric(actionType), TypeChecker.PerfMonitorSourceType_ToNumeric(sourceType), time) 163 } 164} 165export class CommonShapeInternal { 166 public static fromPtr(ptr: KPointer): CommonShape { 167 const obj : CommonShape = new CommonShape() 168 obj.peer = new Finalizable(ptr, CommonShape.getFinalizer()) 169 return obj 170 } 171} 172export class CommonShape implements MaterializedBase { 173 peer?: Finalizable | undefined = undefined 174 public getPeer(): Finalizable | undefined { 175 return this.peer 176 } 177 static ctor_commonshape(): KPointer { 178 const retval = ArkUIGeneratedNativeModule._CommonShape_ctor() 179 return retval 180 } 181 constructor() { 182 const ctorPtr : KPointer = CommonShape.ctor_commonshape() 183 this.peer = new Finalizable(ctorPtr, CommonShape.getFinalizer()) 184 } 185 static getFinalizer(): KPointer { 186 return ArkUIGeneratedNativeModule._CommonShape_getFinalizer() 187 } 188 public offset(offset: Position): CommonShape { 189 const offset_casted = offset as (Position) 190 return this.offset_serialize(offset_casted) 191 } 192 public fill(color: ResourceColor): CommonShape { 193 const color_casted = color as (ResourceColor) 194 return this.fill_serialize(color_casted) 195 } 196 public position(position: Position): CommonShape { 197 const position_casted = position as (Position) 198 return this.position_serialize(position_casted) 199 } 200 private offset_serialize(offset: Position): CommonShape { 201 const thisSerializer : Serializer = Serializer.hold() 202 thisSerializer.writePosition(offset) 203 const retval = ArkUIGeneratedNativeModule._CommonShape_offset(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 204 thisSerializer.release() 205 const obj : CommonShape = CommonShapeInternal.fromPtr(retval) 206 return obj 207 } 208 private fill_serialize(color: ResourceColor): CommonShape { 209 const thisSerializer : Serializer = Serializer.hold() 210 let color_type : int32 = RuntimeType.UNDEFINED 211 color_type = runtimeType(color) 212 if (TypeChecker.isColor(color)) { 213 thisSerializer.writeInt8(0 as int32) 214 const color_0 = color as Color 215 thisSerializer.writeInt32(TypeChecker.Color_ToNumeric(color_0)) 216 } 217 else if (RuntimeType.NUMBER == color_type) { 218 thisSerializer.writeInt8(1 as int32) 219 const color_1 = color as number 220 thisSerializer.writeNumber(color_1) 221 } 222 else if (RuntimeType.STRING == color_type) { 223 thisSerializer.writeInt8(2 as int32) 224 const color_2 = color as string 225 thisSerializer.writeString(color_2) 226 } 227 else if (RuntimeType.OBJECT == color_type) { 228 thisSerializer.writeInt8(3 as int32) 229 const color_3 = color as Resource 230 thisSerializer.writeResource(color_3) 231 } 232 const retval = ArkUIGeneratedNativeModule._CommonShape_fill(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 233 thisSerializer.release() 234 const obj : CommonShape = CommonShapeInternal.fromPtr(retval) 235 return obj 236 } 237 private position_serialize(position: Position): CommonShape { 238 const thisSerializer : Serializer = Serializer.hold() 239 thisSerializer.writePosition(position) 240 const retval = ArkUIGeneratedNativeModule._CommonShape_position(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 241 thisSerializer.release() 242 const obj : CommonShape = CommonShapeInternal.fromPtr(retval) 243 return obj 244 } 245} 246export class BaseShapeInternal { 247 public static fromPtr(ptr: KPointer): BaseShape { 248 const obj : BaseShape = new BaseShape() 249 obj.peer = new Finalizable(ptr, BaseShape.getFinalizer()) 250 return obj 251 } 252} 253export class BaseShape implements MaterializedBase { 254 peer?: Finalizable | undefined = undefined 255 public getPeer(): Finalizable | undefined { 256 return this.peer 257 } 258 static ctor_baseshape(): KPointer { 259 const retval = ArkUIGeneratedNativeModule._BaseShape_ctor() 260 return retval 261 } 262 constructor() { 263 const ctorPtr : KPointer = BaseShape.ctor_baseshape() 264 this.peer = new Finalizable(ctorPtr, BaseShape.getFinalizer()) 265 } 266 static getFinalizer(): KPointer { 267 return ArkUIGeneratedNativeModule._BaseShape_getFinalizer() 268 } 269 public width(width: Length): BaseShape { 270 const width_casted = width as (Length) 271 return this.width_serialize(width_casted) 272 } 273 public height(height: Length): BaseShape { 274 const height_casted = height as (Length) 275 return this.height_serialize(height_casted) 276 } 277 public size(size: SizeOptions): BaseShape { 278 const size_casted = size as (SizeOptions) 279 return this.size_serialize(size_casted) 280 } 281 private width_serialize(width: Length): BaseShape { 282 const retval = ArkUIGeneratedNativeModule._BaseShape_width(this.peer!.ptr, width) 283 const obj : BaseShape = BaseShapeInternal.fromPtr(retval) 284 return obj 285 } 286 private height_serialize(height: Length): BaseShape { 287 const retval = ArkUIGeneratedNativeModule._BaseShape_height(this.peer!.ptr, height) 288 const obj : BaseShape = BaseShapeInternal.fromPtr(retval) 289 return obj 290 } 291 private size_serialize(size: SizeOptions): BaseShape { 292 const thisSerializer : Serializer = Serializer.hold() 293 thisSerializer.writeSizeOptions(size) 294 const retval = ArkUIGeneratedNativeModule._BaseShape_size(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 295 thisSerializer.release() 296 const obj : BaseShape = BaseShapeInternal.fromPtr(retval) 297 return obj 298 } 299} 300export class RectShapeInternal { 301 public static fromPtr(ptr: KPointer): RectShape { 302 const obj : RectShape = new RectShape(undefined) 303 obj.peer = new Finalizable(ptr, RectShape.getFinalizer()) 304 return obj 305 } 306} 307export class RectShape implements MaterializedBase { 308 peer?: Finalizable | undefined = undefined 309 public getPeer(): Finalizable | undefined { 310 return this.peer 311 } 312 static ctor_rectshape(options?: RectShapeOptions | RoundRectShapeOptions): KPointer { 313 const thisSerializer : Serializer = Serializer.hold() 314 let options_type : int32 = RuntimeType.UNDEFINED 315 options_type = runtimeType(options) 316 thisSerializer.writeInt8(options_type as int32) 317 if ((RuntimeType.UNDEFINED) != (options_type)) { 318 const options_value = options! 319 let options_value_type : int32 = RuntimeType.UNDEFINED 320 options_value_type = runtimeType(options_value) 321 if (TypeChecker.isRectShapeOptions(options_value, false)) { 322 thisSerializer.writeInt8(0 as int32) 323 const options_value_0 = options_value as RectShapeOptions 324 thisSerializer.writeRectShapeOptions(options_value_0) 325 } 326 else if (TypeChecker.isRoundRectShapeOptions(options_value, false, false)) { 327 thisSerializer.writeInt8(1 as int32) 328 const options_value_1 = options_value as RoundRectShapeOptions 329 thisSerializer.writeRoundRectShapeOptions(options_value_1) 330 } 331 } 332 const retval = ArkUIGeneratedNativeModule._RectShape_ctor(thisSerializer.asBuffer(), thisSerializer.length()) 333 thisSerializer.release() 334 return retval 335 } 336 constructor(options?: RectShapeOptions | RoundRectShapeOptions) { 337 const ctorPtr : KPointer = RectShape.ctor_rectshape(options) 338 this.peer = new Finalizable(ctorPtr, RectShape.getFinalizer()) 339 } 340 static getFinalizer(): KPointer { 341 return ArkUIGeneratedNativeModule._RectShape_getFinalizer() 342 } 343 public offset(offset: Position): RectShape { 344 const offset_casted = offset as (Position) 345 return this.offset_serialize(offset_casted) 346 } 347 public fill(color: ResourceColor): RectShape { 348 const color_casted = color as (ResourceColor) 349 return this.fill_serialize(color_casted) 350 } 351 public position(position: Position): RectShape { 352 const position_casted = position as (Position) 353 return this.position_serialize(position_casted) 354 } 355 public width(width: Length): RectShape { 356 const width_casted = width as (Length) 357 return this.width_serialize(width_casted) 358 } 359 public height(height: Length): RectShape { 360 const height_casted = height as (Length) 361 return this.height_serialize(height_casted) 362 } 363 public size(size: SizeOptions): RectShape { 364 const size_casted = size as (SizeOptions) 365 return this.size_serialize(size_casted) 366 } 367 public radiusWidth(rWidth: number | string): RectShape { 368 const rWidth_casted = rWidth as (number | string) 369 return this.radiusWidth_serialize(rWidth_casted) 370 } 371 public radiusHeight(rHeight: number | string): RectShape { 372 const rHeight_casted = rHeight as (number | string) 373 return this.radiusHeight_serialize(rHeight_casted) 374 } 375 public radius(radius: number | string | Array<number | string>): RectShape { 376 const radius_casted = radius as (number | string | Array<number | string>) 377 return this.radius_serialize(radius_casted) 378 } 379 private offset_serialize(offset: Position): RectShape { 380 const thisSerializer : Serializer = Serializer.hold() 381 thisSerializer.writePosition(offset) 382 const retval = ArkUIGeneratedNativeModule._RectShape_offset(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 383 thisSerializer.release() 384 const obj : RectShape = RectShapeInternal.fromPtr(retval) 385 return obj 386 } 387 private fill_serialize(color: ResourceColor): RectShape { 388 const thisSerializer : Serializer = Serializer.hold() 389 let color_type : int32 = RuntimeType.UNDEFINED 390 color_type = runtimeType(color) 391 if (TypeChecker.isColor(color)) { 392 thisSerializer.writeInt8(0 as int32) 393 const color_0 = color as Color 394 thisSerializer.writeInt32(TypeChecker.Color_ToNumeric(color_0)) 395 } 396 else if (RuntimeType.NUMBER == color_type) { 397 thisSerializer.writeInt8(1 as int32) 398 const color_1 = color as number 399 thisSerializer.writeNumber(color_1) 400 } 401 else if (RuntimeType.STRING == color_type) { 402 thisSerializer.writeInt8(2 as int32) 403 const color_2 = color as string 404 thisSerializer.writeString(color_2) 405 } 406 else if (RuntimeType.OBJECT == color_type) { 407 thisSerializer.writeInt8(3 as int32) 408 const color_3 = color as Resource 409 thisSerializer.writeResource(color_3) 410 } 411 const retval = ArkUIGeneratedNativeModule._RectShape_fill(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 412 thisSerializer.release() 413 const obj : RectShape = RectShapeInternal.fromPtr(retval) 414 return obj 415 } 416 private position_serialize(position: Position): RectShape { 417 const thisSerializer : Serializer = Serializer.hold() 418 thisSerializer.writePosition(position) 419 const retval = ArkUIGeneratedNativeModule._RectShape_position(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 420 thisSerializer.release() 421 const obj : RectShape = RectShapeInternal.fromPtr(retval) 422 return obj 423 } 424 private width_serialize(width: Length): RectShape { 425 const retval = ArkUIGeneratedNativeModule._RectShape_width(this.peer!.ptr, width) 426 const obj : RectShape = RectShapeInternal.fromPtr(retval) 427 return obj 428 } 429 private height_serialize(height: Length): RectShape { 430 const retval = ArkUIGeneratedNativeModule._RectShape_height(this.peer!.ptr, height) 431 const obj : RectShape = RectShapeInternal.fromPtr(retval) 432 return obj 433 } 434 private size_serialize(size: SizeOptions): RectShape { 435 const thisSerializer : Serializer = Serializer.hold() 436 thisSerializer.writeSizeOptions(size) 437 const retval = ArkUIGeneratedNativeModule._RectShape_size(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 438 thisSerializer.release() 439 const obj : RectShape = RectShapeInternal.fromPtr(retval) 440 return obj 441 } 442 private radiusWidth_serialize(rWidth: number | string): RectShape { 443 const thisSerializer : Serializer = Serializer.hold() 444 let rWidth_type : int32 = RuntimeType.UNDEFINED 445 rWidth_type = runtimeType(rWidth) 446 if (RuntimeType.NUMBER == rWidth_type) { 447 thisSerializer.writeInt8(0 as int32) 448 const rWidth_0 = rWidth as number 449 thisSerializer.writeNumber(rWidth_0) 450 } 451 else if (RuntimeType.STRING == rWidth_type) { 452 thisSerializer.writeInt8(1 as int32) 453 const rWidth_1 = rWidth as string 454 thisSerializer.writeString(rWidth_1) 455 } 456 const retval = ArkUIGeneratedNativeModule._RectShape_radiusWidth(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 457 thisSerializer.release() 458 const obj : RectShape = RectShapeInternal.fromPtr(retval) 459 return obj 460 } 461 private radiusHeight_serialize(rHeight: number | string): RectShape { 462 const thisSerializer : Serializer = Serializer.hold() 463 let rHeight_type : int32 = RuntimeType.UNDEFINED 464 rHeight_type = runtimeType(rHeight) 465 if (RuntimeType.NUMBER == rHeight_type) { 466 thisSerializer.writeInt8(0 as int32) 467 const rHeight_0 = rHeight as number 468 thisSerializer.writeNumber(rHeight_0) 469 } 470 else if (RuntimeType.STRING == rHeight_type) { 471 thisSerializer.writeInt8(1 as int32) 472 const rHeight_1 = rHeight as string 473 thisSerializer.writeString(rHeight_1) 474 } 475 const retval = ArkUIGeneratedNativeModule._RectShape_radiusHeight(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 476 thisSerializer.release() 477 const obj : RectShape = RectShapeInternal.fromPtr(retval) 478 return obj 479 } 480 private radius_serialize(radius: number | string | Array<number | string>): RectShape { 481 const thisSerializer : Serializer = Serializer.hold() 482 let radius_type : int32 = RuntimeType.UNDEFINED 483 radius_type = runtimeType(radius) 484 if (RuntimeType.NUMBER == radius_type) { 485 thisSerializer.writeInt8(0 as int32) 486 const radius_0 = radius as number 487 thisSerializer.writeNumber(radius_0) 488 } 489 else if (RuntimeType.STRING == radius_type) { 490 thisSerializer.writeInt8(1 as int32) 491 const radius_1 = radius as string 492 thisSerializer.writeString(radius_1) 493 } 494 else if (RuntimeType.OBJECT == radius_type) { 495 thisSerializer.writeInt8(2 as int32) 496 const radius_2 = radius as Array<number | string> 497 thisSerializer.writeInt32(radius_2.length as int32) 498 for (let i = 0; i < radius_2.length; i++) { 499 const radius_2_element : number | string = radius_2[i] 500 let radius_2_element_type : int32 = RuntimeType.UNDEFINED 501 radius_2_element_type = runtimeType(radius_2_element) 502 if (RuntimeType.NUMBER == radius_2_element_type) { 503 thisSerializer.writeInt8(0 as int32) 504 const radius_2_element_0 = radius_2_element as number 505 thisSerializer.writeNumber(radius_2_element_0) 506 } 507 else if (RuntimeType.STRING == radius_2_element_type) { 508 thisSerializer.writeInt8(1 as int32) 509 const radius_2_element_1 = radius_2_element as string 510 thisSerializer.writeString(radius_2_element_1) 511 } 512 } 513 } 514 const retval = ArkUIGeneratedNativeModule._RectShape_radius(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 515 thisSerializer.release() 516 const obj : RectShape = RectShapeInternal.fromPtr(retval) 517 return obj 518 } 519} 520export class CircleShapeInternal { 521 public static fromPtr(ptr: KPointer): CircleShape { 522 const obj : CircleShape = new CircleShape(undefined) 523 obj.peer = new Finalizable(ptr, CircleShape.getFinalizer()) 524 return obj 525 } 526} 527export class CircleShape implements MaterializedBase { 528 peer?: Finalizable | undefined = undefined 529 public getPeer(): Finalizable | undefined { 530 return this.peer 531 } 532 static ctor_circleshape(options?: ShapeSize): KPointer { 533 const thisSerializer : Serializer = Serializer.hold() 534 let options_type : int32 = RuntimeType.UNDEFINED 535 options_type = runtimeType(options) 536 thisSerializer.writeInt8(options_type as int32) 537 if ((RuntimeType.UNDEFINED) != (options_type)) { 538 const options_value = options! 539 thisSerializer.writeShapeSize(options_value) 540 } 541 const retval = ArkUIGeneratedNativeModule._CircleShape_ctor(thisSerializer.asBuffer(), thisSerializer.length()) 542 thisSerializer.release() 543 return retval 544 } 545 constructor(options?: ShapeSize) { 546 const ctorPtr : KPointer = CircleShape.ctor_circleshape(options) 547 this.peer = new Finalizable(ctorPtr, CircleShape.getFinalizer()) 548 } 549 static getFinalizer(): KPointer { 550 return ArkUIGeneratedNativeModule._CircleShape_getFinalizer() 551 } 552 public offset(offset: Position): CircleShape { 553 const offset_casted = offset as (Position) 554 return this.offset_serialize(offset_casted) 555 } 556 public fill(color: ResourceColor): CircleShape { 557 const color_casted = color as (ResourceColor) 558 return this.fill_serialize(color_casted) 559 } 560 public position(position: Position): CircleShape { 561 const position_casted = position as (Position) 562 return this.position_serialize(position_casted) 563 } 564 public width(width: Length): CircleShape { 565 const width_casted = width as (Length) 566 return this.width_serialize(width_casted) 567 } 568 public height(height: Length): CircleShape { 569 const height_casted = height as (Length) 570 return this.height_serialize(height_casted) 571 } 572 public size(size: SizeOptions): CircleShape { 573 const size_casted = size as (SizeOptions) 574 return this.size_serialize(size_casted) 575 } 576 private offset_serialize(offset: Position): CircleShape { 577 const thisSerializer : Serializer = Serializer.hold() 578 thisSerializer.writePosition(offset) 579 const retval = ArkUIGeneratedNativeModule._CircleShape_offset(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 580 thisSerializer.release() 581 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 582 return obj 583 } 584 private fill_serialize(color: ResourceColor): CircleShape { 585 const thisSerializer : Serializer = Serializer.hold() 586 let color_type : int32 = RuntimeType.UNDEFINED 587 color_type = runtimeType(color) 588 if (TypeChecker.isColor(color)) { 589 thisSerializer.writeInt8(0 as int32) 590 const color_0 = color as Color 591 thisSerializer.writeInt32(TypeChecker.Color_ToNumeric(color_0)) 592 } 593 else if (RuntimeType.NUMBER == color_type) { 594 thisSerializer.writeInt8(1 as int32) 595 const color_1 = color as number 596 thisSerializer.writeNumber(color_1) 597 } 598 else if (RuntimeType.STRING == color_type) { 599 thisSerializer.writeInt8(2 as int32) 600 const color_2 = color as string 601 thisSerializer.writeString(color_2) 602 } 603 else if (RuntimeType.OBJECT == color_type) { 604 thisSerializer.writeInt8(3 as int32) 605 const color_3 = color as Resource 606 thisSerializer.writeResource(color_3) 607 } 608 const retval = ArkUIGeneratedNativeModule._CircleShape_fill(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 609 thisSerializer.release() 610 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 611 return obj 612 } 613 private position_serialize(position: Position): CircleShape { 614 const thisSerializer : Serializer = Serializer.hold() 615 thisSerializer.writePosition(position) 616 const retval = ArkUIGeneratedNativeModule._CircleShape_position(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 617 thisSerializer.release() 618 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 619 return obj 620 } 621 private width_serialize(width: Length): CircleShape { 622 const retval = ArkUIGeneratedNativeModule._CircleShape_width(this.peer!.ptr, width) 623 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 624 return obj 625 } 626 private height_serialize(height: Length): CircleShape { 627 const retval = ArkUIGeneratedNativeModule._CircleShape_height(this.peer!.ptr, height) 628 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 629 return obj 630 } 631 private size_serialize(size: SizeOptions): CircleShape { 632 const thisSerializer : Serializer = Serializer.hold() 633 thisSerializer.writeSizeOptions(size) 634 const retval = ArkUIGeneratedNativeModule._CircleShape_size(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 635 thisSerializer.release() 636 const obj : CircleShape = CircleShapeInternal.fromPtr(retval) 637 return obj 638 } 639} 640export class EllipseShapeInternal { 641 public static fromPtr(ptr: KPointer): EllipseShape { 642 const obj : EllipseShape = new EllipseShape(undefined) 643 obj.peer = new Finalizable(ptr, EllipseShape.getFinalizer()) 644 return obj 645 } 646} 647export class EllipseShape implements MaterializedBase { 648 peer?: Finalizable | undefined = undefined 649 public getPeer(): Finalizable | undefined { 650 return this.peer 651 } 652 static ctor_ellipseshape(options?: ShapeSize): KPointer { 653 const thisSerializer : Serializer = Serializer.hold() 654 let options_type : int32 = RuntimeType.UNDEFINED 655 options_type = runtimeType(options) 656 thisSerializer.writeInt8(options_type as int32) 657 if ((RuntimeType.UNDEFINED) != (options_type)) { 658 const options_value = options! 659 thisSerializer.writeShapeSize(options_value) 660 } 661 const retval = ArkUIGeneratedNativeModule._EllipseShape_ctor(thisSerializer.asBuffer(), thisSerializer.length()) 662 thisSerializer.release() 663 return retval 664 } 665 constructor(options?: ShapeSize) { 666 const ctorPtr : KPointer = EllipseShape.ctor_ellipseshape(options) 667 this.peer = new Finalizable(ctorPtr, EllipseShape.getFinalizer()) 668 } 669 static getFinalizer(): KPointer { 670 return ArkUIGeneratedNativeModule._EllipseShape_getFinalizer() 671 } 672 public offset(offset: Position): EllipseShape { 673 const offset_casted = offset as (Position) 674 return this.offset_serialize(offset_casted) 675 } 676 public fill(color: ResourceColor): EllipseShape { 677 const color_casted = color as (ResourceColor) 678 return this.fill_serialize(color_casted) 679 } 680 public position(position: Position): EllipseShape { 681 const position_casted = position as (Position) 682 return this.position_serialize(position_casted) 683 } 684 public width(width: Length): EllipseShape { 685 const width_casted = width as (Length) 686 return this.width_serialize(width_casted) 687 } 688 public height(height: Length): EllipseShape { 689 const height_casted = height as (Length) 690 return this.height_serialize(height_casted) 691 } 692 public size(size: SizeOptions): EllipseShape { 693 const size_casted = size as (SizeOptions) 694 return this.size_serialize(size_casted) 695 } 696 private offset_serialize(offset: Position): EllipseShape { 697 const thisSerializer : Serializer = Serializer.hold() 698 thisSerializer.writePosition(offset) 699 const retval = ArkUIGeneratedNativeModule._EllipseShape_offset(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 700 thisSerializer.release() 701 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 702 return obj 703 } 704 private fill_serialize(color: ResourceColor): EllipseShape { 705 const thisSerializer : Serializer = Serializer.hold() 706 let color_type : int32 = RuntimeType.UNDEFINED 707 color_type = runtimeType(color) 708 if (TypeChecker.isColor(color)) { 709 thisSerializer.writeInt8(0 as int32) 710 const color_0 = color as Color 711 thisSerializer.writeInt32(TypeChecker.Color_ToNumeric(color_0)) 712 } 713 else if (RuntimeType.NUMBER == color_type) { 714 thisSerializer.writeInt8(1 as int32) 715 const color_1 = color as number 716 thisSerializer.writeNumber(color_1) 717 } 718 else if (RuntimeType.STRING == color_type) { 719 thisSerializer.writeInt8(2 as int32) 720 const color_2 = color as string 721 thisSerializer.writeString(color_2) 722 } 723 else if (RuntimeType.OBJECT == color_type) { 724 thisSerializer.writeInt8(3 as int32) 725 const color_3 = color as Resource 726 thisSerializer.writeResource(color_3) 727 } 728 const retval = ArkUIGeneratedNativeModule._EllipseShape_fill(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 729 thisSerializer.release() 730 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 731 return obj 732 } 733 private position_serialize(position: Position): EllipseShape { 734 const thisSerializer : Serializer = Serializer.hold() 735 thisSerializer.writePosition(position) 736 const retval = ArkUIGeneratedNativeModule._EllipseShape_position(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 737 thisSerializer.release() 738 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 739 return obj 740 } 741 private width_serialize(width: Length): EllipseShape { 742 const retval = ArkUIGeneratedNativeModule._EllipseShape_width(this.peer!.ptr, width) 743 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 744 return obj 745 } 746 private height_serialize(height: Length): EllipseShape { 747 const retval = ArkUIGeneratedNativeModule._EllipseShape_height(this.peer!.ptr, height) 748 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 749 return obj 750 } 751 private size_serialize(size: SizeOptions): EllipseShape { 752 const thisSerializer : Serializer = Serializer.hold() 753 thisSerializer.writeSizeOptions(size) 754 const retval = ArkUIGeneratedNativeModule._EllipseShape_size(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 755 thisSerializer.release() 756 const obj : EllipseShape = EllipseShapeInternal.fromPtr(retval) 757 return obj 758 } 759} 760export class PathShapeInternal { 761 public static fromPtr(ptr: KPointer): PathShape { 762 const obj : PathShape = new PathShape(undefined) 763 obj.peer = new Finalizable(ptr, PathShape.getFinalizer()) 764 return obj 765 } 766} 767export class PathShape implements MaterializedBase { 768 peer?: Finalizable | undefined = undefined 769 public getPeer(): Finalizable | undefined { 770 return this.peer 771 } 772 static ctor_pathshape(options?: PathShapeOptions): KPointer { 773 const thisSerializer : Serializer = Serializer.hold() 774 let options_type : int32 = RuntimeType.UNDEFINED 775 options_type = runtimeType(options) 776 thisSerializer.writeInt8(options_type as int32) 777 if ((RuntimeType.UNDEFINED) != (options_type)) { 778 const options_value = options! 779 thisSerializer.writePathShapeOptions(options_value) 780 } 781 const retval = ArkUIGeneratedNativeModule._PathShape_ctor(thisSerializer.asBuffer(), thisSerializer.length()) 782 thisSerializer.release() 783 return retval 784 } 785 constructor(options?: PathShapeOptions) { 786 const ctorPtr : KPointer = PathShape.ctor_pathshape(options) 787 this.peer = new Finalizable(ctorPtr, PathShape.getFinalizer()) 788 } 789 static getFinalizer(): KPointer { 790 return ArkUIGeneratedNativeModule._PathShape_getFinalizer() 791 } 792 public offset(offset: Position): PathShape { 793 const offset_casted = offset as (Position) 794 return this.offset_serialize(offset_casted) 795 } 796 public fill(color: ResourceColor): PathShape { 797 const color_casted = color as (ResourceColor) 798 return this.fill_serialize(color_casted) 799 } 800 public position(position: Position): PathShape { 801 const position_casted = position as (Position) 802 return this.position_serialize(position_casted) 803 } 804 public commands(commands: string): PathShape { 805 const commands_casted = commands as (string) 806 return this.commands_serialize(commands_casted) 807 } 808 private offset_serialize(offset: Position): PathShape { 809 const thisSerializer : Serializer = Serializer.hold() 810 thisSerializer.writePosition(offset) 811 const retval = ArkUIGeneratedNativeModule._PathShape_offset(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 812 thisSerializer.release() 813 const obj : PathShape = PathShapeInternal.fromPtr(retval) 814 return obj 815 } 816 private fill_serialize(color: ResourceColor): PathShape { 817 const thisSerializer : Serializer = Serializer.hold() 818 let color_type : int32 = RuntimeType.UNDEFINED 819 color_type = runtimeType(color) 820 if (TypeChecker.isColor(color)) { 821 thisSerializer.writeInt8(0 as int32) 822 const color_0 = color as Color 823 thisSerializer.writeInt32(TypeChecker.Color_ToNumeric(color_0)) 824 } 825 else if (RuntimeType.NUMBER == color_type) { 826 thisSerializer.writeInt8(1 as int32) 827 const color_1 = color as number 828 thisSerializer.writeNumber(color_1) 829 } 830 else if (RuntimeType.STRING == color_type) { 831 thisSerializer.writeInt8(2 as int32) 832 const color_2 = color as string 833 thisSerializer.writeString(color_2) 834 } 835 else if (RuntimeType.OBJECT == color_type) { 836 thisSerializer.writeInt8(3 as int32) 837 const color_3 = color as Resource 838 thisSerializer.writeResource(color_3) 839 } 840 const retval = ArkUIGeneratedNativeModule._PathShape_fill(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 841 thisSerializer.release() 842 const obj : PathShape = PathShapeInternal.fromPtr(retval) 843 return obj 844 } 845 private position_serialize(position: Position): PathShape { 846 const thisSerializer : Serializer = Serializer.hold() 847 thisSerializer.writePosition(position) 848 const retval = ArkUIGeneratedNativeModule._PathShape_position(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) 849 thisSerializer.release() 850 const obj : PathShape = PathShapeInternal.fromPtr(retval) 851 return obj 852 } 853 private commands_serialize(commands: string): PathShape { 854 const retval = ArkUIGeneratedNativeModule._PathShape_commands(this.peer!.ptr, commands) 855 const obj : PathShape = PathShapeInternal.fromPtr(retval) 856 return obj 857 } 858} 859export class GlobalScope_ohos_font { 860 public static registerFont(options: FontOptions): void { 861 const options_casted = options as (FontOptions) 862 GlobalScope_ohos_font.registerFont_serialize(options_casted) 863 return 864 } 865 public static getSystemFontList(): Array<string> { 866 return GlobalScope_ohos_font.getSystemFontList_serialize() 867 } 868 public static getFontByName(fontName: string): FontInfo { 869 const fontName_casted = fontName as (string) 870 return GlobalScope_ohos_font.getFontByName_serialize(fontName_casted) 871 } 872 private static registerFont_serialize(options: FontOptions): void { 873 const thisSerializer : Serializer = Serializer.hold() 874 thisSerializer.writeFontOptions(options) 875 ArkUIGeneratedNativeModule._GlobalScope_ohos_font_registerFont(thisSerializer.asBuffer(), thisSerializer.length()) 876 thisSerializer.release() 877 } 878 private static getSystemFontList_serialize(): Array<string> { 879 const retval = ArkUIGeneratedNativeModule._GlobalScope_ohos_font_getSystemFontList() 880 let retvalDeserializer : Deserializer = new Deserializer(retval, retval.length as int32) 881 const buffer_length : int32 = retvalDeserializer.readInt32() 882 let buffer : Array<string> = new Array<string>(buffer_length) 883 for (let buffer_i = 0; buffer_i < buffer_length; buffer_i++) { 884 buffer[buffer_i] = (retvalDeserializer.readString() as string) 885 } 886 const returnResult : Array<string> = buffer 887 return returnResult 888 } 889 private static getFontByName_serialize(fontName: string): FontInfo { 890 const retval = ArkUIGeneratedNativeModule._GlobalScope_ohos_font_getFontByName(fontName) 891 let retvalDeserializer : Deserializer = new Deserializer(retval, retval.length as int32) 892 const returnResult : FontInfo = retvalDeserializer.readFontInfo() 893 return returnResult 894 } 895} 896export class GlobalScope_ohos_measure_utils { 897 public static measureText(options: MeasureOptions): number { 898 const options_casted = options as (MeasureOptions) 899 return GlobalScope_ohos_measure_utils.measureText_serialize(options_casted) 900 } 901 public static measureTextSize(options: MeasureOptions): SizeOptions { 902 const options_casted = options as (MeasureOptions) 903 return GlobalScope_ohos_measure_utils.measureTextSize_serialize(options_casted) 904 } 905 private static measureText_serialize(options: MeasureOptions): number { 906 const thisSerializer : Serializer = Serializer.hold() 907 thisSerializer.writeMeasureOptions(options) 908 const retval = ArkUIGeneratedNativeModule._GlobalScope_ohos_measure_utils_measureText(thisSerializer.asBuffer(), thisSerializer.length()) 909 thisSerializer.release() 910 return retval 911 } 912 private static measureTextSize_serialize(options: MeasureOptions): SizeOptions { 913 const thisSerializer : Serializer = Serializer.hold() 914 thisSerializer.writeMeasureOptions(options) 915 // @ts-ignore 916 const retval = ArkUIGeneratedNativeModule._GlobalScope_ohos_measure_utils_measureTextSize(thisSerializer.asBuffer(), thisSerializer.length()) as FixedArray<byte> 917 thisSerializer.release() 918 // @ts-ignore 919 let exactRetValue: byte[] = new Array<byte> 920 for (let i = 0; i < retval.length; i++) { 921 // @ts-ignore 922 exactRetValue.push(new Byte(retval[i])) 923 } 924 let retvalDeserializer : Deserializer = new Deserializer(exactRetValue, exactRetValue.length as int32) 925 const returnResult : SizeOptions = retvalDeserializer.readSizeOptions() 926 return returnResult 927 } 928} 929export interface TextModifier { 930} 931export enum RectWidthStyle { 932 TIGHT = 0, 933 MAX = 1 934} 935export enum RectHeightStyle { 936 TIGHT = 0, 937 MAX = 1, 938 INCLUDE_LINE_SPACE_MIDDLE = 2, 939 INCLUDE_LINE_SPACE_TOP = 3, 940 INCLUDE_LINE_SPACE_BOTTOM = 4, 941 STRUT = 5 942} 943export interface WebHeader { 944 headerKey: string; 945 headerValue: string; 946} 947export interface SnapshotOptions { 948 scale?: number; 949 waitUntilRenderFinished?: boolean; 950} 951export type AsyncCallback_image_PixelMap_Void = (result: PixelMap) => void; 952export enum PerfMonitorActionType { 953 LAST_DOWN = 0, 954 LAST_UP = 1, 955 FIRST_MOVE = 2 956} 957export enum PerfMonitorSourceType { 958 PERF_TOUCH_EVENT = 0, 959 PERF_MOUSE_EVENT = 1, 960 PERF_TOUCHPAD_EVENT = 2, 961 PERF_JOYSTICK_EVENT = 3, 962 PERF_KEY_EVENT = 4 963} 964export interface ShapeSize { 965 width?: number | string; 966 height?: number | string; 967} 968export interface RectShapeOptions extends ShapeSize { 969 radius?: number | string | Array<number | string>; 970} 971export interface RoundRectShapeOptions extends ShapeSize { 972 radiusWidth?: number | string; 973 radiusHeight?: number | string; 974} 975export interface PathShapeOptions { 976 commands?: string; 977} 978export interface Summary { 979 summary: Map<string, int64>; 980 totalSize: int64; 981} 982export type ReceiveCallback = (data: Map<string, Object>) => void; 983export enum ResolutionQuality { 984 LOW = 1, 985 MEDIUM = 2, 986 HIGH = 3 987} 988export type ImageMatrix = Matrix4Transit; 989export enum IntentionCode { 990 INTENTION_UNKNOWN = -1, 991 INTENTION_UP = 1, 992 INTENTION_DOWN = 2, 993 INTENTION_LEFT = 3, 994 INTENTION_RIGHT = 4, 995 INTENTION_SELECT = 5, 996 INTENTION_ESCAPE = 6, 997 INTENTION_BACK = 7, 998 INTENTION_FORWARD = 8, 999 INTENTION_MENU = 9, 1000 INTENTION_PAGE_UP = 11, 1001 INTENTION_PAGE_DOWN = 12, 1002 INTENTION_ZOOM_OUT = 13, 1003 INTENTION_ZOOM_IN = 14 1004} 1005export enum WindowStatusType { 1006 UNDEFINED = 0, 1007 FULL_SCREEN = 1, 1008 MAXIMIZE = 2, 1009 MINIMIZE = 3, 1010 FLOATING = 4, 1011 SPLIT_SCREEN = 5 1012} 1013export interface ImageModifier { 1014} 1015export interface SymbolGlyphModifier { 1016} 1017export interface IndicatorStyle { 1018 height?: Length; 1019 width?: Length; 1020 borderRadius?: Length; 1021 marginTop?: Length; 1022 color?: ResourceColor; 1023 selectedColor?: ResourceColor; 1024 left?: Length; 1025 top?: Length; 1026 right?: Length; 1027 bottom?: Length; 1028 size?: Length; 1029 mask?: boolean; 1030} 1031export interface LabelStyle { 1032 overflow?: TextOverflow; 1033 maxLines?: number; 1034 minFontSize?: number | ResourceStr; 1035 maxFontSize?: number | ResourceStr; 1036 heightAdaptivePolicy?: TextHeightAdaptivePolicy; 1037 font?: Font; 1038 selectedColor?: ResourceColor; 1039 unselectedColor?: ResourceColor; 1040} 1041