2 * Copyright(c) 2018 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 Interop.ImageView.ImageView_SetImage__SWIG_1(swigCPtr, url);
586 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592 /// Queries if all resources required by a control are loaded and ready.<br />
593 /// Most resources are only loaded when the control is placed on the stage.<br />
594 /// True if the resources are loaded and ready, false otherwise.<br />
596 /// <since_tizen> 3 </since_tizen>
597 public new bool IsResourceReady()
599 bool ret = Interop.View.IsResourceReady(swigCPtr);
600 if (NDalicPINVOKE.SWIGPendingException.Pending)
601 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 /// Forcefully reloads the image. All the visuals using this image will reload to the latest image.
608 /// <since_tizen> 5 </since_tizen>
611 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0));
615 /// Plays the animated GIF. This is also the default playback mode.
617 /// <since_tizen> 5 </since_tizen>
620 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0));
624 /// Pauses the animated GIF.
626 /// <since_tizen> 5 </since_tizen>
629 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0));
633 /// Stops the animated GIF.
635 /// <since_tizen> 5 </since_tizen>
638 this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0));
642 /// Gets or sets the URL of the alpha mask.<br />
645 /// <since_tizen> 6</since_tizen>
646 [EditorBrowsable(EditorBrowsableState.Never)]
647 public string AlphaMaskURL
652 PropertyMap imageMap = new PropertyMap();
653 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
654 imageMap?.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret);
665 UpdateImage(ImageVisualProperty.AlphaMaskURL, new PropertyValue(value));
671 /// Whether to crop image to mask or scale mask to fit image.
673 /// <since_tizen> 6 </since_tizen>
674 [EditorBrowsable(EditorBrowsableState.Never)]
675 public bool CropToMask
680 PropertyMap imageMap = new PropertyMap();
681 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
682 imageMap?.Find(ImageVisualProperty.CropToMask)?.Get(out ret);
688 UpdateImage(ImageVisualProperty.CropToMask, new PropertyValue(value));
694 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
695 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
696 /// For normal quad images only.<br />
699 /// <since_tizen> 6 </since_tizen>
700 [EditorBrowsable(EditorBrowsableState.Never)]
701 public FittingModeType FittingMode
705 int ret = (int)FittingModeType.ShrinkToFit;
706 PropertyMap imageMap = new PropertyMap();
707 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
708 imageMap?.Find(ImageVisualProperty.FittingMode)?.Get(out ret);
710 return (FittingModeType)ret;
714 UpdateImage(ImageVisualProperty.CropToMask, new PropertyValue((int)value));
721 /// Gets or sets the desired image width.<br />
722 /// If not specified, the actual image width is used.<br />
723 /// For normal quad images only.<br />
726 /// <since_tizen> 6 </since_tizen>
727 [EditorBrowsable(EditorBrowsableState.Never)]
728 public int DesiredWidth
733 PropertyMap imageMap = new PropertyMap();
734 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
735 imageMap?.Find(ImageVisualProperty.DesiredWidth)?.Get(out ret);
741 UpdateImage(ImageVisualProperty.DesiredWidth, new PropertyValue(value));
746 /// Gets or sets the desired image height.<br />
747 /// If not specified, the actual image height is used.<br />
748 /// For normal quad images only.<br />
751 /// <since_tizen> 6 </since_tizen>
752 [EditorBrowsable(EditorBrowsableState.Never)]
753 public int DesiredHeight
758 PropertyMap imageMap = new PropertyMap();
759 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
760 imageMap?.Find(ImageVisualProperty.DesiredHeight)?.Get(out ret);
766 UpdateImage(ImageVisualProperty.DesiredHeight, new PropertyValue(value));
772 /// Gets or sets the wrap mode for the u coordinate.<br />
773 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
774 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
775 /// For normal quad images only.<br />
778 /// <since_tizen> 6 </since_tizen>
779 [EditorBrowsable(EditorBrowsableState.Never)]
780 public WrapModeType WrapModeU
784 int ret = (int)WrapModeType.Default;
785 PropertyMap imageMap = new PropertyMap();
786 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
787 imageMap?.Find(ImageVisualProperty.WrapModeU)?.Get(out ret);
789 return (WrapModeType)ret;
793 UpdateImage(ImageVisualProperty.WrapModeU, new PropertyValue((int)value));
798 /// Gets or sets the wrap mode for the v coordinate.<br />
799 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
800 /// 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 />
801 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
802 /// For normal quad images only.
805 /// <since_tizen> 6 </since_tizen>
806 [EditorBrowsable(EditorBrowsableState.Never)]
807 public WrapModeType WrapModeV
811 int ret = (int)WrapModeType.Default;
812 PropertyMap imageMap = new PropertyMap();
813 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
814 imageMap?.Find(ImageVisualProperty.WrapModeV)?.Get(out ret);
816 return (WrapModeType)ret;
820 UpdateImage(ImageVisualProperty.WrapModeV, new PropertyValue((int)value));
825 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj)
827 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
830 internal void SetImage(string url, Uint16Pair size)
832 Interop.ImageView.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 internal ViewResourceReadySignal ResourceReadySignal(View view)
840 ViewResourceReadySignal ret = new ViewResourceReadySignal(Interop.View.ResourceReadySignal(View.getCPtr(view)), false);
841 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845 internal ResourceLoadingStatusType GetResourceStatus()
847 return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
851 /// you can override it to clean-up your own resources.
853 /// <param name="type">DisposeTypes</param>
854 /// <since_tizen> 3 </since_tizen>
855 protected override void Dispose(DisposeTypes type)
862 if (type == DisposeTypes.Explicit)
865 //Release your own managed resources here.
866 //You should release all of your own disposable objects here.
871 //Release your own unmanaged resources here.
872 //You should not access any managed member here except static instance.
873 //because the execution order of Finalizes is non-deterministic.
875 if (swigCPtr.Handle != global::System.IntPtr.Zero)
880 Interop.ImageView.delete_ImageView(swigCPtr);
882 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
888 // Callback for View ResourceReady signal
889 private void OnResourceReady(IntPtr data)
891 ResourceReadyEventArgs e = new ResourceReadyEventArgs();
894 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
897 if (_resourceReadyEventHandler != null)
899 _resourceReadyEventHandler(this, e);
903 private void UpdateImageMap(PropertyMap fromMap)
905 PropertyMap imageMap = new PropertyMap();
906 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
907 imageMap.Merge(fromMap);
909 SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap));
912 private void UpdateImage(int key, PropertyValue value)
914 PropertyMap temp = new PropertyMap();
916 if (_resourceUrl == "")
918 temp.Insert(ImageVisualProperty.URL, new PropertyValue(_resourceUrl));
919 SetProperty(ImageView.Property.IMAGE, new PropertyValue(temp));
925 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
929 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
930 temp.Insert(NpatchImageVisualProperty.Border, new PropertyValue(_border));
935 temp.Insert(key, value);
938 UpdateImageMap(temp);
945 private void OnResourceLoaded(IntPtr view)
947 ResourceLoadedEventArgs e = new ResourceLoadedEventArgs();
948 e.Status = (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
950 if (_resourceLoadedEventHandler != null)
952 _resourceLoadedEventHandler(this, e);
957 /// Event arguments of resource ready.
959 /// <since_tizen> 3 </since_tizen>
960 public class ResourceReadyEventArgs : EventArgs
965 /// The view whose resource is ready.
967 /// <since_tizen> 3 </since_tizen>
981 internal class ResourceLoadedEventArgs : EventArgs
983 private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
984 public ResourceLoadingStatusType Status
997 internal new class Property
999 internal static readonly int RESOURCE_URL = Interop.ImageView.ImageView_Property_RESOURCE_URL_get();
1000 internal static readonly int IMAGE = Interop.ImageView.ImageView_Property_IMAGE_get();
1001 internal static readonly int PRE_MULTIPLIED_ALPHA = Interop.ImageView.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
1002 internal static readonly int PIXEL_AREA = Interop.ImageView.ImageView_Property_PIXEL_AREA_get();
1003 internal static readonly int ACTION_RELOAD = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
1004 internal static readonly int ACTION_PLAY = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
1005 internal static readonly int ACTION_PAUSE = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
1006 internal static readonly int ACTION_STOP = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_STOP_get();
1009 private enum ImageType
1012 /// For Normal Image.
1017 /// For normal image, with synchronous loading and orientation correction property
1022 /// For nine-patch image