• 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 ImageMatrixModifier extends ModifierWithKey<object> {
299  constructor(value: object) {
300    super(value);
301  }
302  static identity: Symbol = Symbol('imageMatrix');
303  applyPeer(node: KNode, reset: boolean): void {
304    if (reset) {
305      getUINativeModule().image.resetImageMatrix(node);
306    } else {
307      getUINativeModule().image.setImageMatrix(node, (this.value as Matrix).matrix4x4);
308    }
309  }
310  checkObjectDiff(): boolean {
311    return !deepCompareArrays((this.stageValue as Matrix).matrix4x4, (this.value as Matrix).matrix4x4);
312  }
313}
314class ImageBorderRadiusModifier extends ModifierWithKey<Length | BorderRadiuses> {
315  constructor(value: Length | BorderRadiuses) {
316    super(value);
317  }
318  static identity: Symbol = Symbol('imageBorderRadius');
319  applyPeer(node: KNode, reset: boolean): void {
320    if (reset) {
321      getUINativeModule().image.resetBorderRadius(node);
322    } else {
323      if (isNumber(this.value) || isString(this.value) || isResource(this.value)) {
324        getUINativeModule().image.setBorderRadius(node, this.value, this.value, this.value, this.value);
325      } else {
326        let keys = Object.keys(this.value);
327        if (keys.indexOf('topStart') >= 0 || keys.indexOf('topEnd') >= 0 ||
328          keys.indexOf('bottomStart') >= 0 || keys.indexOf('bottomEnd') >= 0) {
329            let localizedBorderRadius = this.value as LocalizedBorderRadiuses;
330            getUINativeModule().image.setBorderRadius(node, localizedBorderRadius.topStart,
331              localizedBorderRadius.topEnd, localizedBorderRadius.bottomStart,
332              localizedBorderRadius.bottomEnd);
333        } else {
334          let borderRadius = this.value as BorderRadiuses;
335          getUINativeModule().image.setBorderRadius(node,
336            borderRadius.topLeft, borderRadius.topRight,
337            borderRadius.bottomLeft, borderRadius.bottomRight);
338        }
339      }
340    }
341  }
342
343  checkObjectDiff(): boolean {
344    if (isResource(this.stageValue) && isResource(this.value)) {
345      return !isResourceEqual(this.stageValue, this.value);
346    } else if (!isResource(this.stageValue) && !isResource(this.value)) {
347      return !((this.stageValue as BorderRadiuses).topLeft === (this.value as BorderRadiuses).topLeft &&
348        (this.stageValue as BorderRadiuses).topRight === (this.value as BorderRadiuses).topRight &&
349        (this.stageValue as BorderRadiuses).bottomLeft === (this.value as BorderRadiuses).bottomLeft &&
350        (this.stageValue as BorderRadiuses).bottomRight === (this.value as BorderRadiuses).bottomRight);
351    } else {
352      return true;
353    }
354  }
355}
356class ImageBorderModifier extends ModifierWithKey<BorderOptions> {
357  constructor(value: BorderOptions) {
358    super(value);
359  }
360  static identity: Symbol = Symbol('imageBorder');
361  applyPeer(node: KNode, reset: boolean): void {
362    if (reset) {
363      getUINativeModule().image.resetImageBorder(node);
364    } else {
365      let widthLeft;
366      let widthRight;
367      let widthTop;
368      let widthBottom;
369      if (!isUndefined(this.value.width) && this.value.width !== null) {
370        if (isNumber(this.value.width) || isString(this.value.width) || isResource(this.value.width)) {
371          widthLeft = this.value.width;
372          widthRight = this.value.width;
373          widthTop = this.value.width;
374          widthBottom = this.value.width;
375        } else {
376          widthLeft = (this.value.width as EdgeWidths).left;
377          widthRight = (this.value.width as EdgeWidths).right;
378          widthTop = (this.value.width as EdgeWidths).top;
379          widthBottom = (this.value.width as EdgeWidths).bottom;
380        }
381      }
382      let leftColor;
383      let rightColor;
384      let topColor;
385      let bottomColor;
386      if (!isUndefined(this.value.color) && this.value.color !== null) {
387        if (isNumber(this.value.color) || isString(this.value.color) || isResource(this.value.color)) {
388          leftColor = this.value.color;
389          rightColor = this.value.color;
390          topColor = this.value.color;
391          bottomColor = this.value.color;
392        } else {
393          leftColor = (this.value.color as EdgeColors).left;
394          rightColor = (this.value.color as EdgeColors).right;
395          topColor = (this.value.color as EdgeColors).top;
396          bottomColor = (this.value.color as EdgeColors).bottom;
397        }
398      }
399      let topLeft;
400      let topRight;
401      let bottomLeft;
402      let bottomRight;
403      if (!isUndefined(this.value.radius) && this.value.radius !== null) {
404        if (isNumber(this.value.radius) || isString(this.value.radius) || isResource(this.value.radius)) {
405          topLeft = this.value.radius;
406          topRight = this.value.radius;
407          bottomLeft = this.value.radius;
408          bottomRight = this.value.radius;
409        } else {
410          topLeft = (this.value.radius as BorderRadiuses).topLeft;
411          topRight = (this.value.radius as BorderRadiuses).topRight;
412          bottomLeft = (this.value.radius as BorderRadiuses).bottomLeft;
413          bottomRight = (this.value.radius as BorderRadiuses).bottomRight;
414        }
415      }
416      let styleTop;
417      let styleRight;
418      let styleBottom;
419      let styleLeft;
420      if (!isUndefined(this.value.style) && this.value.style != null) {
421        if (isNumber(this.value.style) || isString(this.value.style) || isResource(this.value.style)) {
422          styleTop = this.value.style;
423          styleRight = this.value.style;
424          styleBottom = this.value.style;
425          styleLeft = this.value.style;
426        } else {
427          styleTop = (this.value.style as EdgeStyles).top;
428          styleRight = (this.value.style as EdgeStyles).right;
429          styleBottom = (this.value.style as EdgeStyles).bottom;
430          styleLeft = (this.value.style as EdgeStyles).left;
431        }
432      }
433      getUINativeModule().image.setImageBorder(
434        node,
435        widthLeft,
436        widthRight,
437        widthTop,
438        widthBottom,
439        leftColor,
440        rightColor,
441        topColor,
442        bottomColor,
443        topLeft,
444        topRight,
445        bottomLeft,
446        bottomRight,
447        styleTop,
448        styleRight,
449        styleBottom,
450        styleLeft
451      );
452    }
453  }
454
455  checkObjectDiff(): boolean {
456    return (
457      !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
458      !isBaseOrResourceEqual(this.stageValue.color, this.value.color) ||
459      !isBaseOrResourceEqual(this.stageValue.radius, this.value.radius) ||
460      !isBaseOrResourceEqual(this.stageValue.style, this.value.style)
461    );
462  }
463}
464
465class ImageOpacityModifier extends ModifierWithKey<number | Resource> {
466  constructor(value: number | Resource) {
467    super(value);
468  }
469  static identity: Symbol = Symbol('imageOpacity');
470  applyPeer(node: KNode, reset: boolean): void {
471    if (reset) {
472      getUINativeModule().image.resetImageOpacity(node);
473    } else {
474      getUINativeModule().image.setImageOpacity(node, this.value);
475    }
476  }
477
478  checkObjectDiff(): boolean {
479    return !isBaseOrResourceEqual(this.stageValue, this.value);
480  }
481}
482
483class ImageTransitionModifier extends ModifierWithKey<object> {
484  constructor(value: object) {
485    super(value);
486  }
487  static identity: Symbol = Symbol('imageTransition');
488  applyPeer(node: KNode, reset: boolean): void {
489    if (reset) {
490      getUINativeModule().image.resetImageTransition(node);
491    } else {
492      getUINativeModule().image.setImageTransition(node, this.value);
493    }
494  }
495}
496
497class ImageSrcModifier extends ModifierWithKey<ResourceStr | PixelMap | DrawableDescriptor | ImageContent> {
498  constructor(value: ResourceStr | PixelMap | DrawableDescriptor | ImageContent) {
499    super(value);
500  }
501  static identity: Symbol = Symbol('imageShowSrc');
502  applyPeer(node: KNode, reset: boolean): void {
503    if (reset) {
504      getUINativeModule().image.setImageShowSrc(node, '');
505    }
506    else {
507      getUINativeModule().image.setImageShowSrc(node, this.value);
508    }
509  }
510}
511
512class ImageEnableAnalyzerModifier extends ModifierWithKey<boolean> {
513  constructor(value: boolean) {
514    super(value);
515  }
516  static identity: Symbol = Symbol('enableAnalyzer');
517  applyPeer(node: KNode, reset: boolean): void {
518    if (reset) {
519      getUINativeModule().image.enableAnalyzer(node);
520    } else {
521      getUINativeModule().image.enableAnalyzer(node, this.value!);
522    }
523  }
524}
525
526class ImagePrivacySensitiveModifier extends ModifierWithKey<boolean> {
527  constructor(value: boolean) {
528    super(value);
529  }
530  static identity: Symbol = Symbol('imagePrivacySensitive');
531  applyPeer(node: KNode, reset: boolean): void {
532    if (reset) {
533      getUINativeModule().image.resetPrivacySensitive(node);
534    } else {
535      getUINativeModule().image.setPrivacySensitive(node, this.value!);
536    }
537  }
538  checkObjectDiff(): boolean {
539    return !isBaseOrResourceEqual(this.stageValue, this.value);
540  }
541}
542
543class ImageAnalyzerConfigModifier extends ModifierWithKey<object> {
544  constructor(value: object) {
545    super(value);
546  }
547  static identity: Symbol = Symbol('analyzerConfig');
548  applyPeer(node: KNode, reset: boolean): void {
549    if (reset) {
550      getUINativeModule().image.analyzerConfig(node, '');
551    } else {
552      getUINativeModule().image.analyzerConfig(node, this.value!);
553    }
554  }
555}
556
557class ImageOnErrorModifier extends ModifierWithKey<(result: {componentWidth: number; componentHeight: number; message: string}) => void> {
558    constructor(value: (event: {componentWidth: number; componentHeight: number; message: string}) => void) {
559    super(value);
560  }
561  static identity = Symbol('imageOnError');
562  applyPeer(node: KNode, reset: boolean): void {
563    if (reset) {
564      getUINativeModule().image.resetOnError(node);
565    } else {
566      getUINativeModule().image.setOnError(node, this.value);
567    }
568  }
569}
570
571class ImageOnFinishModifier extends ModifierWithKey<VoidCallback> {
572    constructor(value: VoidCallback) {
573    super(value);
574  }
575  static identity: Symbol = Symbol('imageOnFinish');
576  applyPeer(node: KNode, reset: boolean): void {
577    if (reset) {
578      getUINativeModule().image.resetOnFinish(node);
579    } else {
580      getUINativeModule().image.setOnFinish(node, this.value);
581    }
582  }
583}
584
585class ImageRotateOrientationModifier extends ModifierWithKey<ImageRotateOrientation> {
586  static identity: Symbol = Symbol('imageOrientation');
587  applyPeer(node: KNode, reset: boolean): void {
588    if (reset) {
589      getUINativeModule().image.resetOrientation(node);
590    } else {
591      getUINativeModule().image.setOrientation(node);
592    }
593  }
594}
595
596class ImagePointLightModifier extends ModifierWithKey<PointLightStyle> {
597  constructor(value: PointLightStyle) {
598    super(value);
599  }
600  static identity: Symbol = Symbol('imagePointLight');
601  applyPeer(node: KNode, reset: boolean): void {
602    if (reset) {
603      getUINativeModule().common.resetPointLightStyle(node);
604    } else {
605      let positionX: Dimension | undefined;
606      let positionY: Dimension | undefined;
607      let positionZ: Dimension | undefined;
608      let intensity: number | undefined;
609      let color: ResourceColor | undefined;
610      let illuminated: number | undefined;
611      let bloom: number | undefined;
612      if (!isUndefined(this.value.lightSource) && this.value.lightSource != null) {
613        positionX = this.value.lightSource.positionX;
614        positionY = this.value.lightSource.positionY;
615        positionZ = this.value.lightSource.positionZ;
616        intensity = this.value.lightSource.intensity;
617        color = this.value.lightSource.color;
618      }
619      illuminated = this.value.illuminated;
620      bloom = this.value.bloom;
621      getUINativeModule().common.setPointLightStyle(node, positionX, positionY, positionZ, intensity, color,
622        illuminated, bloom);
623    }
624  }
625  checkObjectDiff(): boolean {
626    return !isBaseOrResourceEqual(this.stageValue.lightSource?.positionX, this.value.lightSource?.positionX) ||
627    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionY, this.value.lightSource?.positionY) ||
628    !isBaseOrResourceEqual(this.stageValue.lightSource?.positionZ, this.value.lightSource?.positionZ) ||
629    !isBaseOrResourceEqual(this.stageValue.lightSource?.intensity, this.value.lightSource?.intensity) ||
630    !isBaseOrResourceEqual(this.stageValue.lightSource?.color, this.value.lightSource?.color) ||
631    !isBaseOrResourceEqual(this.stageValue.illuminated, this.value.illuminated) ||
632    !isBaseOrResourceEqual(this.stageValue.bloom, this.value.bloom);
633  }
634}
635class ImageOnCompleteModifier extends ModifierWithKey<(event?: {
636  width: number;
637  height: number;
638  componentWidth: number;
639  componentHeight: number;
640  loadingStatus: number;
641  contentWidth: number;
642  contentHeight: number;
643  contentOffsetX: number;
644  contentOffsetY: number;
645}) => void> {
646  constructor(value: (event?: {
647    width: number;
648    height: number;
649    componentWidth: number;
650    componentHeight: number;
651    loadingStatus: number;
652    contentWidth: number;
653    contentHeight: number;
654    contentOffsetX: number;
655    contentOffsetY: number;
656  }) => void) {
657    super(value);
658  }
659  static identity = Symbol('imageOnComplete');
660  applyPeer(node: KNode, reset: boolean): void {
661    if (reset) {
662      getUINativeModule().image.resetOnComplete(node);
663    } else {
664      getUINativeModule().image.setOnComplete(node, this.value);
665    }
666  }
667}
668class ArkImageComponent extends ArkComponent implements ImageAttribute {
669  constructor(nativePtr: KNode, classType?: ModifierType) {
670    super(nativePtr, classType);
671  }
672  initialize(value: Object[]): this {
673    modifierWithKey(this._modifiersWithKeys, ImageSrcModifier.identity, ImageSrcModifier, value[0]);
674    return this;
675  }
676  allowChildCount(): number {
677    return 0;
678  }
679  draggable(value: boolean): this {
680    modifierWithKey(this._modifiersWithKeys, ImageDraggableModifier.identity, ImageDraggableModifier, value);
681    return this;
682  }
683  edgeAntialiasing(value: number): this {
684    modifierWithKey(this._modifiersWithKeys, ImageEdgeAntialiasingModifier.identity, ImageEdgeAntialiasingModifier, value);
685    return this;
686  }
687  alt(value: ResourceStr): this {
688    modifierWithKey(this._modifiersWithKeys, ImageAltModifier.identity, ImageAltModifier, value);
689    return this;
690  }
691  matchTextDirection(value: boolean): this {
692    modifierWithKey(this._modifiersWithKeys, ImageMatchTextDirectionModifier.identity, ImageMatchTextDirectionModifier, value);
693    return this;
694  }
695  fitOriginalSize(value: boolean): this {
696    modifierWithKey(this._modifiersWithKeys, ImageFitOriginalSizeModifier.identity, ImageFitOriginalSizeModifier, value);
697    return this;
698  }
699  pointLight(value: PointLightStyle): this {
700    modifierWithKey(this._modifiersWithKeys, ImagePointLightModifier.identity, ImagePointLightModifier, value);
701    return this;
702  }
703  fillColor(value: ResourceColor): this {
704    modifierWithKey(this._modifiersWithKeys, ImageFillColorModifier.identity,
705      ImageFillColorModifier, value);
706    return this;
707  }
708  objectFit(value: ImageFit): this {
709    modifierWithKey(this._modifiersWithKeys, ImageObjectFitModifier.identity,
710      ImageObjectFitModifier, value);
711    return this;
712  }
713  imageMatrix(value: object): this {
714    modifierWithKey(this._modifiersWithKeys, ImageMatrixModifier.identity, ImageMatrixModifier, value);
715    return this;
716  }
717  objectRepeat(value: ImageRepeat): this {
718    modifierWithKey(this._modifiersWithKeys, ImageObjectRepeatModifier.identity,
719      ImageObjectRepeatModifier, value);
720    return this;
721  }
722  autoResize(value: boolean): this {
723    modifierWithKey(this._modifiersWithKeys, ImageAutoResizeModifier.identity,
724      ImageAutoResizeModifier, value);
725    return this;
726  }
727  renderMode(value: ImageRenderMode): this {
728    modifierWithKey(this._modifiersWithKeys, ImageRenderModeModifier.identity,
729      ImageRenderModeModifier, value);
730    return this;
731  }
732  interpolation(value: ImageInterpolation): this {
733    modifierWithKey(this._modifiersWithKeys, ImageInterpolationModifier.identity,
734      ImageInterpolationModifier, value);
735    return this;
736  }
737  sourceSize(value: { width: number; height: number }): this {
738    modifierWithKey(this._modifiersWithKeys, ImageSourceSizeModifier.identity,
739      ImageSourceSizeModifier, value);
740    return this;
741  }
742  syncLoad(value: boolean): this {
743    modifierWithKey(this._modifiersWithKeys, ImageSyncLoadModifier.identity,
744      ImageSyncLoadModifier, value);
745    return this;
746  }
747
748  colorFilter(value: ColorFilter | DrawingColorFilter): this {
749    modifierWithKey(this._modifiersWithKeys, ImageColorFilterModifier.identity,
750      ImageColorFilterModifier, value);
751    return this;
752  }
753  copyOption(value: CopyOptions): this {
754    modifierWithKey(this._modifiersWithKeys, ImageCopyOptionModifier.identity,
755      ImageCopyOptionModifier, value);
756    return this;
757  }
758  borderRadius(value: Length | BorderRadiuses): this {
759    modifierWithKey(this._modifiersWithKeys, ImageBorderRadiusModifier.identity, ImageBorderRadiusModifier, value);
760    return this;
761  }
762  onComplete(
763    callback: (event?: {
764      width: number;
765      height: number;
766      componentWidth: number;
767      componentHeight: number;
768      loadingStatus: number;
769      contentWidth: number;
770      contentHeight: number;
771      contentOffsetX: number;
772      contentOffsetY: number;
773    }) => void,
774  ): this {
775    modifierWithKey(this._modifiersWithKeys, ImageOnCompleteModifier.identity, ImageOnCompleteModifier, callback);
776    return this;
777  }
778  onError(callback: (event: {
779    componentWidth: number;
780    componentHeight: number;
781    message: string
782  }) => void): this {
783    modifierWithKey(this._modifiersWithKeys, ImageOnErrorModifier.identity, ImageOnErrorModifier, callback);
784    return this;
785  }
786  onFinish(event: () => void): this {
787    modifierWithKey(this._modifiersWithKeys, ImageOnFinishModifier.identity, ImageOnFinishModifier, event);
788    return this;
789  }
790  border(value: BorderOptions): this {
791    modifierWithKey(this._modifiersWithKeys, ImageBorderModifier.identity, ImageBorderModifier, value);
792    return this;
793  }
794  opacity(value: number | Resource): this {
795    modifierWithKey(this._modifiersWithKeys, ImageOpacityModifier.identity, ImageOpacityModifier, value);
796    return this;
797  }
798  transition(value: TransitionOptions | TransitionEffect): this {
799    modifierWithKey(this._modifiersWithKeys, ImageTransitionModifier.identity, ImageTransitionModifier, value);
800    return this;
801  }
802  dynamicRangeMode(value: DynamicRangeMode): this {
803    modifierWithKey(
804      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
805    return this;
806  }
807  orientation(value: ImageRotateOrientaion): this {
808    modifierWithKey(
809    this._modifiersWithKeys, ImageRotateOrientationModifier.identity, ImageRotateOrientationModifier, value);
810    return this;
811  }
812  enhancedImageQuality(value: ResolutionQuality): this {
813    modifierWithKey(
814      this._modifiersWithKeys, ImageDynamicRangeModeModifier.identity, ImageDynamicRangeModeModifier, value);
815    return this;
816  }
817  enableAnalyzer(value: boolean): this {
818    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
819    return this;
820  }
821  privacySensitive(value: boolean): this {
822    modifierWithKey(this._modifiersWithKeys, ImageEnableAnalyzerModifier.identity, ImageEnableAnalyzerModifier, value);
823    return this;
824  }
825  analyzerConfig(value: object): this {
826    modifierWithKey(this._modifiersWithKeys, ImageAnalyzerConfigModifier.identity, ImageAnalyzerConfigModifier, value);
827    return this;
828  }
829}
830// @ts-ignore
831globalThis.Image.attributeModifier = function (modifier: ArkComponent): void {
832  attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => {
833    return new ArkImageComponent(nativePtr);
834  }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => {
835    return new modifierJS.ImageModifier(nativePtr, classType);
836  });
837};
838