• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/// <reference path='./import.ts' />
17class ImageColorFilterModifier extends ModifierWithKey<ColorFilter | DrawingColorFilter> {
18  constructor(value: ColorFilter) {
19    super(value);
20  }
21  static identity: Symbol = Symbol('imageColorFilter');
22  applyPeer(node: KNode, reset: boolean): void {
23    if (reset) {
24      getUINativeModule().image.resetColorFilter(node);
25    } else {
26      getUINativeModule().image.setColorFilter(node, this.value!);
27    }
28  }
29  checkObjectDiff(): boolean {
30    return true;
31  }
32}
33
34class ImageFillColorModifier extends ModifierWithKey<ResourceColor> {
35  static identity: Symbol = Symbol('imageFillColor');
36  applyPeer(node: KNode, reset: boolean): void {
37    if (reset) {
38      getUINativeModule().image.resetFillColor(node);
39    } else {
40      getUINativeModule().image.setFillColor(node, this.value!);
41    }
42  }
43  checkObjectDiff(): boolean {
44    return !isBaseOrResourceEqual(this.stageValue, this.value);
45  }
46}
47
48class ImageAltModifier extends ModifierWithKey<ResourceStr> {
49  static identity: Symbol = Symbol('imageAlt');
50  applyPeer(node: KNode, reset: boolean): void {
51    if (reset) {
52      getUINativeModule().image.resetAlt(node);
53    } else {
54      getUINativeModule().image.setAlt(node, this.value!);
55    }
56  }
57  checkObjectDiff(): boolean {
58    return !isBaseOrResourceEqual(this.stageValue, this.value);
59  }
60}
61
62class ImageCopyOptionModifier extends ModifierWithKey<CopyOptions> {
63  static identity: Symbol = Symbol('imageCopyOption');
64  applyPeer(node: KNode, reset: boolean): void {
65    if (reset) {
66      getUINativeModule().image.resetCopyOption(node);
67    } else {
68      getUINativeModule().image.setCopyOption(node, this.value!);
69    }
70  }
71  checkObjectDiff(): boolean {
72    return this.stageValue !== this.value;
73  }
74}
75
76class ImageAutoResizeModifier extends ModifierWithKey<boolean> {
77  static identity: Symbol = Symbol('imageAutoResize');
78  applyPeer(node: KNode, reset: boolean): void {
79    if (reset) {
80      getUINativeModule().image.resetAutoResize(node);
81    } else {
82      getUINativeModule().image.setAutoResize(node, this.value!);
83    }
84  }
85  checkObjectDiff(): boolean {
86    return this.stageValue !== this.value;
87  }
88}
89
90class ImageFitOriginalSizeModifier extends ModifierWithKey<boolean> {
91  static identity: Symbol = Symbol('imageFitOriginalSize');
92  applyPeer(node: KNode, reset: boolean): void {
93    if (reset) {
94      getUINativeModule().image.resetFitOriginalSize(node);
95    } else {
96      getUINativeModule().image.setFitOriginalSize(node, this.value!);
97    }
98  }
99  checkObjectDiff(): boolean {
100    return this.stageValue !== this.value;
101  }
102}
103
104class ImageDraggableModifier extends ModifierWithKey<boolean> {
105  static identity: Symbol = Symbol('imageDraggable');
106  applyPeer(node: KNode, reset: boolean): void {
107    if (reset) {
108      getUINativeModule().image.resetDraggable(node);
109    } else {
110      getUINativeModule().image.setDraggable(node, this.value!);
111    }
112  }
113  checkObjectDiff(): boolean {
114    return this.stageValue !== this.value;
115  }
116}
117
118class ImageEdgeAntialiasingModifier extends ModifierWithKey<number> {
119  constructor(value: number) {
120    super(value);
121  }
122  static identity: Symbol = Symbol('edgeAntialiasing');
123  applyPeer(node: KNode, reset: boolean): void {
124    if (reset) {
125      getUINativeModule().image.resetSourceSize(node);
126    } else {
127      getUINativeModule().image.setSourceSize(node, this.value);
128    }
129  }
130  checkObjectDiff(): boolean {
131    return this.stageValue !== this.value;
132  }
133}
134
135class ImageResizableModifier extends ModifierWithKey<ResizableOptions> {
136  constructor(value: ResizableOptions) {
137    super(value);
138  }
139  static identity: Symbol = Symbol('resizable');
140  applyPeer(node: KNode, reset: boolean): void {
141    if (reset) {
142      getUINativeModule().image.resetResizable(node);
143    } else {
144      if (!isUndefined(this.value.lattice)) {
145        getUINativeModule().image.setResizableLattice(node, this.value.lattice);
146      }
147      if (!isUndefined(this.value.slice)) {
148        let sliceTop: Length | undefined;
149        let sliceRight: Length | undefined;
150        let sliceBottom: Length | undefined;
151        let sliceLeft: Length | undefined;
152        let tmpSlice = this.value.slice as EdgeWidths;
153        sliceTop = tmpSlice.top;
154        sliceRight = tmpSlice.right;
155        sliceBottom = tmpSlice.bottom;
156        sliceLeft = tmpSlice.left;
157        getUINativeModule().image.setResizable(node, sliceTop, sliceRight, sliceBottom, sliceLeft);
158      }
159    }
160  }
161}
162
163class ImageDynamicRangeModeModifier extends ModifierWithKey<DynamicRangeMode> {
164  constructor(value: DynamicRangeMode) {
165    super(value);
166  }
167  static identity: Symbol = Symbol('dynamicRangeMode');
168  applyPeer(node: KNode, reset: boolean): void {
169    if (reset) {
170      getUINativeModule().image.resetDynamicRangeMode(node);
171    } else {
172      getUINativeModule().image.setDynamicRangeMode(node, this.value!);
173    }
174  }
175  checkObjectDiff(): boolean {
176    return this.stageValue !== this.value;
177  }
178}
179
180class ImageEnhancedImageQualityModifier extends ModifierWithKey<AIImageQuality> {
181  constructor(value: ResolutionQuality) {
182    super(value);
183  }
184  static identity: Symbol = Symbol('enhancedImageQuality');
185  applyPeer(node: KNode, reset: boolean): void {
186    if (reset) {
187      getUINativeModule().image.resetEnhancedImageQuality(node);
188    } else {
189      getUINativeModule().image.setEnhancedImageQuality(node, this.value!);
190    }
191  }
192  checkObjectDiff(): boolean {
193    return this.stageValue !== this.value;
194  }
195}
196
197class ImageInterpolationModifier extends ModifierWithKey<ImageInterpolation> {
198  static identity: Symbol = Symbol('imageInterpolation');
199  applyPeer(node: KNode, reset: boolean): void {
200    if (reset) {
201      getUINativeModule().image.resetImageInterpolation(node);
202    } else {
203      getUINativeModule().image.setImageInterpolation(node, this.value!);
204    }
205  }
206  checkObjectDiff(): boolean {
207    return this.stageValue !== this.value;
208  }
209}
210
211class ImageSourceSizeModifier extends ModifierWithKey<{ width: number; height: number }> {
212  constructor(value: { width: number; height: number }) {
213    super(value);
214  }
215  static identity: Symbol = Symbol('imageSourceSize');
216  applyPeer(node: KNode, reset: boolean): void {
217    if (reset) {
218      getUINativeModule().image.resetSourceSize(node);
219    } else {
220      getUINativeModule().image.setSourceSize(node, this.value.width, this.value.height);
221    }
222  }
223  checkObjectDiff(): boolean {
224    return this.stageValue.width !== this.value.width ||
225      this.stageValue.height !== this.value.height;
226  }
227}
228
229class ImageMatchTextDirectionModifier extends ModifierWithKey<boolean> {
230  static identity: Symbol = Symbol('imageMatchTextDirection');
231  applyPeer(node: KNode, reset: boolean): void {
232    if (reset) {
233      getUINativeModule().image.resetMatchTextDirection(node);
234    } else {
235      getUINativeModule().image.setMatchTextDirection(node, this.value!);
236    }
237  }
238  checkObjectDiff(): boolean {
239    return this.stageValue !== this.value;
240  }
241}
242
243class ImageObjectRepeatModifier extends ModifierWithKey<ImageRepeat> {
244  static identity: Symbol = Symbol('imageObjectRepeat');
245  applyPeer(node: KNode, reset: boolean): void {
246    if (reset) {
247      getUINativeModule().image.resetObjectRepeat(node);
248    } else {
249      getUINativeModule().image.setObjectRepeat(node, this.value!);
250    }
251  }
252  checkObjectDiff(): boolean {
253    return this.stageValue !== this.value;
254  }
255}
256
257class ImageRenderModeModifier extends ModifierWithKey<ImageRenderMode> {
258  static identity: Symbol = Symbol('imageRenderMode');
259  applyPeer(node: KNode, reset: boolean): void {
260    if (reset) {
261      getUINativeModule().image.resetRenderMode(node);
262    } else {
263      getUINativeModule().image.setRenderMode(node, this.value!);
264    }
265  }
266  checkObjectDiff(): boolean {
267    return this.stageValue !== this.value;
268  }
269}
270
271class ImageSyncLoadModifier extends ModifierWithKey<boolean> {
272  static identity: Symbol = Symbol('imageSyncLoad');
273  applyPeer(node: KNode, reset: boolean): void {
274    if (reset) {
275      getUINativeModule().image.resetSyncLoad(node);
276    } else {
277      getUINativeModule().image.setSyncLoad(node, this.value!);
278    }
279  }
280  checkObjectDiff(): boolean {
281    return this.stageValue !== this.value;
282  }
283}
284
285class ImageObjectFitModifier extends ModifierWithKey<ImageFit> {
286  static identity: Symbol = Symbol('imageObjectFit');
287  applyPeer(node: KNode, reset: boolean): void {
288    if (reset) {
289      getUINativeModule().image.resetObjectFit(node);
290    } else {
291      getUINativeModule().image.setObjectFit(node, this.value!);
292    }
293  }
294  checkObjectDiff(): boolean {
295    return this.stageValue !== this.value;
296  }
297}
298class ImageBorderRadiusModifier extends ModifierWithKey<Length | BorderRadiuses> {
299  constructor(value: Length | BorderRadiuses) {
300    super(value);
301  }
302  static identity: Symbol = Symbol('imageBorderRadius');
303  applyPeer(node: KNode, reset: boolean): void {
304    if (reset) {
305      getUINativeModule().image.resetBorderRadius(node);
306    } else {
307      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
308        getUINativeModule().image.setBorderRadius(node, this.value, this.value, this.value, this.value);
309      } else {
310        let keys = Object.keys(this.value);
311        if (keys.indexOf('topStart') >= 0 || keys.indexOf('topEnd') >= 0 ||
312          keys.indexOf('bottomStart') >= 0 || keys.indexOf('bottomEnd') >= 0) {
313            let localizedBorderRadius = this.value as LocalizedBorderRadiuses;
314            getUINativeModule().image.setBorderRadius(node, localizedBorderRadius.topStart,
315              localizedBorderRadius.topEnd, localizedBorderRadius.bottomStart,
316              localizedBorderRadius.bottomEnd);
317        } else {
318          let borderRadius = this.value as BorderRadiuses;
319          getUINativeModule().image.setBorderRadius(node,
320            borderRadius.topLeft, borderRadius.topRight,
321            borderRadius.bottomLeft, borderRadius.bottomRight);
322        }
323      }
324    }
325  }
326
327  checkObjectDiff(): boolean {
328    if (isResource(this.stageValue) && isResource(this.value)) {
329      return !isResourceEqual(this.stageValue, this.value);
330    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
331      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
332        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
333        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
334        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
335    } else {
336      return true;
337    }
338  }
339}
340class ImageBorderModifier extends ModifierWithKey<BorderOptions> {
341  constructor(value: BorderOptions) {
342    super(value);
343  }
344  static identity: Symbol = Symbol('imageBorder');
345  applyPeer(node: KNode, reset: boolean): void {
346    if (reset) {
347      getUINativeModule().image.resetImageBorder(node);
348    } else {
349      let widthLeft;
350      let widthRight;
351      let widthTop;
352      let widthBottom;
353      if (!isUndefined(this.value.width) && this.value.width !== null) {
354        if (isNumber(this.value.width) || isString(this.value.width) || isResource(this.value.width)) {
355          widthLeft = this.value.width;
356          widthRight = this.value.width;
357          widthTop = this.value.width;
358          widthBottom = this.value.width;
359        } else {
360          widthLeft = (this.value.width as EdgeWidths).left;
361          widthRight = (this.value.width as EdgeWidths).right;
362          widthTop = (this.value.width as EdgeWidths).top;
363          widthBottom = (this.value.width as EdgeWidths).bottom;
364        }
365      }
366      let leftColor;
367      let rightColor;
368      let topColor;
369      let bottomColor;
370      if (!isUndefined(this.value.color) && this.value.color !== null) {
371        if (isNumber(this.value.color) || isString(this.value.color) || isResource(this.value.color)) {
372          leftColor = this.value.color;
373          rightColor = this.value.color;
374          topColor = this.value.color;
375          bottomColor = this.value.color;
376        } else {
377          leftColor = (this.value.color as EdgeColors).left;
378          rightColor = (this.value.color as EdgeColors).right;
379          topColor = (this.value.color as EdgeColors).top;
380          bottomColor = (this.value.color as EdgeColors).bottom;
381        }
382      }
383      let topLeft;
384      let topRight;
385      let bottomLeft;
386      let bottomRight;
387      if (!isUndefined(this.value.radius) && this.value.radius !== null) {
388        if (isNumber(this.value.radius) || isString(this.value.radius) || isResource(this.value.radius)) {
389          topLeft = this.value.radius;
390          topRight = this.value.radius;
391          bottomLeft = this.value.radius;
392          bottomRight = this.value.radius;
393        } else {
394          topLeft = (this.value.radius as BorderRadiuses).topLeft;
395          topRight = (this.value.radius as BorderRadiuses).topRight;
396          bottomLeft = (this.value.radius as BorderRadiuses).bottomLeft;
397          bottomRight = (this.value.radius as BorderRadiuses).bottomRight;
398        }
399      }
400      let styleTop;
401      let styleRight;
402      let styleBottom;
403      let styleLeft;
404      if (!isUndefined(this.value.style) && this.value.style != null) {
405        if (isNumber(this.value.style) || isString(this.value.style) || isResource(this.value.style)) {
406          styleTop = this.value.style;
407          styleRight = this.value.style;
408          styleBottom = this.value.style;
409          styleLeft = this.value.style;
410        } else {
411          styleTop = (this.value.style as EdgeStyles).top;
412          styleRight = (this.value.style as EdgeStyles).right;
413          styleBottom = (this.value.style as EdgeStyles).bottom;
414          styleLeft = (this.value.style as EdgeStyles).left;
415        }
416      }
417      getUINativeModule().image.setImageBorder(
418        node,
419        widthLeft,
420        widthRight,
421        widthTop,
422        widthBottom,
423        leftColor,
424        rightColor,
425        topColor,
426        bottomColor,
427        topLeft,
428        topRight,
429        bottomLeft,
430        bottomRight,
431        styleTop,
432        styleRight,
433        styleBottom,
434        styleLeft
435      );
436    }
437  }
438
439  checkObjectDiff(): boolean {
440    return (
441      !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
442      !isBaseOrResourceEqual(this.stageValue.color, this.value.color) ||
443      !isBaseOrResourceEqual(this.stageValue.radius, this.value.radius) ||
444      !isBaseOrResourceEqual(this.stageValue.style, this.value.style)
445    );
446  }
447}
448
449class ImageOpacityModifier extends ModifierWithKey<number | Resource> {
450  constructor(value: number | Resource) {
451    super(value);
452  }
453  static identity: Symbol = Symbol('imageOpacity');
454  applyPeer(node: KNode, reset: boolean): void {
455    if (reset) {
456      getUINativeModule().image.resetImageOpacity(node);
457    } else {
458      getUINativeModule().image.setImageOpacity(node, this.value);
459    }
460  }
461
462  checkObjectDiff(): boolean {
463    return !isBaseOrResourceEqual(this.stageValue, this.value);
464  }
465}
466
467class ImageTransitionModifier extends ModifierWithKey<object> {
468  constructor(value: object) {
469    super(value);
470  }
471  static identity: Symbol = Symbol('imageTransition');
472  applyPeer(node: KNode, reset: boolean): void {
473    if (reset) {
474      getUINativeModule().image.resetImageTransition(node);
475    } else {
476      getUINativeModule().image.setImageTransition(node, this.value);
477    }
478  }
479}
480
481class ImageSrcModifier extends ModifierWithKey<ResourceStr | PixelMap | DrawableDescriptor | ImageContent> {
482  constructor(value: ResourceStr | PixelMap | DrawableDescriptor | ImageContent) {
483    super(value);
484  }
485  static identity: Symbol = Symbol('imageShowSrc');
486  applyPeer(node: KNode, reset: boolean): void {
487    if (reset) {
488      getUINativeModule().image.setImageShowSrc(node, '');
489    }
490    else {
491      getUINativeModule().image.setImageShowSrc(node, this.value);
492    }
493  }
494}
495
496class ImageEnableAnalyzerModifier extends ModifierWithKey<boolean> {
497  constructor(value: boolean) {
498    super(value);
499  }
500  static identity: Symbol = Symbol('enableAnalyzer');
501  applyPeer(node: KNode, reset: boolean): void {
502    if (reset) {
503      getUINativeModule().image.enableAnalyzer(node);
504    } else {
505      getUINativeModule().image.enableAnalyzer(node, this.value!);
506    }
507  }
508}
509
510class ImagePrivacySensitiveModifier extends ModifierWithKey<boolean> {
511  constructor(value: boolean) {
512    super(value);
513  }
514  static identity: Symbol = Symbol('imagePrivacySensitive');
515  applyPeer(node: KNode, reset: boolean): void {
516    if (reset) {
517      getUINativeModule().image.resetPrivacySensitive(node);
518    } else {
519      getUINativeModule().image.setPrivacySensitive(node, this.value!);
520    }
521  }
522  checkObjectDiff(): boolean {
523    return !isBaseOrResourceEqual(this.stageValue, this.value);
524  }
525}
526
527class ImageAnalyzerConfigModifier extends ModifierWithKey<object> {
528  constructor(value: object) {
529    super(value);
530  }
531  static identity: Symbol = Symbol('analyzerConfig');
532  applyPeer(node: KNode, reset: boolean): void {
533    if (reset) {
534      getUINativeModule().image.analyzerConfig(node, '');
535    } else {
536      getUINativeModule().image.analyzerConfig(node, this.value!);
537    }
538  }
539}
540
541class ImageOnErrorModifier extends ModifierWithKey<(result: {componentWidth: number; componentHeight: number; message: string}) => void> {
542    constructor(value: (event: {componentWidth: number; componentHeight: number; message: string}) => void) {
543    super(value);
544  }
545  static identity = Symbol('imageOnError');
546  applyPeer(node: KNode, reset: boolean): void {
547    if (reset) {
548      getUINativeModule().image.resetOnError(node);
549    } else {
550      getUINativeModule().image.setOnError(node, this.value);
551    }
552  }
553}
554
555class ImageOnFinishModifier extends ModifierWithKey<VoidCallback> {
556    constructor(value: VoidCallback) {
557    super(value);
558  }
559  static identity: Symbol = Symbol('imageOnFinish');
560  applyPeer(node: KNode, reset: boolean): void {
561    if (reset) {
562      getUINativeModule().image.resetOnFinish(node);
563    } else {
564      getUINativeModule().image.setOnFinish(node, this.value);
565    }
566  }
567}
568
569class ImageRotateOrientationModifier extends ModifierWithKey<ImageRotateOrientation> {
570  static identity: Symbol = Symbol('imageOrientation');
571  applyPeer(node: KNode, reset: boolean): void {
572    if (reset) {
573      getUINativeModule().image.resetOrientation(node);
574    } else {
575      getUINativeModule().image.setOrientation(node);
576    }
577  }
578}
579
580class ImagePointLightModifier extends ModifierWithKey<PointLightStyle> {
581  constructor(value: PointLightStyle) {
582    super(value);
583  }
584  static identity: Symbol = Symbol('imagePointLight');
585  applyPeer(node: KNode, reset: boolean): void {
586    if (reset) {
587      getUINativeModule().common.resetPointLightStyle(node);
588    } else {
589      let positionX: Dimension | undefined;
590      let positionY: Dimension | undefined;
591      let positionZ: Dimension | undefined;
592      let intensity: number | undefined;
593      let color: ResourceColor | undefined;
594      let illuminated: number | undefined;
595      let bloom: number | undefined;
596      if (!isUndefined(this.value.lightSource) && this.value.lightSource != null) {
597        positionX = this.value.lightSource.positionX;
598        positionY = this.value.lightSource.positionY;
599        positionZ = this.value.lightSource.positionZ;
600        intensity = this.value.lightSource.intensity;
601        color = this.value.lightSource.color;
602      }
603      illuminated = this.value.illuminated;
604      bloom = this.value.bloom;
605      getUINativeModule().common.setPointLightStyle(node, positionX, positionY, positionZ, intensity, color,
606        illuminated, bloom);
607    }
608  }
609  checkObjectDiff(): boolean {
610    return !isBaseOrResourceEqual(this.stageValue.lightSource?.positionX, this.value.lightSource?.positionX) ||
611    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionY, this.value.lightSource?.positionY) ||
612    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionZ, this.value.lightSource?.positionZ) ||
613    !isBaseOrResourceEqual(this.stageValue.lightSource?.intensity, this.value.lightSource?.intensity) ||
614    !isBaseOrResourceEqual(this.stageValue.lightSource?.color, this.value.lightSource?.color) ||
615    !isBaseOrResourceEqual(this.stageValue.illuminated, this.value.illuminated) ||
616    !isBaseOrResourceEqual(this.stageValue.bloom, this.value.bloom);
617  }
618}
619class ImageOnCompleteModifier extends ModifierWithKey<(event?: {
620  width: number;
621  height: number;
622  componentWidth: number;
623  componentHeight: number;
624  loadingStatus: number;
625  contentWidth: number;
626  contentHeight: number;
627  contentOffsetX: number;
628  contentOffsetY: number;
629}) => void> {
630  constructor(value: (event?: {
631    width: number;
632    height: number;
633    componentWidth: number;
634    componentHeight: number;
635    loadingStatus: number;
636    contentWidth: number;
637    contentHeight: number;
638    contentOffsetX: number;
639    contentOffsetY: number;
640  }) => void) {
641    super(value);
642  }
643  static identity = Symbol('imageOnComplete');
644  applyPeer(node: KNode, reset: boolean): void {
645    if (reset) {
646      getUINativeModule().image.resetOnComplete(node);
647    } else {
648      getUINativeModule().image.setOnComplete(node, this.value);
649    }
650  }
651}
652class ArkImageComponent extends ArkComponent implements ImageAttribute {
653  constructor(nativePtr: KNode, classType?: ModifierType) {
654    super(nativePtr, classType);
655  }
656  initialize(value: Object[]): this {
657    modifierWithKey(this._modifiersWithKeys, ImageSrcModifier.identity, ImageSrcModifier, value[0]);
658    return this;
659  }
660  allowChildCount(): number {
661    return 0;
662  }
663  draggable(value: boolean): this {
664    modifierWithKey(this._modifiersWithKeys, ImageDraggableModifier.identity, ImageDraggableModifier, value);
665    return this;
666  }
667  edgeAntialiasing(value: number): this {
668    modifierWithKey(this._modifiersWithKeys, ImageEdgeAntialiasingModifier.identity, ImageEdgeAntialiasingModifier, value);
669    return this;
670  }
671  alt(value: ResourceStr): this {
672    modifierWithKey(this._modifiersWithKeys, ImageAltModifier.identity, ImageAltModifier, value);
673    return this;
674  }
675  matchTextDirection(value: boolean): this {
676    modifierWithKey(this._modifiersWithKeys, ImageMatchTextDirectionModifier.identity, ImageMatchTextDirectionModifier, value);
677    return this;
678  }
679  fitOriginalSize(value: boolean): this {
680    modifierWithKey(this._modifiersWithKeys, ImageFitOriginalSizeModifier.identity, ImageFitOriginalSizeModifier, value);
681    return this;
682  }
683  pointLight(value: PointLightStyle): this {
684    modifierWithKey(this._modifiersWithKeys, ImagePointLightModifier.identity, ImagePointLightModifier, value);
685    return this;
686  }
687  fillColor(value: ResourceColor): this {
688    modifierWithKey(this._modifiersWithKeys, ImageFillColorModifier.identity,
689      ImageFillColorModifier, value);
690    return this;
691  }
692  objectFit(value: ImageFit): this {
693    modifierWithKey(this._modifiersWithKeys, ImageObjectFitModifier.identity,
694      ImageObjectFitModifier, value);
695    return this;
696  }
697  objectRepeat(value: ImageRepeat): this {
698    modifierWithKey(this._modifiersWithKeys, ImageObjectRepeatModifier.identity,
699      ImageObjectRepeatModifier, value);
700    return this;
701  }
702  autoResize(value: boolean): this {
703    modifierWithKey(this._modifiersWithKeys, ImageAutoResizeModifier.identity,
704      ImageAutoResizeModifier, value);
705    return this;
706  }
707  renderMode(value: ImageRenderMode): this {
708    modifierWithKey(this._modifiersWithKeys, ImageRenderModeModifier.identity,
709      ImageRenderModeModifier, value);
710    return this;
711  }
712  interpolation(value: ImageInterpolation): this {
713    modifierWithKey(this._modifiersWithKeys, ImageInterpolationModifier.identity,
714      ImageInterpolationModifier, value);
715    return this;
716  }
717  sourceSize(value: { width: number; height: number }): this {
718    modifierWithKey(this._modifiersWithKeys, ImageSourceSizeModifier.identity,
719      ImageSourceSizeModifier, value);
720    return this;
721  }
722  syncLoad(value: boolean): this {
723    modifierWithKey(this._modifiersWithKeys, ImageSyncLoadModifier.identity,
724      ImageSyncLoadModifier, value);
725    return this;
726  }
727
728  colorFilter(value: ColorFilter | DrawingColorFilter): this {
729    modifierWithKey(this._modifiersWithKeys, ImageColorFilterModifier.identity,
730      ImageColorFilterModifier, value);
731    return this;
732  }
733  copyOption(value: CopyOptions): this {
734    modifierWithKey(this._modifiersWithKeys, ImageCopyOptionModifier.identity,
735      ImageCopyOptionModifier, value);
736    return this;
737  }
738  borderRadius(value: Length | BorderRadiuses): this {
739    modifierWithKey(this._modifiersWithKeys, ImageBorderRadiusModifier.identity, ImageBorderRadiusModifier, value);
740    return this;
741  }
742  onComplete(
743    callback: (event?: {
744      width: number;
745      height: number;
746      componentWidth: number;
747      componentHeight: number;
748      loadingStatus: number;
749      contentWidth: number;
750      contentHeight: number;
751      contentOffsetX: number;
752      contentOffsetY: number;
753    }) => void,
754  ): this {
755    modifierWithKey(this._modifiersWithKeys, ImageOnCompleteModifier.identity, ImageOnCompleteModifier, callback);
756    return this;
757  }
758  onError(callback: (event: {
759    componentWidth: number;
760    componentHeight: number;
761    message: string
762  }) => void): this {
763    modifierWithKey(this._modifiersWithKeys, ImageOnErrorModifier.identity, ImageOnErrorModifier, callback);
764    return this;
765  }
766  onFinish(event: () => void): this {
767    modifierWithKey(this._modifiersWithKeys, ImageOnFinishModifier.identity, ImageOnFinishModifier, event);
768    return this;
769  }
770  border(value: BorderOptions): this {
771    modifierWithKey(this._modifiersWithKeys, ImageBorderModifier.identity, ImageBorderModifier, value);
772    return this;
773  }
774  opacity(value: number | Resource): this {
775    modifierWithKey(this._modifiersWithKeys, ImageOpacityModifier.identity, ImageOpacityModifier, value);
776    return this;
777  }
778  transition(value: TransitionOptions | TransitionEffect): this {
779    modifierWithKey(this._modifiersWithKeys, ImageTransitionModifier.identity, ImageTransitionModifier, value);
780    return this;
781  }
782  dynamicRangeMode(value: DynamicRangeMode): this {
783    modifierWithKey(
784      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
785    return this;
786  }
787  orientation(value: ImageRotateOrientaion): this {
788    modifierWithKey(
789    this._modifiersWithKeys, ImageRotateOrientationModifier.identity, ImageRotateOrientationModifier, value);
790    return this;
791  }
792  enhancedImageQuality(value: ResolutionQuality): this {
793    modifierWithKey(
794      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
795    return this;
796  }
797  enableAnalyzer(value: boolean): this {
798    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
799    return this;
800  }
801  privacySensitive(value: boolean): this {
802    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
803    return this;
804  }
805  analyzerConfig(value: object): this {
806    modifierWithKey(this._modifiersWithKeys, ImageAnalyzerConfigModifier.identity, ImageAnalyzerConfigModifier, value);
807    return this;
808  }
809}
810// @ts-ignore
811globalThis.Image.attributeModifier = function (modifier: ArkComponent): void {
812  attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => {
813    return new ArkImageComponent(nativePtr);
814  }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => {
815    return new modifierJS.ImageModifier(nativePtr, classType);
816  });
817};
818