• 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 ImagePointLightModifier extends ModifierWithKey<PointLightStyle> {
570  constructor(value: PointLightStyle) {
571    super(value);
572  }
573  static identity: Symbol = Symbol('imagePointLight');
574  applyPeer(node: KNode, reset: boolean): void {
575    if (reset) {
576      getUINativeModule().common.resetPointLightStyle(node);
577    } else {
578      let positionX: Dimension | undefined;
579      let positionY: Dimension | undefined;
580      let positionZ: Dimension | undefined;
581      let intensity: number | undefined;
582      let color: ResourceColor | undefined;
583      let illuminated: number | undefined;
584      let bloom: number | undefined;
585      if (!isUndefined(this.value.lightSource) && this.value.lightSource != null) {
586        positionX = this.value.lightSource.positionX;
587        positionY = this.value.lightSource.positionY;
588        positionZ = this.value.lightSource.positionZ;
589        intensity = this.value.lightSource.intensity;
590        color = this.value.lightSource.color;
591      }
592      illuminated = this.value.illuminated;
593      bloom = this.value.bloom;
594      getUINativeModule().common.setPointLightStyle(node, positionX, positionY, positionZ, intensity, color,
595        illuminated, bloom);
596    }
597  }
598  checkObjectDiff(): boolean {
599    return !isBaseOrResourceEqual(this.stageValue.lightSource?.positionX, this.value.lightSource?.positionX) ||
600    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionY, this.value.lightSource?.positionY) ||
601    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionZ, this.value.lightSource?.positionZ) ||
602    !isBaseOrResourceEqual(this.stageValue.lightSource?.intensity, this.value.lightSource?.intensity) ||
603    !isBaseOrResourceEqual(this.stageValue.lightSource?.color, this.value.lightSource?.color) ||
604    !isBaseOrResourceEqual(this.stageValue.illuminated, this.value.illuminated) ||
605    !isBaseOrResourceEqual(this.stageValue.bloom, this.value.bloom);
606  }
607}
608class ImageOnCompleteModifier extends ModifierWithKey<(event?: {
609  width: number;
610  height: number;
611  componentWidth: number;
612  componentHeight: number;
613  loadingStatus: number;
614  contentWidth: number;
615  contentHeight: number;
616  contentOffsetX: number;
617  contentOffsetY: number;
618}) => void> {
619  constructor(value: (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    super(value);
631  }
632  static identity = Symbol('imageOnComplete');
633  applyPeer(node: KNode, reset: boolean): void {
634    if (reset) {
635      getUINativeModule().image.resetOnComplete(node);
636    } else {
637      getUINativeModule().image.setOnComplete(node, this.value);
638    }
639  }
640}
641class ArkImageComponent extends ArkComponent implements ImageAttribute {
642  constructor(nativePtr: KNode, classType?: ModifierType) {
643    super(nativePtr, classType);
644  }
645  initialize(value: Object[]): this {
646    modifierWithKey(this._modifiersWithKeys, ImageSrcModifier.identity, ImageSrcModifier, value[0]);
647    return this;
648  }
649  allowChildCount(): number {
650    return 0;
651  }
652  draggable(value: boolean): this {
653    modifierWithKey(this._modifiersWithKeys, ImageDraggableModifier.identity, ImageDraggableModifier, value);
654    return this;
655  }
656  edgeAntialiasing(value: number): this {
657    modifierWithKey(this._modifiersWithKeys, ImageEdgeAntialiasingModifier.identity, ImageEdgeAntialiasingModifier, value);
658    return this;
659  }
660  alt(value: ResourceStr): this {
661    modifierWithKey(this._modifiersWithKeys, ImageAltModifier.identity, ImageAltModifier, value);
662    return this;
663  }
664  matchTextDirection(value: boolean): this {
665    modifierWithKey(this._modifiersWithKeys, ImageMatchTextDirectionModifier.identity, ImageMatchTextDirectionModifier, value);
666    return this;
667  }
668  fitOriginalSize(value: boolean): this {
669    modifierWithKey(this._modifiersWithKeys, ImageFitOriginalSizeModifier.identity, ImageFitOriginalSizeModifier, value);
670    return this;
671  }
672  pointLight(value: PointLightStyle): this {
673    modifierWithKey(this._modifiersWithKeys, ImagePointLightModifier.identity, ImagePointLightModifier, value);
674    return this;
675  }
676  fillColor(value: ResourceColor): this {
677    modifierWithKey(this._modifiersWithKeys, ImageFillColorModifier.identity,
678      ImageFillColorModifier, value);
679    return this;
680  }
681  objectFit(value: ImageFit): this {
682    modifierWithKey(this._modifiersWithKeys, ImageObjectFitModifier.identity,
683      ImageObjectFitModifier, value);
684    return this;
685  }
686  objectRepeat(value: ImageRepeat): this {
687    modifierWithKey(this._modifiersWithKeys, ImageObjectRepeatModifier.identity,
688      ImageObjectRepeatModifier, value);
689    return this;
690  }
691  autoResize(value: boolean): this {
692    modifierWithKey(this._modifiersWithKeys, ImageAutoResizeModifier.identity,
693      ImageAutoResizeModifier, value);
694    return this;
695  }
696  renderMode(value: ImageRenderMode): this {
697    modifierWithKey(this._modifiersWithKeys, ImageRenderModeModifier.identity,
698      ImageRenderModeModifier, value);
699    return this;
700  }
701  interpolation(value: ImageInterpolation): this {
702    modifierWithKey(this._modifiersWithKeys, ImageInterpolationModifier.identity,
703      ImageInterpolationModifier, value);
704    return this;
705  }
706  sourceSize(value: { width: number; height: number }): this {
707    modifierWithKey(this._modifiersWithKeys, ImageSourceSizeModifier.identity,
708      ImageSourceSizeModifier, value);
709    return this;
710  }
711  syncLoad(value: boolean): this {
712    modifierWithKey(this._modifiersWithKeys, ImageSyncLoadModifier.identity,
713      ImageSyncLoadModifier, value);
714    return this;
715  }
716
717  colorFilter(value: ColorFilter | DrawingColorFilter): this {
718    modifierWithKey(this._modifiersWithKeys, ImageColorFilterModifier.identity,
719      ImageColorFilterModifier, value);
720    return this;
721  }
722  copyOption(value: CopyOptions): this {
723    modifierWithKey(this._modifiersWithKeys, ImageCopyOptionModifier.identity,
724      ImageCopyOptionModifier, value);
725    return this;
726  }
727  borderRadius(value: Length | BorderRadiuses): this {
728    modifierWithKey(this._modifiersWithKeys, ImageBorderRadiusModifier.identity, ImageBorderRadiusModifier, value);
729    return this;
730  }
731  onComplete(
732    callback: (event?: {
733      width: number;
734      height: number;
735      componentWidth: number;
736      componentHeight: number;
737      loadingStatus: number;
738      contentWidth: number;
739      contentHeight: number;
740      contentOffsetX: number;
741      contentOffsetY: number;
742    }) => void,
743  ): this {
744    modifierWithKey(this._modifiersWithKeys, ImageOnCompleteModifier.identity, ImageOnCompleteModifier, callback);
745    return this;
746  }
747  onError(callback: (event: {
748    componentWidth: number;
749    componentHeight: number;
750    message: string
751  }) => void): this {
752    modifierWithKey(this._modifiersWithKeys, ImageOnErrorModifier.identity, ImageOnErrorModifier, callback);
753    return this;
754  }
755  onFinish(event: () => void): this {
756    modifierWithKey(this._modifiersWithKeys, ImageOnFinishModifier.identity, ImageOnFinishModifier, event);
757    return this;
758  }
759  border(value: BorderOptions): this {
760    modifierWithKey(this._modifiersWithKeys, ImageBorderModifier.identity, ImageBorderModifier, value);
761    return this;
762  }
763  opacity(value: number | Resource): this {
764    modifierWithKey(this._modifiersWithKeys, ImageOpacityModifier.identity, ImageOpacityModifier, value);
765    return this;
766  }
767  transition(value: TransitionOptions | TransitionEffect): this {
768    modifierWithKey(this._modifiersWithKeys, ImageTransitionModifier.identity, ImageTransitionModifier, value);
769    return this;
770  }
771  dynamicRangeMode(value: DynamicRangeMode): this {
772    modifierWithKey(
773      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
774    return this;
775  }
776  enhancedImageQuality(value: ResolutionQuality): this {
777    modifierWithKey(
778      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
779    return this;
780  }
781  enableAnalyzer(value: boolean): this {
782    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
783    return this;
784  }
785  privacySensitive(value: boolean): this {
786    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
787    return this;
788  }
789  analyzerConfig(value: object): this {
790    modifierWithKey(this._modifiersWithKeys, ImageAnalyzerConfigModifier.identity, ImageAnalyzerConfigModifier, value);
791    return this;
792  }
793}
794// @ts-ignore
795globalThis.Image.attributeModifier = function (modifier: ArkComponent): void {
796  attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => {
797    return new ArkImageComponent(nativePtr);
798  }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => {
799    return new modifierJS.ImageModifier(nativePtr, classType);
800  });
801};
802