• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_IMAGE_IMAGE_PATTERN_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_IMAGE_IMAGE_PATTERN_H
18 
19 #include <memory>
20 
21 #include "interfaces/inner_api/ace/ai/image_analyzer.h"
22 
23 #include "base/geometry/offset.h"
24 #include "base/image/drawable_descriptor.h"
25 #include "base/image/image_defines.h"
26 #include "base/image/pixel_map.h"
27 #include "base/memory/referenced.h"
28 #include "core/animation/picture_animation.h"
29 #include "core/common/clipboard/clipboard.h"
30 #include "core/components/common/layout/constants.h"
31 #include "core/components_ng/event/click_event.h"
32 #include "core/components_ng/manager/select_overlay/select_overlay_client.h"
33 #include "core/components_ng/manager/select_overlay/selection_host.h"
34 #include "core/components_ng/pattern/image/image_content_modifier.h"
35 #include "core/components_ng/pattern/image/image_dfx.h"
36 #include "core/components_ng/pattern/image/image_event_hub.h"
37 #include "core/components_ng/pattern/image/image_layout_algorithm.h"
38 #include "core/components_ng/pattern/image/image_layout_property.h"
39 #include "core/components_ng/pattern/image/image_overlay_modifier.h"
40 #include "core/components_ng/pattern/image/image_paint_method.h"
41 #include "core/components_ng/pattern/image/image_properties.h"
42 #include "core/components_ng/pattern/image/image_render_property.h"
43 #include "core/components_ng/pattern/pattern.h"
44 #include "core/components_ng/render/canvas_image.h"
45 #include "core/image/image_source_info.h"
46 
47 namespace OHOS::Ace {
48 class ImageAnalyzerManager;
49 }
50 
51 namespace OHOS::Ace::NG {
52 class InspectorFilter;
53 
54 class ACE_FORCE_EXPORT ImagePattern : public Pattern, public SelectOverlayClient {
55     DECLARE_ACE_TYPE(ImagePattern, Pattern, SelectionHost);
56 
57 public:
58     using OnProgressCallback = std::function<void(const uint32_t& dlNow, const uint32_t& dlTotal)>;
59 
60     ImagePattern();
61     ~ImagePattern() override;
62 
GetContextParam()63     std::optional<RenderContext::ContextParam> GetContextParam() const override
64     {
65         return RenderContext::ContextParam { .type = RenderContext::ContextType::CANVAS, .surfaceName = std::nullopt };
66     }
67 
68     RefPtr<NodePaintMethod> CreateNodePaintMethod() override;
69 
CreateLayoutProperty()70     RefPtr<LayoutProperty> CreateLayoutProperty() override
71     {
72         return MakeRefPtr<ImageLayoutProperty>();
73     }
74 
CreatePaintProperty()75     RefPtr<PaintProperty> CreatePaintProperty() override
76     {
77         return MakeRefPtr<ImageRenderProperty>();
78     }
79 
CreateLayoutAlgorithm()80     RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
81     {
82         return MakeRefPtr<ImageLayoutAlgorithm>();
83     }
84 
CreateEventHub()85     RefPtr<EventHub> CreateEventHub() override
86     {
87         return MakeRefPtr<ImageEventHub>();
88     }
89 
90     // Called on main thread to check if need rerender of the content.
91     bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
92 
93     FocusPattern GetFocusPattern() const override;
94 
GetCanvasImage()95     const RefPtr<CanvasImage>& GetCanvasImage()
96     {
97         return image_;
98     }
99 
GetAltCanvasImage()100     const RefPtr<CanvasImage>& GetAltCanvasImage()
101     {
102         return altImage_;
103     }
104 
GetClientHost()105     RefPtr<FrameNode> GetClientHost() const override
106     {
107         return GetHost();
108     }
109 
IsEnableMatchParent()110     bool IsEnableMatchParent() override
111     {
112         return true;
113     }
114 
IsEnableFix()115     bool IsEnableFix() override
116     {
117         return true;
118     }
119 
120     void CreateModifier();
121     void CreateObscuredImage();
122     void LoadImageDataIfNeed();
123     bool RecycleImageData();
124     void OnNotifyMemoryLevel(int32_t level) override;
125     void OnWindowHide() override;
126     void OnWindowShow() override;
127     void OnVisibleChange(bool isVisible) override;
128     void OnRecycle() override;
129     void OnReuse() override;
130 
131     void OnAreaChangedInner() override;
132     void RemoveAreaChangeInner();
133     void CalAndUpdateSelectOverlay();
134     OffsetF GetParentGlobalOffset() const;
135     void CheckHandles(SelectHandleInfo& handleInfo);
136 
137     void EnableDrag();
138     bool BetweenSelectedPosition(const Offset& globalOffset) override;
139 
DefaultSupportDrag()140     bool DefaultSupportDrag() override
141     {
142         return true;
143     }
144 
SetImageQuality(AIImageQuality imageQuality)145     void SetImageQuality(AIImageQuality imageQuality)
146     {
147         isImageReloadNeeded_ = isImageReloadNeeded_ | (imageQuality_ != imageQuality);
148         imageQuality_ = imageQuality;
149     }
150 
SetOrientation(ImageRotateOrientation orientation)151     void SetOrientation(ImageRotateOrientation orientation)
152     {
153         isOrientationChange_ = (userOrientation_ != orientation);
154         userOrientation_ = orientation;
155     }
156 
GetOrientation()157     ImageRotateOrientation GetOrientation()
158     {
159         return userOrientation_;
160     }
161 
162     void UpdateOrientation();
163 
GetImageQuality()164     AIImageQuality GetImageQuality()
165     {
166         return imageQuality_;
167     }
168 
SetCopyOption(CopyOptions value)169     void SetCopyOption(CopyOptions value)
170     {
171         copyOption_ = value;
172     }
173 
GetCopyOption()174     CopyOptions GetCopyOption()
175     {
176         return copyOption_;
177     }
178 
179     std::string GetImageFitStr(ImageFit value);
180 
181     std::string GetImageRepeatStr(ImageRepeat value);
182 
183     std::string GetImageColorFilterStr(const std::vector<float>& colorFilter);
184 
185     std::string GetSrcTypeToString(SrcType srcType);
186 
SetSyncLoad(bool value)187     void SetSyncLoad(bool value)
188     {
189         syncLoad_ = value;
190     }
191 
GetSyncLoad()192     bool GetSyncLoad() const
193     {
194         return syncLoad_;
195     }
196 
SetNeedBorderRadius(bool needBorderRadius)197     void SetNeedBorderRadius(bool needBorderRadius)
198     {
199         needBorderRadius_ = needBorderRadius;
200     }
201 
202     void SetImageAnalyzerConfig(const ImageAnalyzerConfig& config);
203     void SetImageAnalyzerConfig(void* config);
204     void SetImageAIOptions(void* options);
205     void BeforeCreatePaintWrapper() override;
206     void DumpInfo() override;
207     void DumpInfo(std::unique_ptr<JsonValue>& json) override;
208     void DumpLayoutInfo();
209     void DumpImageSourceInfo(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
210     inline void DumpAltSourceInfo(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
211     inline void DumpImageFit(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
212     inline void DumpFitOriginalSize(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
213     inline void DumpSourceSize(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
214     inline void DumpAutoResize(const RefPtr<OHOS::Ace::NG::ImageLayoutProperty>& layoutProp);
215     void DumpLayoutInfo(std::unique_ptr<JsonValue>& json);
216     void DumpRenderInfo();
217     inline void DumpRenderMode(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
218     inline void DumpImageRepeat(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
219     inline void DumpImageColorFilter(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
220     inline void DumpFillColor(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
221     inline void DumpDynamicRangeMode(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
222     inline void DumpMatchTextDirection(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
223     inline void DumpSmoothEdge(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
224     inline void DumpResizable(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
225     inline void DumpInterpolation(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
226     inline void DumpHdrBrightness(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
227     void DumpBorderRadiusProperties(const RefPtr<OHOS::Ace::NG::ImageRenderProperty>& renderProp);
228     inline void DumpOtherInfo();
229     inline void DumpMenmoryNameId();
230     void DumpRenderInfo(std::unique_ptr<JsonValue>& json);
231     void DumpAdvanceInfo() override;
232     void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json) override;
233     void DumpSvgInfo();
GetImageLoadingContext()234     WeakPtr<ImageLoadingContext> GetImageLoadingContext()
235     {
236         return WeakClaim(AceType::RawPtr(loadingCtx_));
237     }
238 
GetAltImageLoadingContext()239     WeakPtr<ImageLoadingContext> GetAltImageLoadingContext()
240     {
241         return WeakClaim(AceType::RawPtr(altLoadingCtx_));
242     }
243     void EnableAnalyzer(bool value);
244     bool IsEnableAnalyzer() const;
245     bool hasSceneChanged();
246     void OnSensitiveStyleChange(bool isSensitive) override;
247 
248     // animation
249     struct CacheImageStruct {
250         CacheImageStruct() = default;
CacheImageStructCacheImageStruct251         CacheImageStruct(const RefPtr<FrameNode>& imageNode) : imageNode(imageNode) {}
252         virtual ~CacheImageStruct() = default;
253         RefPtr<FrameNode> imageNode;
254         int32_t index = 0;
255         bool isLoaded = false;
256     };
257 
258     void ImageAnimatorPattern();
SetImages(std::vector<ImageProperties> && images)259     void SetImages(std::vector<ImageProperties>&& images)
260     {
261         CHECK_NULL_VOID(images.size());
262         images_ = std::move(images);
263         durationTotal_ = 0;
264         for (const auto& childImage : images_) {
265             if ((!childImage.src.empty() || childImage.pixelMap != nullptr) && childImage.duration > 0) {
266                 durationTotal_ += childImage.duration;
267             }
268         }
269         imagesChangedFlag_ = true;
270         RegisterVisibleAreaChange();
271     }
272 
ResetImages()273     void ResetImages()
274     {
275         images_.clear();
276     }
277     void ResetImage();
278     void ResetAltImage();
279     void ResetImageProperties();
280 
281     void ResetImageAndAlt();
282 
283     void ResetPictureSize();
284 
GetHasSizeChanged()285     bool GetHasSizeChanged()
286     {
287         return hasSizeChanged;
288     }
289 
StartAnimation()290     void StartAnimation()
291     {
292         status_ = AnimatorStatus::RUNNING;
293     }
294 
StopAnimation()295     void StopAnimation()
296     {
297         status_ = AnimatorStatus::STOPPED;
298         OnAnimatedModifyDone();
299     }
300 
SetImageType(ImageType imageType)301     void SetImageType(ImageType imageType)
302     {
303         imageType_ = imageType;
304     }
305 
GetImageType()306     ImageType GetImageType()
307     {
308         return imageType_;
309     }
310 
GetIsAnimation()311     bool GetIsAnimation() const
312     {
313         return imageType_ == ImageType::ANIMATED_DRAWABLE;
314     }
315 
IsAtomicNode()316     bool IsAtomicNode() const override
317     {
318         return true;
319     }
320 
321     bool AllowVisibleAreaCheck() const override;
322 
323     void OnInActive() override;
324 
325     void OnActive() override;
326 
327     void SetDuration(int32_t duration);
328     void SetIteration(int32_t iteration);
329 
SetSrcUndefined(bool isUndefined)330     void SetSrcUndefined(bool isUndefined)
331     {
332         isSrcUndefined_ = isUndefined;
333     }
334 
SetImageAnimator(bool isImageAnimator)335     void SetImageAnimator(bool isImageAnimator)
336     {
337         isImageAnimator_ = isImageAnimator;
338     }
339 
GetNeedLoadAlt()340     bool GetNeedLoadAlt()
341     {
342         return needLoadAlt_;
343     }
344 
SetNeedLoadAlt(bool needLoadAlt)345     void SetNeedLoadAlt(bool needLoadAlt)
346     {
347         needLoadAlt_ = needLoadAlt;
348     }
349 
350     void SetOnProgressCallback(std::function<void(const uint32_t& dlNow, const uint32_t& dlTotal)>&& onProgress);
351 
GetRawImageSize()352     SizeF GetRawImageSize()
353     {
354         if (!loadingCtx_) {
355             return SizeF(-1.0, -1.0);
356         }
357         return loadingCtx_->GetImageSize();
358     }
359 
360     void OnVisibleAreaChange(bool visible = true, double ratio = 0.0);
361 
GetDefaultAutoResize()362     bool GetDefaultAutoResize()
363     {
364         return autoResizeDefault_;
365     }
366 
GetDefaultInterpolation()367     ImageInterpolation GetDefaultInterpolation()
368     {
369         return interpolationDefault_;
370     }
371     void InitOnKeyEvent();
372 
SetIsComponentSnapshotNode(bool isComponentSnapshotNode)373     void SetIsComponentSnapshotNode(bool isComponentSnapshotNode)
374     {
375         isComponentSnapshotNode_ = isComponentSnapshotNode;
376     }
377 
SetRenderedImageInfo(const RenderedImageInfo & renderedImageInfo)378     void SetRenderedImageInfo(const RenderedImageInfo& renderedImageInfo)
379     {
380         renderedImageInfo_ = renderedImageInfo;
381     }
382 
383     // Sets the decoding format for the external domain.
384     // Note: Only NV21, RGBA_8888, RGBA_1010102, YCBCR_P010, YCRCB_P010 format is supported at this time.
385     void SetExternalDecodeFormat(PixelFormat externalDecodeFormat);
386 
GetExternalDecodeFormat()387     PixelFormat GetExternalDecodeFormat()
388     {
389         return externalDecodeFormat_;
390     }
391     void AddPixelMapToUiManager();
392 
SetDrawable(const RefPtr<DrawableDescriptor> & drawable)393     void SetDrawable(const RefPtr<DrawableDescriptor>& drawable)
394     {
395         drawable_ = drawable;
396     }
397 
398     // this method for measure content
399     std::optional<SizeF> GetImageSizeForMeasure();
400 
401     // this method for on complete callback execute after measuring
402     void FinishMeasureForOnComplete();
403 
404     void DrawDrawable(RSCanvas& canvas);
405 
406     void OnConfigurationUpdate();
407     void UpdateImageSourceinfo(const ImageSourceInfo& sourceInfo);
408     void UpdateImageFill(const Color& color);
409     void UpdateImageAlt(const ImageSourceInfo& sourceInfo);
410     void OnColorModeChange(uint32_t colorMode) override;
411 
412 protected:
413     void RegisterWindowStateChangedCallback();
414     void UnregisterWindowStateChangedCallback();
415     bool isShow_ = true;
416     RefPtr<ImageOverlayModifier> overlayMod_;
417     RefPtr<ImageContentModifier> contentMod_;
418 
419 private:
420     class ObscuredImage : public CanvasImage {
DrawToRSCanvas(RSCanvas & canvas,const RSRect & srcRect,const RSRect & dstRect,const BorderRadiusArray & radiusXY)421         void DrawToRSCanvas(
422             RSCanvas& canvas, const RSRect& srcRect, const RSRect& dstRect, const BorderRadiusArray& radiusXY) override
423         {}
DrawRect(RSCanvas & canvas,const RSRect & srcRect,const RSRect & dstRect)424         void DrawRect(RSCanvas& canvas, const RSRect& srcRect, const RSRect& dstRect) override {}
GetWidth()425         int32_t GetWidth() const override
426         {
427             return 0;
428         }
GetHeight()429         int32_t GetHeight() const override
430         {
431             return 0;
432         }
433     };
434 
435     void OnAttachToFrameNode() override;
436     void OnDetachFromFrameNode(FrameNode* frameNode) override;
437     void OnDetachFromMainTree() override;
438 
439     void OnAttachToMainTree() override;
OnAttachToFrameNodeMultiThread()440     void OnAttachToFrameNodeMultiThread() {}
OnDetachFromFrameNodeMultiThread(FrameNode * frameNode)441     void OnDetachFromFrameNodeMultiThread(FrameNode* frameNode) {}
442     void OnAttachToMainTreeMultiThread();
443     void OnDetachFromMainTreeMultiThread();
444     void OnModifyDone() override;
445     void OnPixelMapDrawableModifyDone();
446     ImagePaintConfig CreatePaintConfig();
447     void Validate();
448     void RegisterDrawableRedrawCallback();
449     void UpdateGestureAndDragWhenModify();
450     bool CheckImagePrivacyForCopyOption();
451     void UpdateOffsetForImageAnalyzerOverlay();
452     void SetFrameOffsetForOverlayNode();
453 
454     void OnLanguageConfigurationUpdate() override;
455 
456     /**
457      * @brief Start decoding image after ImageData is ready and dstSize is determined.
458      *
459      * @param dstSize The size of the image to be decoded.
460      */
461     void StartDecoding(const SizeF& dstSize);
462     bool CheckIfNeedLayout();
463     void OnImageDataReady();
464     void OnCompleteInDataReady();
465     void OnImageLoadFail(const std::string& errorMsg, const ImageErrorInfo& errorInfo);
466     void OnImageLoadSuccess();
467     bool SetPixelMapMemoryName(RefPtr<PixelMap>& pixelMap);
468     std::string HandleSrcForMemoryName(std::string url);
469     std::string MaskUrl(std::string url);
470     void ApplyAIModificationsToImage();
471     void SetImagePaintConfig(const RefPtr<CanvasImage>& canvasImage, const RectF& srcRect, const RectF& dstRect,
472         const ImageSourceInfo& sourceInfo, int32_t frameCount = 1);
473     void UpdateInternalResource(ImageSourceInfo& sourceInfo);
474 
475     void PrepareAnimation(const RefPtr<CanvasImage>& image);
476     void SetRedrawCallback(const RefPtr<CanvasImage>& image);
477     void SetOnFinishCallback(const RefPtr<CanvasImage>& image);
478     void RegisterVisibleAreaChange(bool isCalcClip = true);
479     void TriggerVisibleAreaChangeForChild(const RefPtr<UINode>& node, bool visible, double ratio);
480 
481     void InitCopy();
482     void HandleCopy();
483     void OpenSelectOverlay();
484     void HandleMoveDone(bool isFirst);
485     void CloseSelectOverlay();
486 
487     void TriggerFirstVisibleAreaChange();
488 
489     void UpdateDragEvent(const RefPtr<OHOS::Ace::DragEvent>& event);
490 
491     void ToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const override;
492 
493     RectF CalcImageContentPaintSize(const RefPtr<GeometryNode>& geometryNode);
494 
495     DataReadyNotifyTask CreateDataReadyCallback();
496     LoadSuccessNotifyTask CreateLoadSuccessCallback();
497     LoadFailNotifyTask CreateLoadFailCallback();
498     OnCompleteInDataReadyNotifyTask CreateCompleteCallBackInDataReady();
499 
500     DataReadyNotifyTask CreateDataReadyCallbackForAlt();
501     LoadSuccessNotifyTask CreateLoadSuccessCallbackForAlt();
502     LoadFailNotifyTask CreateLoadFailCallbackForAlt();
503 
504     void OnColorConfigurationUpdate() override;
505     void OnDirectionConfigurationUpdate() override;
506     void OnIconConfigurationUpdate() override;
507     ImageDfxConfig CreateImageDfxConfig(const ImageSourceInfo& src);
508     void ReportPerfData(const RefPtr<NG::FrameNode>& host, int32_t state);
509     void ClearReloadFlagsAfterLoad();
510     void LoadImage(const ImageSourceInfo& src, bool needLayout);
511     void LoadAltImage(const ImageSourceInfo& altImageSourceInfo);
512 
513     void CreateAnalyzerOverlay();
514     void UpdateAnalyzerOverlay();
515     void UpdateAnalyzerOverlayLayout();
516     void UpdateAnalyzerUIConfig(const RefPtr<NG::GeometryNode>& geometryNode);
517     void DestroyAnalyzerOverlay();
518     void ReleaseImageAnalyzer();
519     bool IsSupportImageAnalyzerFeature();
520     void InitDefaultValue();
521     void ClearAltData();
522     void UpdateSvgSmoothEdgeValue();
523 
524     // animation
525     RefPtr<PictureAnimation<int32_t>> CreatePictureAnimation(int32_t size);
526     void AdaptSelfSize();
527     void SetShowingIndex(int32_t index);
528     void UpdateShowingImageInfo(const RefPtr<FrameNode>& imageFrameNode, int32_t index);
529     void UpdateCacheImageInfo(CacheImageStruct& cacheImage, int32_t index);
530     std::list<CacheImageStruct>::iterator FindCacheImageNode(const RefPtr<PixelMap>& src);
531     int32_t GetNextIndex(int32_t preIndex);
532     void GenerateCachedImages();
533     void AddImageLoadSuccessEvent(const RefPtr<FrameNode>& imageFrameNode);
534     static bool IsShowingSrc(const RefPtr<FrameNode>& imageFrameNode, const RefPtr<PixelMap>& src);
535     bool IsFormRender();
536     void UpdateFormDurationByRemainder();
537     void ResetFormAnimationStartTime();
538     void ResetFormAnimationFlag();
539     void OnAnimatedModifyDone();
540     void OnImageModifyDone();
541     void SetColorFilter(const RefPtr<FrameNode>& imageFrameNode);
542     void SetImageFit(const RefPtr<FrameNode>& imageFrameNode);
543     void ControlAnimation(int32_t index);
544     void SetObscured();
545     void OnKeyEvent(const KeyEvent& event);
546     void InitFromThemeIfNeed();
547     CopyOptions copyOption_ = CopyOptions::None;
548     ImageInterpolation interpolation_ = ImageInterpolation::LOW;
549     bool needLoadAlt_ = true;
550     RenderedImageInfo renderedImageInfo_;
551 
552     RefPtr<ImageLoadingContext> loadingCtx_;
553     RefPtr<CanvasImage> image_;
554     RectF dstRect_;
555     RectF srcRect_;
556     RefPtr<ImagePaintMethod> imagePaintMethod_ = nullptr;
557 
558     RefPtr<CanvasImage> obscuredImage_;
559 
560     // clear alt data after [OnImageLoadSuccess] being called
561     RefPtr<ImageLoadingContext> altLoadingCtx_;
562     RefPtr<CanvasImage> altImage_;
563     std::unique_ptr<RectF> altDstRect_;
564     std::unique_ptr<RectF> altSrcRect_;
565 
566     RefPtr<LongPressEvent> longPressEvent_;
567     RefPtr<ClickEvent> clickEvent_;
568     RefPtr<InputEvent> mouseEvent_;
569     RefPtr<Clipboard> clipboard_;
570     RefPtr<SelectOverlayProxy> selectOverlay_;
571     std::shared_ptr<ImageAnalyzerManager> imageAnalyzerManager_;
572     ImageDfxConfig imageDfxConfig_;
573     ImageDfxConfig altImageDfxConfig_;
574     bool enableDrag_ = false;
575 
576     std::function<bool(const KeyEvent& event)> keyEventCallback_ = nullptr;
577     OnProgressCallback onProgressCallback_ = nullptr;
578     bool syncLoad_ = false;
579     bool needBorderRadius_ = false;
580     AIImageQuality imageQuality_ = AIImageQuality::NONE;
581     PixelFormat externalDecodeFormat_ = PixelFormat::UNKNOWN;
582     // Flag indicating whether the image needs to be reloaded due to parameter changes.
583     bool isImageReloadNeeded_ = false;
584     bool isEnableAnalyzer_ = false;
585     bool autoResizeDefault_ = true;
586     bool isSceneBoardWindow_ = false;
587     bool isSensitive_ = false;
588     ImageInterpolation interpolationDefault_ = ImageInterpolation::NONE;
589     ImageRotateOrientation userOrientation_ = ImageRotateOrientation::UP;
590     ImageRotateOrientation selfOrientation_ = ImageRotateOrientation::UP;
591     ImageRotateOrientation joinOrientation_ = ImageRotateOrientation::UP;
592     bool isFullyInitializedFromTheme_ = false;
593     Color selectedColor_;
594     float smoothEdge_ = 0.0f;
595     OffsetF parentGlobalOffset_;
596     bool isSelected_ = false;
597 
598     // The component has an internal encapsulation class drawable of the image.
599     // The internal drawable has an external raw pointer.
600     RefPtr<DrawableDescriptor> drawable_;
601     bool isRegisterRedrawCallback_ = false;
602 
603     ACE_DISALLOW_COPY_AND_MOVE(ImagePattern);
604 
605     // After the animated drawable descriptor code goes online, need to
606     // remove all the following codes.
607     ImageType imageType_ = ImageType::BASE;
608     RefPtr<Animator> animator_;
609     std::vector<ImageProperties> images_;
610     std::list<CacheImageStruct> cacheImages_;
611     AnimatorStatus status_ = AnimatorStatus::IDLE;
612     int32_t durationTotal_ = 0;
613     int32_t nowImageIndex_ = 0;
614     uint64_t repeatCallbackId_ = 0;
615     bool imagesChangedFlag_ = false;
616     bool firstUpdateEvent_ = true;
617     bool isLayouted_ = false;
618     int64_t formAnimationStartTime_ = 0;
619     int32_t formAnimationRemainder_ = 0;
620     bool isOrientationChange_ = false;
621     bool isFormAnimationStart_ = true;
622     bool isFormAnimationEnd_ = false;
623     bool isImageAnimator_ = false;
624     bool hasSizeChanged = false;
625     bool isPixelMapChanged_ = false;
626     bool isSrcUndefined_ = false;
627     bool isComponentSnapshotNode_ = false;
628     bool isNeedReset_ = false;
629     bool hasSetPixelMapMemoryName_ = false;
630     bool previousVisibility_ = false;
631 };
632 
633 } // namespace OHOS::Ace::NG
634 
635 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_IMAGE_IMAGE_PATTERN_H
636