2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.BaseComponents
26 /// ImageView is a class for displaying an image resource.<br />
27 /// An instance of ImageView can be created using a URL or an image instance.<br />
29 /// <since_tizen> 3 </since_tizen>
30 public class ImageView : View
32 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33 [EditorBrowsable(EditorBrowsableState.Never)]
34 public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
36 var imageView = (ImageView)bindable;
37 string url = (string)newValue;
38 url = (url == null ? "" : url);
39 if (imageView.IsCreateByXaml && url.Contains("*Resource*"))
41 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
42 url = url.Replace("*Resource*", resource);
44 imageView._resourceUrl = url;
45 imageView.UpdateImage(ImageVisualProperty.URL, new PropertyValue(url));
47 defaultValueCreator: (bindable) =>
49 var imageView = (ImageView)bindable;
52 PropertyMap imageMap = new PropertyMap();
53 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
54 imageMap.Find(ImageVisualProperty.URL)?.Get(out ret);
58 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
59 [EditorBrowsable(EditorBrowsableState.Never)]
60 public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(ImageView.Image), typeof(PropertyMap), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
62 var imageView = (ImageView)bindable;
65 PropertyMap map = (PropertyMap)newValue;
66 if (imageView.IsCreateByXaml)
68 string url = "", alphaMaskURL = "", auxiliaryImageURL = "";
69 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
70 PropertyValue urlValue = map.Find(NDalic.IMAGE_VISUAL_URL);
72 if (urlValue != null) ret = urlValue.Get(out url);
73 PropertyMap mmap = new PropertyMap();
74 if (ret && url.Contains("*Resource*"))
76 url = url.Replace("*Resource*", resource);
77 mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(url));
81 PropertyValue alphaMaskUrlValue = map.Find(NDalic.IMAGE_VISUAL_ALPHA_MASK_URL);
82 if (alphaMaskUrlValue != null) ret = alphaMaskUrlValue.Get(out alphaMaskURL);
83 if (ret && alphaMaskURL.Contains("*Resource*"))
85 alphaMaskURL = alphaMaskURL.Replace("*Resource*", resource);
86 mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(alphaMaskURL));
90 PropertyValue auxiliaryImageURLValue = map.Find(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL);
91 if (auxiliaryImageURLValue != null) ret = auxiliaryImageURLValue.Get(out auxiliaryImageURL);
92 if (ret && auxiliaryImageURL.Contains("*Resource*"))
94 auxiliaryImageURL = auxiliaryImageURL.Replace("*Resource*", resource);
95 mmap.Insert(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL, new PropertyValue(auxiliaryImageURL));
100 if (imageView._border == null)
102 Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(map));
106 defaultValueCreator: (bindable) =>
108 var imageView = (ImageView)bindable;
109 if (imageView._border == null)
111 PropertyMap temp = new PropertyMap();
112 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(temp);
121 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
122 [EditorBrowsable(EditorBrowsableState.Never)]
123 public static readonly BindableProperty PreMultipliedAlphaProperty = BindableProperty.Create("PreMultipliedAlpha", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
125 var imageView = (ImageView)bindable;
126 if (newValue != null)
128 Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue((bool)newValue));
131 defaultValueCreator: (bindable) =>
133 var imageView = (ImageView)bindable;
135 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(out temp);
139 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public static readonly BindableProperty PixelAreaProperty = BindableProperty.Create("PixelArea", typeof(RelativeVector4), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
143 var imageView = (ImageView)bindable;
144 if (newValue != null)
146 Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue((RelativeVector4)newValue));
149 defaultValueCreator: (bindable) =>
151 var imageView = (ImageView)bindable;
152 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
153 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA).Get(temp);
154 RelativeVector4 relativeTemp = new RelativeVector4(temp.X, temp.Y, temp.Z, temp.W);
158 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public static readonly BindableProperty BorderProperty = BindableProperty.Create("Border", typeof(Rectangle), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
164 var imageView = (ImageView)bindable;
165 imageView._border = (Rectangle)newValue;
166 imageView.UpdateImage(NpatchImageVisualProperty.Border, new PropertyValue(imageView._border));
169 defaultValueCreator: (bindable) =>
171 var imageView = (ImageView)bindable;
172 return imageView._border;
175 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public static readonly BindableProperty BorderOnlyProperty = BindableProperty.Create("BorderOnly", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
179 var imageView = (ImageView)bindable;
180 if (newValue != null)
182 imageView.UpdateImage(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)newValue));
185 defaultValueCreator: (bindable) =>
187 var imageView = (ImageView)bindable;
189 PropertyMap imageMap = new PropertyMap();
190 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
191 imageMap.Find(ImageVisualProperty.BorderOnly)?.Get(out ret);
195 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
196 [EditorBrowsable(EditorBrowsableState.Never)]
197 public static readonly BindableProperty SynchronosLoadingProperty = BindableProperty.Create("SynchronosLoading", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
199 var imageView = (ImageView)bindable;
200 if (newValue != null)
202 imageView.UpdateImage(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)newValue));
205 defaultValueCreator: (bindable) =>
207 var imageView = (ImageView)bindable;
209 PropertyMap imageMap = new PropertyMap();
210 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
211 imageMap.Find(ImageVisualProperty.SynchronousLoading)?.Get(out ret);
215 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public static readonly BindableProperty OrientationCorrectionProperty = BindableProperty.Create("OrientationCorrection", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
219 var imageView = (ImageView)bindable;
220 if (newValue != null)
222 imageView.UpdateImage(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)newValue));
225 defaultValueCreator: (bindable) =>
227 var imageView = (ImageView)bindable;
230 PropertyMap imageMap = new PropertyMap();
231 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
232 imageMap?.Find(ImageVisualProperty.OrientationCorrection)?.Get(out ret);
237 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
238 private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
239 private ResourceReadyEventCallbackType _resourceReadyEventCallback;
240 private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
241 private _resourceLoadedCallbackType _resourceLoadedCallback;
243 private Rectangle _border;
244 private string _resourceUrl = "";
247 /// Creates an initialized ImageView.
249 /// <since_tizen> 3 </since_tizen>
250 public ImageView() : this(Interop.ImageView.ImageView_New__SWIG_0(), true)
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 /// Creates an initialized ImageView from a URL to an image resource.<br />
257 /// If the string is empty, ImageView will not display anything.<br />
259 /// <param name="url">The URL of the image resource to display.</param>
260 /// <since_tizen> 3 </since_tizen>
261 public ImageView(string url) : this(Interop.ImageView.ImageView_New__SWIG_2(url), true)
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal ImageView(string url, Uint16Pair size) : this(Interop.ImageView.ImageView_New__SWIG_3(url, Uint16Pair.getCPtr(size)), true)
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.ImageView.ImageView_SWIGUpcast(cPtr), cMemoryOwn)
275 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
278 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
279 private delegate void ResourceReadyEventCallbackType(IntPtr data);
280 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
281 private delegate void _resourceLoadedCallbackType(IntPtr view);
284 /// An event for ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
285 /// This signal is emitted after all resources required by a control are loaded and ready.<br />
286 /// Most resources are only loaded when the control is placed on the stage.<br />
288 /// <since_tizen> 3 </since_tizen>
289 public event EventHandler<ResourceReadyEventArgs> ResourceReady
293 if (_resourceReadyEventHandler == null)
295 _resourceReadyEventCallback = OnResourceReady;
296 ResourceReadySignal(this).Connect(_resourceReadyEventCallback);
299 _resourceReadyEventHandler += value;
304 _resourceReadyEventHandler -= value;
306 if (_resourceReadyEventHandler == null && ResourceReadySignal(this).Empty() == false)
308 ResourceReadySignal(this).Disconnect(_resourceReadyEventCallback);
313 internal event EventHandler<ResourceLoadedEventArgs> ResourceLoaded
317 if (_resourceLoadedEventHandler == null)
319 _resourceLoadedCallback = OnResourceLoaded;
320 this.ResourceReadySignal(this).Connect(_resourceLoadedCallback);
323 _resourceLoadedEventHandler += value;
327 _resourceLoadedEventHandler -= value;
329 if (_resourceLoadedEventHandler == null && this.ResourceReadySignal(this).Empty() == false)
331 this.ResourceReadySignal(this).Disconnect(_resourceLoadedCallback);
337 /// Enumeration for LoadingStatus of image.
339 /// <since_tizen> 5 </since_tizen>
340 public enum LoadingStatusType
343 /// Loading preparing status.
345 /// <since_tizen> 5 </since_tizen>
348 /// Loading ready status.
350 /// <since_tizen> 5 </since_tizen>
353 /// Loading failed status.
355 /// <since_tizen> 5 </since_tizen>
360 /// ImageView ResourceUrl, type string.
361 /// This is one of mandatory property. Even if not set or null set, it sets empty string ("") internally.
362 /// When it is set as null, it gives empty string ("") to be read.
364 /// <since_tizen> 3 </since_tizen>
365 public string ResourceUrl
369 return (string)GetValue(ResourceUrlProperty);
373 SetValue(ResourceUrlProperty, value);
374 NotifyPropertyChanged();
379 /// This will be deprecated, please use Image instead. <br />
380 /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise.
382 /// <since_tizen> 3 </since_tizen>
383 [Obsolete("Please do not use! This will be deprecated! Please use Image property instead!")]
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 public PropertyMap ImageMap
391 PropertyMap temp = new PropertyMap();
392 GetProperty(ImageView.Property.IMAGE).Get(temp);
404 SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
405 NotifyPropertyChanged();
411 /// ImageView Image, type PropertyMap
413 /// <since_tizen> 4 </since_tizen>
414 public PropertyMap Image
420 return (PropertyMap)GetValue(ImageProperty);
431 SetValue(ImageProperty, value);
432 NotifyPropertyChanged();
438 /// ImageView PreMultipliedAlpha, type Boolean.<br />
439 /// Image must be initialized.<br />
441 /// <since_tizen> 3 </since_tizen>
442 public bool PreMultipliedAlpha
446 return (bool)GetValue(PreMultipliedAlphaProperty);
450 SetValue(PreMultipliedAlphaProperty, value);
451 NotifyPropertyChanged();
456 /// ImageView PixelArea, type Vector4 (Animatable property).<br />
457 /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].<br />
459 /// <since_tizen> 3 </since_tizen>
460 public RelativeVector4 PixelArea
464 return (RelativeVector4)GetValue(PixelAreaProperty);
468 SetValue(PixelAreaProperty, value);
469 NotifyPropertyChanged();
474 /// The border of the image in the order: left, right, bottom, top.<br />
475 /// If set, ImageMap will be ignored.<br />
476 /// For N-Patch images only.<br />
479 /// <since_tizen> 3 </since_tizen>
480 public Rectangle Border
484 return (Rectangle)GetValue(BorderProperty);
488 SetValue(BorderProperty, value);
489 NotifyPropertyChanged();
494 /// Gets or sets whether to draw the borders only (if true).<br />
495 /// If not specified, the default is false.<br />
496 /// For N-Patch images only.<br />
499 /// <since_tizen> 3 </since_tizen>
500 public bool BorderOnly
504 return (bool)GetValue(BorderOnlyProperty);
508 SetValue(BorderOnlyProperty, value);
509 NotifyPropertyChanged();
514 /// Gets or sets whether to synchronos loading the resourceurl of image.<br />
516 /// <since_tizen> 3 </since_tizen>
517 public bool SynchronosLoading
521 return (bool)GetValue(SynchronosLoadingProperty);
525 SetValue(SynchronosLoadingProperty, value);
526 NotifyPropertyChanged();
531 /// Gets or sets whether to automatically correct the orientation of an image.<br />
533 /// <since_tizen> 5 </since_tizen>
534 public bool OrientationCorrection
538 return (bool)GetValue(OrientationCorrectionProperty);
542 SetValue(OrientationCorrectionProperty, value);
543 NotifyPropertyChanged();
548 /// Gets the loading state of the visual resource.
550 /// <since_tizen> 5 </since_tizen>
551 public ImageView.LoadingStatusType LoadingStatus
555 return (ImageView.LoadingStatusType)Interop.View.View_GetVisualResourceStatus(swigCPtr, (int)Property.IMAGE);
560 /// Downcasts a handle to imageView handle.
562 /// Please do not use! this will be deprecated!
563 /// Instead please use as keyword.
564 /// <since_tizen> 3 </since_tizen>
565 [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
567 "BaseHandle handle = new ImageView(imagePath); " +
568 "ImageView image = handle as ImageView")]
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public static ImageView DownCast(BaseHandle handle)
572 ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578 /// Sets this ImageView from the given URL.<br />
579 /// If the URL is empty, ImageView will not display anything.<br />
581 /// <param name="url">The URL to the image resource to display.</param>
582 /// <since_tizen> 3 </since_tizen>
583 public void SetImage(string url)
585 if(url.Contains(".json"))
587 Tizen.Log.Fatal("NUI", "[ERROR] Please DO NOT set lottie file in ImageView! This is temporary checking, will be removed soon!");
591 Interop.ImageView.ImageView_SetImage__SWIG_1(swigCPtr, url);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598 /// Queries if all resources required by a control are loaded and ready.<br />
599 /// Most resources are only loaded when the control is placed on the stage.<br />
600 /// True if the resources are loaded and ready, false otherwise.<br />
602 /// <since_tizen> 3 </since_tizen>
603 public new bool IsResourceReady()
605 bool ret = Interop.View.IsResourceReady(swigCPtr);
606 if (NDalicPINVOKE.SWIGPendingException.Pending)
607 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 /// Forcefully reloads the image. All the visuals using this image will reload to the latest image.
614 /// <since_tizen> 5 </since_tizen>
617 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0));
621 /// Plays the animated GIF. This is also the default playback mode.
623 /// <since_tizen> 5 </since_tizen>
626 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0));
630 /// Pauses the animated GIF.
632 /// <since_tizen> 5 </since_tizen>
635 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0));
639 /// Stops the animated GIF.
641 /// <since_tizen> 5 </since_tizen>
644 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0));
648 /// Gets or sets the URL of the alpha mask.<br />
651 /// <since_tizen> 6</since_tizen>
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 public string AlphaMaskURL
658 PropertyMap imageMap = new PropertyMap();
659 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
660 imageMap?.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret);
671 UpdateImage(ImageVisualProperty.AlphaMaskURL, new PropertyValue(value));
677 /// Whether to crop image to mask or scale mask to fit image.
679 /// <since_tizen> 6 </since_tizen>
680 [EditorBrowsable(EditorBrowsableState.Never)]
681 public bool CropToMask
686 PropertyMap imageMap = new PropertyMap();
687 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
688 imageMap?.Find(ImageVisualProperty.CropToMask)?.Get(out ret);
694 UpdateImage(ImageVisualProperty.CropToMask, new PropertyValue(value));
700 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
701 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
702 /// For normal quad images only.<br />
705 /// <since_tizen> 6 </since_tizen>
706 [EditorBrowsable(EditorBrowsableState.Never)]
707 public FittingModeType FittingMode
711 int ret = (int)FittingModeType.ShrinkToFit;
712 PropertyMap imageMap = new PropertyMap();
713 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
714 imageMap?.Find(ImageVisualProperty.FittingMode)?.Get(out ret);
716 return (FittingModeType)ret;
720 UpdateImage(ImageVisualProperty.CropToMask, new PropertyValue((int)value));
727 /// Gets or sets the desired image width.<br />
728 /// If not specified, the actual image width is used.<br />
729 /// For normal quad images only.<br />
732 /// <since_tizen> 6 </since_tizen>
733 [EditorBrowsable(EditorBrowsableState.Never)]
734 public int DesiredWidth
739 PropertyMap imageMap = new PropertyMap();
740 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
741 imageMap?.Find(ImageVisualProperty.DesiredWidth)?.Get(out ret);
747 UpdateImage(ImageVisualProperty.DesiredWidth, new PropertyValue(value));
752 /// Gets or sets the desired image height.<br />
753 /// If not specified, the actual image height is used.<br />
754 /// For normal quad images only.<br />
757 /// <since_tizen> 6 </since_tizen>
758 [EditorBrowsable(EditorBrowsableState.Never)]
759 public int DesiredHeight
764 PropertyMap imageMap = new PropertyMap();
765 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
766 imageMap?.Find(ImageVisualProperty.DesiredHeight)?.Get(out ret);
772 UpdateImage(ImageVisualProperty.DesiredHeight, new PropertyValue(value));
778 /// Gets or sets the wrap mode for the u coordinate.<br />
779 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
780 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
781 /// For normal quad images only.<br />
784 /// <since_tizen> 6 </since_tizen>
785 [EditorBrowsable(EditorBrowsableState.Never)]
786 public WrapModeType WrapModeU
790 int ret = (int)WrapModeType.Default;
791 PropertyMap imageMap = new PropertyMap();
792 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
793 imageMap?.Find(ImageVisualProperty.WrapModeU)?.Get(out ret);
795 return (WrapModeType)ret;
799 UpdateImage(ImageVisualProperty.WrapModeU, new PropertyValue((int)value));
804 /// Gets or sets the wrap mode for the v coordinate.<br />
805 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
806 /// The first two elements indicate the top-left position of the area, and the last two elements are the areas of the width and the height respectively.<br />
807 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
808 /// For normal quad images only.
811 /// <since_tizen> 6 </since_tizen>
812 [EditorBrowsable(EditorBrowsableState.Never)]
813 public WrapModeType WrapModeV
817 int ret = (int)WrapModeType.Default;
818 PropertyMap imageMap = new PropertyMap();
819 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
820 imageMap?.Find(ImageVisualProperty.WrapModeV)?.Get(out ret);
822 return (WrapModeType)ret;
826 UpdateImage(ImageVisualProperty.WrapModeV, new PropertyValue((int)value));
831 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj)
833 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
836 internal void SetImage(string url, Uint16Pair size)
838 if(url.Contains(".json"))
840 Tizen.Log.Fatal("NUI", "[ERROR] Please DO NOT set lottie file in ImageView! This is temporary checking, will be removed soon!");
844 Interop.ImageView.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 internal ViewResourceReadySignal ResourceReadySignal(View view)
852 ViewResourceReadySignal ret = new ViewResourceReadySignal(Interop.View.ResourceReadySignal(View.getCPtr(view)), false);
853 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
857 internal ResourceLoadingStatusType GetResourceStatus()
859 return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
863 /// you can override it to clean-up your own resources.
865 /// <param name="type">DisposeTypes</param>
866 /// <since_tizen> 3 </since_tizen>
867 protected override void Dispose(DisposeTypes type)
874 if (type == DisposeTypes.Explicit)
877 //Release your own managed resources here.
878 //You should release all of your own disposable objects here.
883 //Release your own unmanaged resources here.
884 //You should not access any managed member here except static instance.
885 //because the execution order of Finalizes is non-deterministic.
887 if (swigCPtr.Handle != global::System.IntPtr.Zero)
892 Interop.ImageView.delete_ImageView(swigCPtr);
894 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
900 // Callback for View ResourceReady signal
901 private void OnResourceReady(IntPtr data)
903 ResourceReadyEventArgs e = new ResourceReadyEventArgs();
906 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
909 if (_resourceReadyEventHandler != null)
911 _resourceReadyEventHandler(this, e);
915 private void UpdateImageMap(PropertyMap fromMap)
917 PropertyMap imageMap = new PropertyMap();
918 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
919 imageMap.Merge(fromMap);
921 SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap));
924 private void UpdateImage(int key, PropertyValue value)
926 PropertyMap temp = new PropertyMap();
928 if (_resourceUrl == "")
930 temp.Insert(ImageVisualProperty.URL, new PropertyValue(_resourceUrl));
931 SetProperty(ImageView.Property.IMAGE, new PropertyValue(temp));
937 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
941 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
942 temp.Insert(NpatchImageVisualProperty.Border, new PropertyValue(_border));
947 temp.Insert(key, value);
950 UpdateImageMap(temp);
957 private void OnResourceLoaded(IntPtr view)
959 ResourceLoadedEventArgs e = new ResourceLoadedEventArgs();
960 e.Status = (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
962 if (_resourceLoadedEventHandler != null)
964 _resourceLoadedEventHandler(this, e);
969 /// Event arguments of resource ready.
971 /// <since_tizen> 3 </since_tizen>
972 public class ResourceReadyEventArgs : EventArgs
977 /// The view whose resource is ready.
979 /// <since_tizen> 3 </since_tizen>
993 internal class ResourceLoadedEventArgs : EventArgs
995 private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
996 public ResourceLoadingStatusType Status
1009 internal new class Property
1011 internal static readonly int IMAGE = Interop.ImageView.ImageView_Property_IMAGE_get();
1012 internal static readonly int PRE_MULTIPLIED_ALPHA = Interop.ImageView.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
1013 internal static readonly int PIXEL_AREA = Interop.ImageView.ImageView_Property_PIXEL_AREA_get();
1014 internal static readonly int ACTION_RELOAD = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
1015 internal static readonly int ACTION_PLAY = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
1016 internal static readonly int ACTION_PAUSE = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
1017 internal static readonly int ACTION_STOP = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_STOP_get();
1020 private enum ImageType
1023 /// For Normal Image.
1028 /// For normal image, with synchronous loading and orientation correction property
1033 /// For nine-patch image