00c725899247634bd416e5c0b3105b64d0544add
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ImageView.cs
1 /*
2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 *
16 */
17 using System;
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
21
22 namespace Tizen.NUI.BaseComponents
23 {
24
25     /// <summary>
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 />
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public class ImageView : View
31     {
32         static ImageView() { }
33
34         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
35         [EditorBrowsable(EditorBrowsableState.Never)]
36         public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
37         {
38             var imageView = (ImageView)bindable;
39             string url = (string)newValue;
40             url = (url == null ? "" : url);
41             if (imageView.IsCreateByXaml && url.Contains("*Resource*"))
42             {
43                 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
44                 url = url.Replace("*Resource*", resource);
45             }
46             imageView._resourceUrl = url;
47             imageView.UpdateImage(ImageVisualProperty.URL, new PropertyValue(url));
48         },
49         defaultValueCreator: (bindable) =>
50         {
51             var imageView = (ImageView)bindable;
52             string ret = "";
53
54             PropertyMap imageMap = new PropertyMap();
55             Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
56             imageMap.Find(ImageVisualProperty.URL)?.Get(out ret);
57             return ret;
58         });
59
60         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(ImageView.Image), typeof(PropertyMap), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
63         {
64             var imageView = (ImageView)bindable;
65             if (newValue != null)
66             {
67                 PropertyMap map = (PropertyMap)newValue;
68                 if (imageView.IsCreateByXaml)
69                 {
70                     string url = "", alphaMaskURL = "", auxiliaryImageURL = "";
71                     string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
72                     PropertyValue urlValue = map.Find(NDalic.IMAGE_VISUAL_URL);
73                     bool ret = false;
74                     if (urlValue != null) ret = urlValue.Get(out url);
75                     PropertyMap mmap = new PropertyMap();
76                     if (ret && url.Contains("*Resource*"))
77                     {
78                         url = url.Replace("*Resource*", resource);
79                         mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(url));
80                     }
81
82                     ret = false;
83                     PropertyValue alphaMaskUrlValue = map.Find(NDalic.IMAGE_VISUAL_ALPHA_MASK_URL);
84                     if (alphaMaskUrlValue != null) ret = alphaMaskUrlValue.Get(out alphaMaskURL);
85                     if (ret && alphaMaskURL.Contains("*Resource*"))
86                     {
87                         alphaMaskURL = alphaMaskURL.Replace("*Resource*", resource);
88                         mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(alphaMaskURL));
89                     }
90
91                     ret = false;
92                     PropertyValue auxiliaryImageURLValue = map.Find(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL);
93                     if (auxiliaryImageURLValue != null) ret = auxiliaryImageURLValue.Get(out auxiliaryImageURL);
94                     if (ret && auxiliaryImageURL.Contains("*Resource*"))
95                     {
96                         auxiliaryImageURL = auxiliaryImageURL.Replace("*Resource*", resource);
97                         mmap.Insert(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL, new PropertyValue(auxiliaryImageURL));
98                     }
99
100                     map.Merge(mmap);
101                 }
102                 if (imageView._border == null)
103                 {
104                     Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(map));
105                 }
106             }
107         },
108         defaultValueCreator: (bindable) =>
109         {
110             var imageView = (ImageView)bindable;
111             if (imageView._border == null)
112             {
113                 PropertyMap temp = new PropertyMap();
114                 Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(temp);
115                 return temp;
116             }
117             else
118             {
119                 return null;
120             }
121         });
122
123         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public static readonly BindableProperty PreMultipliedAlphaProperty = BindableProperty.Create(nameof(PreMultipliedAlpha), typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
126         {
127             var imageView = (ImageView)bindable;
128             if (newValue != null)
129             {
130                 Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue((bool)newValue));
131             }
132         },
133         defaultValueCreator: (bindable) =>
134         {
135             var imageView = (ImageView)bindable;
136             bool temp = false;
137             Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(out temp);
138             return temp;
139         });
140
141         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
142         [EditorBrowsable(EditorBrowsableState.Never)]
143         public static readonly BindableProperty PixelAreaProperty = BindableProperty.Create(nameof(PixelArea), typeof(RelativeVector4), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
144         {
145             var imageView = (ImageView)bindable;
146             if (newValue != null)
147             {
148                 Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue((RelativeVector4)newValue));
149             }
150         },
151         defaultValueCreator: (bindable) =>
152         {
153             var imageView = (ImageView)bindable;
154             Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
155             Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA).Get(temp);
156             RelativeVector4 relativeTemp = new RelativeVector4(temp.X, temp.Y, temp.Z, temp.W);
157             return relativeTemp;
158         });
159
160         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
161         [EditorBrowsable(EditorBrowsableState.Never)]
162         public static readonly BindableProperty BorderProperty = BindableProperty.Create(nameof(Border), typeof(Rectangle), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
163         {
164             var imageView = (ImageView)bindable;
165             if (newValue != null)
166             {
167                 imageView._border = new Rectangle((Rectangle)newValue);
168                 imageView.UpdateImage(NpatchImageVisualProperty.Border, new PropertyValue(imageView._border));
169             }
170         },
171         defaultValueCreator: (bindable) =>
172         {
173             var imageView = (ImageView)bindable;
174             return imageView._border;
175         });
176
177         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178         [EditorBrowsable(EditorBrowsableState.Never)]
179         public static readonly BindableProperty BorderOnlyProperty = BindableProperty.Create(nameof(BorderOnly), typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
180         {
181             var imageView = (ImageView)bindable;
182             if (newValue != null)
183             {
184                 imageView.UpdateImage(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)newValue));
185             }
186         },
187         defaultValueCreator: (bindable) =>
188         {
189             var imageView = (ImageView)bindable;
190             bool ret = false;
191             PropertyMap imageMap = new PropertyMap();
192             Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
193             imageMap.Find(ImageVisualProperty.BorderOnly)?.Get(out ret);
194             return ret;
195         });
196
197         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
198         [EditorBrowsable(EditorBrowsableState.Never)]
199         public static readonly BindableProperty SynchronosLoadingProperty = BindableProperty.Create(nameof(SynchronosLoading), typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
200         {
201             var imageView = (ImageView)bindable;
202             if (newValue != null)
203             {
204                 imageView._synchronosLoading = (bool)newValue;
205                 imageView.UpdateImage(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)newValue));
206             }
207         },
208         defaultValueCreator: (bindable) =>
209         {
210             var imageView = (ImageView)bindable;
211             return imageView._synchronosLoading;
212         });
213
214         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
215         [EditorBrowsable(EditorBrowsableState.Never)]
216         public static readonly BindableProperty OrientationCorrectionProperty = BindableProperty.Create(nameof(OrientationCorrection), typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
217         {
218             var imageView = (ImageView)bindable;
219             if (newValue != null)
220             {
221                 imageView.UpdateImage(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)newValue));
222             }
223         },
224         defaultValueCreator: (bindable) =>
225         {
226             var imageView = (ImageView)bindable;
227
228             bool ret = false;
229             PropertyMap imageMap = new PropertyMap();
230             Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
231             imageMap?.Find(ImageVisualProperty.OrientationCorrection)?.Get(out ret);
232
233             return ret;
234         });
235
236         internal static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
237         {
238             var imageView = (ImageView)bindable;
239             imageView.resourceUrlSelector.Update(imageView, (Selector<string>)newValue, true);
240         },
241         defaultValueCreator: (bindable) =>
242         {
243             var imageView = (ImageView)bindable;
244             return imageView.resourceUrlSelector.Get(imageView);
245         });
246
247         internal static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
248         {
249             var imageView = (ImageView)bindable;
250             imageView.borderSelector.Update(imageView, (Selector<Rectangle>)newValue, true);
251         },
252         defaultValueCreator: (bindable) =>
253         {
254             var imageView = (ImageView)bindable;
255             return imageView.borderSelector.Get(imageView);
256         });
257
258         private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
259         private ResourceReadyEventCallbackType _resourceReadyEventCallback;
260         private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
261         private _resourceLoadedCallbackType _resourceLoadedCallback;
262
263         private Rectangle _border;
264         private string _resourceUrl = "";
265         private bool _synchronosLoading = false;
266         private string _alphaMaskUrl = null;
267         private int _desired_width = -1;
268         private int _desired_height = -1;
269         private readonly TriggerableSelector<string> resourceUrlSelector = new TriggerableSelector<string>(ResourceUrlProperty);
270         private readonly TriggerableSelector<Rectangle> borderSelector = new TriggerableSelector<Rectangle>(BorderProperty);
271
272         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
273         [EditorBrowsable(EditorBrowsableState.Never)]
274         public ImageViewStyle Style => new ImageViewStyle(this);
275
276         /// <summary>
277         /// Creates an initialized ImageView.
278         /// </summary>
279         /// <since_tizen> 3 </since_tizen>
280         public ImageView() : this(Interop.ImageView.ImageView_New__SWIG_0(), true)
281         {
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283         }
284
285         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
286         [EditorBrowsable(EditorBrowsableState.Never)]
287         public ImageView(ViewStyle viewStyle) : this(Interop.ImageView.ImageView_New__SWIG_0(), true, viewStyle)
288         {
289         }
290
291         /// <summary>
292         /// Creates an initialized ImageView with setting the status of shown or hidden.
293         /// </summary>
294         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
295         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
296         [EditorBrowsable(EditorBrowsableState.Never)]
297         public ImageView(bool shown) : this(Interop.ImageView.ImageView_New__SWIG_0(), true)
298         {
299             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300             SetVisible(shown);
301         }
302
303         /// <summary>
304         /// Creates an initialized ImageView from a URL to an image resource.<br />
305         /// If the string is empty, ImageView will not display anything.<br />
306         /// </summary>
307         /// <param name="url">The URL of the image resource to display.</param>
308         /// <since_tizen> 3 </since_tizen>
309         public ImageView(string url) : this(Interop.ImageView.ImageView_New__SWIG_2(url), true)
310         {
311             ResourceUrl = url;
312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313
314         }
315
316         /// <summary>
317         /// Creates an initialized ImageView from a URL to an image resource with setting shown or hidden.
318         /// </summary>
319         /// <param name="url">The URL of the image resource to display.</param>
320         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
321         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
322         [EditorBrowsable(EditorBrowsableState.Never)]
323         public ImageView(string url, bool shown) : this(Interop.ImageView.ImageView_New__SWIG_2(url), true)
324         {
325             ResourceUrl = url;
326             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327             SetVisible(shown);
328         }
329
330         internal ImageView(string url, Uint16Pair size, bool shown = true) : this(Interop.ImageView.ImageView_New__SWIG_3(url, Uint16Pair.getCPtr(size)), true)
331         {
332             ResourceUrl = url;
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334
335             if (!shown)
336             {
337                 SetVisible(false);
338             }
339         }
340
341         internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.ImageView.ImageView_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
342         {
343             if (!shown)
344             {
345                 SetVisible(false);
346             }
347         }
348
349         internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.ImageView.ImageView_SWIGUpcast(cPtr), cMemoryOwn, null)
350         {
351             if (!shown)
352             {
353                 SetVisible(false);
354             }
355         }
356
357         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
358         private delegate void ResourceReadyEventCallbackType(IntPtr data);
359         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
360         private delegate void _resourceLoadedCallbackType(IntPtr view);
361
362         /// <summary>
363         /// An event for ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
364         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
365         /// Most resources are only loaded when the control is placed on the stage.<br />
366         /// </summary>
367         /// <since_tizen> 3 </since_tizen>
368         public event EventHandler<ResourceReadyEventArgs> ResourceReady
369         {
370             add
371             {
372                 if (_resourceReadyEventHandler == null)
373                 {
374                     _resourceReadyEventCallback = OnResourceReady;
375                     ResourceReadySignal(this).Connect(_resourceReadyEventCallback);
376                 }
377
378                 _resourceReadyEventHandler += value;
379             }
380
381             remove
382             {
383                 _resourceReadyEventHandler -= value;
384
385                 if (_resourceReadyEventHandler == null && ResourceReadySignal(this).Empty() == false)
386                 {
387                     ResourceReadySignal(this).Disconnect(_resourceReadyEventCallback);
388                 }
389             }
390         }
391
392         internal event EventHandler<ResourceLoadedEventArgs> ResourceLoaded
393         {
394             add
395             {
396                 if (_resourceLoadedEventHandler == null)
397                 {
398                     _resourceLoadedCallback = OnResourceLoaded;
399                     this.ResourceReadySignal(this).Connect(_resourceLoadedCallback);
400                 }
401
402                 _resourceLoadedEventHandler += value;
403             }
404             remove
405             {
406                 _resourceLoadedEventHandler -= value;
407
408                 if (_resourceLoadedEventHandler == null && this.ResourceReadySignal(this).Empty() == false)
409                 {
410                     this.ResourceReadySignal(this).Disconnect(_resourceLoadedCallback);
411                 }
412             }
413         }
414
415         /// <summary>
416         /// Enumeration for LoadingStatus of image.
417         /// </summary>
418         /// <since_tizen> 5 </since_tizen>
419         public enum LoadingStatusType
420         {
421             /// <summary>
422             /// Loading preparing status.
423             /// </summary>
424             /// <since_tizen> 5 </since_tizen>
425             Preparing,
426             /// <summary>
427             /// Loading ready status.
428             /// </summary>
429             /// <since_tizen> 5 </since_tizen>
430             Ready,
431             /// <summary>
432             /// Loading failed status.
433             /// </summary>
434             /// <since_tizen> 5 </since_tizen>
435             Failed
436         }
437
438         /// <summary>
439         /// ImageView ResourceUrl, type string.
440         /// This is one of mandatory property. Even if not set or null set, it sets empty string ("") internally.
441         /// When it is set as null, it gives empty string ("") to be read.
442         /// </summary>
443         /// <since_tizen> 3 </since_tizen>
444         public string ResourceUrl
445         {
446             get
447             {
448                 return (string)GetValue(ResourceUrlProperty);
449             }
450             set
451             {
452                 SetValue(ResourceUrlProperty, value);
453                 resourceUrlSelector.UpdateIfNeeds(this, value);
454                 NotifyPropertyChanged();
455             }
456         }
457
458         /// <summary>
459         /// This will be deprecated, please use Image instead. <br />
460         /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise.
461         /// </summary>
462         /// <since_tizen> 3 </since_tizen>
463         [Obsolete("Please do not use! This will be deprecated! Please use Image property instead!")]
464         [EditorBrowsable(EditorBrowsableState.Never)]
465         public PropertyMap ImageMap
466         {
467             get
468             {
469                 if (_border == null)
470                 {
471                     PropertyMap temp = new PropertyMap();
472                     GetProperty(ImageView.Property.IMAGE).Get(temp);
473                     return temp;
474                 }
475                 else
476                 {
477                     return null;
478                 }
479             }
480             set
481             {
482                 if (_border == null)
483                 {
484                     SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
485                     NotifyPropertyChanged();
486                 }
487             }
488         }
489
490         /// <summary>
491         /// ImageView Image, type PropertyMap
492         /// </summary>
493         /// <since_tizen> 4 </since_tizen>
494         public PropertyMap Image
495         {
496             get
497             {
498                 if (_border == null)
499                 {
500                     return (PropertyMap)GetValue(ImageProperty);
501                 }
502                 else
503                 {
504                     return null;
505                 }
506             }
507             set
508             {
509                 if (_border == null)
510                 {
511                     SetValue(ImageProperty, value);
512                     NotifyPropertyChanged();
513                 }
514             }
515         }
516
517         /// <summary>
518         /// ImageView PreMultipliedAlpha, type Boolean.<br />
519         /// Image must be initialized.<br />
520         /// </summary>
521         /// <since_tizen> 3 </since_tizen>
522         public bool PreMultipliedAlpha
523         {
524             get
525             {
526                 return (bool)GetValue(PreMultipliedAlphaProperty);
527             }
528             set
529             {
530                 SetValue(PreMultipliedAlphaProperty, value);
531                 NotifyPropertyChanged();
532             }
533         }
534
535         /// <summary>
536         /// ImageView PixelArea, type Vector4 (Animatable property).<br />
537         /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].<br />
538         /// </summary>
539         /// <remarks>
540         /// The property cascade chaining set is possible. For example, this (imageView.PixelArea.X = 0.1f;) is possible.
541         /// </remarks>
542         /// <since_tizen> 3 </since_tizen>
543         public RelativeVector4 PixelArea
544         {
545             get
546             {
547                 RelativeVector4 temp = (RelativeVector4)GetValue(PixelAreaProperty);
548                 return new RelativeVector4(OnPixelAreaChanged, temp.X, temp.Y, temp.Z, temp.W);
549             }
550             set
551             {
552                 SetValue(PixelAreaProperty, value);
553                 NotifyPropertyChanged();
554             }
555         }
556
557         /// <summary>
558         /// The border of the image in the order: left, right, bottom, top.<br />
559         /// If set, ImageMap will be ignored.<br />
560         /// For N-Patch images only.<br />
561         /// Optional.
562         /// </summary>
563         /// <remarks>
564         /// The property cascade chaining set is possible. For example, this (imageView.Border.X = 1;) is possible.
565         /// </remarks>
566         /// <since_tizen> 3 </since_tizen>
567         public Rectangle Border
568         {
569             get
570             {
571                 Rectangle temp = (Rectangle)GetValue(BorderProperty);
572                 if (null == temp)
573                 {
574                     return null;
575                 }
576                 else
577                 {
578                     return new Rectangle(OnBorderChanged, temp.X, temp.Y, temp.Width, temp.Height);
579                 }
580             }
581             set
582             {
583                 SetValue(BorderProperty, value);
584                 borderSelector.UpdateIfNeeds(this, value);
585                 NotifyPropertyChanged();
586             }
587         }
588
589         /// <summary>
590         /// Gets or sets whether to draw the borders only (if true).<br />
591         /// If not specified, the default is false.<br />
592         /// For N-Patch images only.<br />
593         /// Optional.
594         /// </summary>
595         /// <since_tizen> 3 </since_tizen>
596         public bool BorderOnly
597         {
598             get
599             {
600                 return (bool)GetValue(BorderOnlyProperty);
601             }
602             set
603             {
604                 SetValue(BorderOnlyProperty, value);
605                 NotifyPropertyChanged();
606             }
607         }
608
609         /// <summary>
610         /// Gets or sets whether to synchronos loading the resourceurl of image.<br />
611         /// </summary>
612         /// <since_tizen> 3 </since_tizen>
613         public bool SynchronosLoading
614         {
615             get
616             {
617                 return (bool)GetValue(SynchronosLoadingProperty);
618             }
619             set
620             {
621                 SetValue(SynchronosLoadingProperty, value);
622                 NotifyPropertyChanged();
623             }
624         }
625
626         /// <summary>
627         /// Gets or sets whether to automatically correct the orientation of an image.<br />
628         /// </summary>
629         /// <since_tizen> 5 </since_tizen>
630         public bool OrientationCorrection
631         {
632             get
633             {
634                 return (bool)GetValue(OrientationCorrectionProperty);
635             }
636             set
637             {
638                 SetValue(OrientationCorrectionProperty, value);
639                 NotifyPropertyChanged();
640             }
641         }
642
643         /// <summary>
644         /// Gets the loading state of the visual resource.
645         /// </summary>
646         /// <since_tizen> 5 </since_tizen>
647         public ImageView.LoadingStatusType LoadingStatus
648         {
649             get
650             {
651                 return (ImageView.LoadingStatusType)Interop.View.View_GetVisualResourceStatus(swigCPtr, (int)Property.IMAGE);
652             }
653         }
654
655         /// <summary>
656         /// Downcasts a handle to imageView handle.
657         /// </summary>
658         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
659         /// Please do not use! this will be deprecated!
660         /// Instead please use as keyword.
661         /// <since_tizen> 3 </since_tizen>
662         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
663         "Like: " +
664         "BaseHandle handle = new ImageView(imagePath); " +
665         "ImageView image = handle as ImageView")]
666         [EditorBrowsable(EditorBrowsableState.Never)]
667         public static ImageView DownCast(BaseHandle handle)
668         {
669             if (null == handle)
670             {
671                 throw new ArgumentNullException(nameof(handle));
672             }
673             ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
674             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675             return ret;
676         }
677
678         /// <summary>
679         /// Sets this ImageView from the given URL.<br />
680         /// If the URL is empty, ImageView will not display anything.<br />
681         /// </summary>
682         /// <param name="url">The URL to the image resource to display.</param>
683         /// <exception cref="ArgumentNullException"> Thrown when url is null. </exception>
684         /// <since_tizen> 3 </since_tizen>
685         public void SetImage(string url)
686         {
687             if (null == url)
688             {
689                 throw new ArgumentNullException(nameof(url));
690             }
691
692             if (url.Contains(".json"))
693             {
694                 Tizen.Log.Fatal("NUI", "[ERROR] Please DO NOT set lottie file in ImageView! This is temporary checking, will be removed soon!");
695                 return;
696             }
697
698             Interop.ImageView.ImageView_SetImage__SWIG_1(swigCPtr, url);
699             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700
701             ResourceUrl = url;
702         }
703
704         /// <summary>
705         /// Queries if all resources required by a control are loaded and ready.<br />
706         /// Most resources are only loaded when the control is placed on the stage.<br />
707         /// True if the resources are loaded and ready, false otherwise.<br />
708         /// </summary>
709         /// <since_tizen> 3 </since_tizen>
710         public new bool IsResourceReady()
711         {
712             bool ret = Interop.View.IsResourceReady(swigCPtr);
713             if (NDalicPINVOKE.SWIGPendingException.Pending)
714                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715             return ret;
716         }
717
718         /// <summary>
719         /// Forcefully reloads the image. All the visuals using this image will reload to the latest image.
720         /// </summary>
721         /// <since_tizen> 5 </since_tizen>
722         public void Reload()
723         {
724             this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0));
725         }
726
727         /// <summary>
728         /// Plays the animated GIF. This is also the default playback mode.
729         /// </summary>
730         /// <since_tizen> 5 </since_tizen>
731         public void Play()
732         {
733             this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0));
734         }
735
736         /// <summary>
737         /// Pauses the animated GIF.
738         /// </summary>
739         /// <since_tizen> 5 </since_tizen>
740         public void Pause()
741         {
742             this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0));
743         }
744
745         /// <summary>
746         /// Stops the animated GIF.
747         /// </summary>
748         /// <since_tizen> 5 </since_tizen>
749         public void Stop()
750         {
751             this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0));
752         }
753
754         /// <summary>
755         /// Gets or sets the URL of the alpha mask.<br />
756         /// Optional.
757         /// </summary>
758         /// <since_tizen> 6</since_tizen>
759         [EditorBrowsable(EditorBrowsableState.Never)]
760         public string AlphaMaskURL
761         {
762             get
763             {
764                 string ret = "";
765                 PropertyMap imageMap = new PropertyMap();
766                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
767                 imageMap?.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret);
768
769                 _alphaMaskUrl = ret;
770                 return ret;
771             }
772             set
773             {
774                 if (value == null)
775                 {
776                     value = "";
777                 }
778
779                 _alphaMaskUrl = value;
780                 UpdateImage(ImageVisualProperty.AlphaMaskURL, new PropertyValue(value));
781             }
782         }
783
784
785         /// <summary>
786         ///  Whether to crop image to mask or scale mask to fit image.
787         /// </summary>
788         /// <since_tizen> 6 </since_tizen>
789         public bool CropToMask
790         {
791             get
792             {
793                 bool ret = false;
794                 PropertyMap imageMap = new PropertyMap();
795                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
796                 imageMap?.Find(ImageVisualProperty.CropToMask)?.Get(out ret);
797
798                 return ret;
799             }
800             set
801             {
802                 UpdateImage(ImageVisualProperty.CropToMask, new PropertyValue(value));
803             }
804         }
805
806         internal VisualFittingModeType CovertFittingModetoVisualFittingMode(FittingModeType value)
807         {
808             switch (value)
809             {
810                 case FittingModeType.ShrinkToFit:
811                     return VisualFittingModeType.FitKeepAspectRatio;
812                 case FittingModeType.ScaleToFill:
813                     return VisualFittingModeType.OverFitKeepAspectRatio;
814                 case FittingModeType.Center:
815                     return VisualFittingModeType.Center;
816                 case FittingModeType.Fill:
817                     return VisualFittingModeType.Fill;
818                 case FittingModeType.FitHeight:
819                     return VisualFittingModeType.FitHeight;
820                 case FittingModeType.FitWidth:
821                     return VisualFittingModeType.FitHeight;
822                 default:
823                     return VisualFittingModeType.Fill;
824             }
825         }
826
827         internal FittingModeType ConvertVisualFittingModetoFittingMode(VisualFittingModeType value)
828         {
829             switch (value)
830             {
831                 case VisualFittingModeType.FitKeepAspectRatio:
832                     return FittingModeType.ShrinkToFit;
833                 case VisualFittingModeType.OverFitKeepAspectRatio:
834                     return FittingModeType.ScaleToFill;
835                 case VisualFittingModeType.Center:
836                     return FittingModeType.Center;
837                 case VisualFittingModeType.Fill:
838                     return FittingModeType.Fill;
839                 case VisualFittingModeType.FitHeight:
840                     return FittingModeType.FitHeight;
841                 case VisualFittingModeType.FitWidth:
842                     return FittingModeType.FitWidth;
843                 default:
844                     return FittingModeType.ShrinkToFit;
845             }
846         }
847
848         /// <summary>
849         /// Gets or sets fitting options used when resizing images to fit.<br />
850         /// If not supplied, the default is FittingModeType.Fill.<br />
851         /// For normal quad images only.<br />
852         /// Optional.
853         /// </summary>
854         /// <since_tizen> 6 </since_tizen>
855         [EditorBrowsable(EditorBrowsableState.Never)]
856         public FittingModeType FittingMode
857         {
858             get
859             {
860                 int ret = (int)VisualFittingModeType.Fill;
861                 PropertyMap imageMap = new PropertyMap();
862                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
863                 imageMap?.Find(Visual.Property.VisualFittingMode)?.Get(out ret);
864                 return ConvertVisualFittingModetoFittingMode((VisualFittingModeType)ret);
865             }
866             set
867             {
868                 VisualFittingModeType ret = CovertFittingModetoVisualFittingMode(value);
869                 UpdateImage(Visual.Property.VisualFittingMode, new PropertyValue((int)ret));
870             }
871         }
872
873
874
875         /// <summary>
876         /// Gets or sets the desired image width.<br />
877         /// If not specified, the actual image width is used.<br />
878         /// For normal quad images only.<br />
879         /// Optional.
880         /// </summary>
881         /// <since_tizen> 6 </since_tizen>
882         [EditorBrowsable(EditorBrowsableState.Never)]
883         public int DesiredWidth
884         {
885             get
886             {
887                 PropertyMap imageMap = new PropertyMap();
888                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
889                 imageMap?.Find(ImageVisualProperty.DesiredWidth)?.Get(out _desired_width);
890
891                 return _desired_width;
892             }
893             set
894             {
895                 if (_desired_width != value)
896                 {
897                     _desired_width = value;
898                     UpdateImage(0, null);
899                 }
900             }
901         }
902
903         /// <summary>
904         /// Gets or sets the desired image height.<br />
905         /// If not specified, the actual image height is used.<br />
906         /// For normal quad images only.<br />
907         /// Optional.
908         /// </summary>
909         /// <since_tizen> 6 </since_tizen>
910         [EditorBrowsable(EditorBrowsableState.Never)]
911         public int DesiredHeight
912         {
913             get
914             {
915                 PropertyMap imageMap = new PropertyMap();
916                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
917                 imageMap?.Find(ImageVisualProperty.DesiredHeight)?.Get(out _desired_height);
918
919                 return _desired_height;
920             }
921             set
922             {
923                 if (_desired_height != value)
924                 {
925                     _desired_height = value;
926                     UpdateImage(0, null);
927                 }
928             }
929         }
930
931         /// <summary>
932         /// Gets or sets ReleasePolicy for image.<br />
933         /// If not supplied, the default is ReleasePolicyType.Detached.<br />
934         /// </summary>
935         [EditorBrowsable(EditorBrowsableState.Never)]
936         public ReleasePolicyType ReleasePolicy
937         {
938             get
939             {
940                 int ret = (int)ReleasePolicyType.Detached;
941                 PropertyMap imageMap = new PropertyMap();
942                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
943                 imageMap?.Find(ImageVisualProperty.ReleasePolicy)?.Get(out ret);
944                 return (ReleasePolicyType)ret;
945             }
946             set
947             {
948                 UpdateImage(ImageVisualProperty.ReleasePolicy, new PropertyValue((int)value));
949             }
950         }
951
952         /// <summary>
953         /// Gets or sets the wrap mode for the u coordinate.<br />
954         /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
955         /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
956         /// For normal quad images only.<br />
957         /// Optional.
958         /// </summary>
959         /// <since_tizen> 6 </since_tizen>
960         [EditorBrowsable(EditorBrowsableState.Never)]
961         public WrapModeType WrapModeU
962         {
963             get
964             {
965                 int ret = (int)WrapModeType.Default;
966                 PropertyMap imageMap = new PropertyMap();
967                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
968                 imageMap?.Find(ImageVisualProperty.WrapModeU)?.Get(out ret);
969
970                 return (WrapModeType)ret;
971             }
972             set
973             {
974                 UpdateImage(ImageVisualProperty.WrapModeU, new PropertyValue((int)value));
975             }
976         }
977
978         /// <summary>
979         /// Gets or sets the wrap mode for the v coordinate.<br />
980         /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
981         /// 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 />
982         /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
983         /// For normal quad images only.
984         /// Optional.
985         /// </summary>
986         /// <since_tizen> 6 </since_tizen>
987         [EditorBrowsable(EditorBrowsableState.Never)]
988         public WrapModeType WrapModeV
989         {
990             get
991             {
992                 int ret = (int)WrapModeType.Default;
993                 PropertyMap imageMap = new PropertyMap();
994                 Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
995                 imageMap?.Find(ImageVisualProperty.WrapModeV)?.Get(out ret);
996
997                 return (WrapModeType)ret;
998             }
999             set
1000             {
1001                 UpdateImage(ImageVisualProperty.WrapModeV, new PropertyValue((int)value));
1002             }
1003         }
1004
1005         /// <summary>
1006         /// Get attribues, it is abstract function and must be override.
1007         /// </summary>
1008         /// <since_tizen> 6 </since_tizen>
1009         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1010         [EditorBrowsable(EditorBrowsableState.Never)]
1011         protected override ViewStyle GetViewStyle()
1012         {
1013             return new ImageViewStyle();
1014         }
1015
1016         internal void SetImage(string url, Uint16Pair size)
1017         {
1018             if (url.Contains(".json"))
1019             {
1020                 Tizen.Log.Fatal("NUI", "[ERROR] Please DO NOT set lottie file in ImageView! This is temporary checking, will be removed soon!");
1021                 return;
1022             }
1023
1024             Interop.ImageView.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
1025             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1026
1027             ResourceUrl = url;
1028         }
1029
1030         internal ViewResourceReadySignal ResourceReadySignal(View view)
1031         {
1032             ViewResourceReadySignal ret = new ViewResourceReadySignal(Interop.View.ResourceReadySignal(View.getCPtr(view)), false);
1033             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1034             return ret;
1035         }
1036
1037         internal override void ApplyCornerRadius()
1038         {
1039             base.ApplyCornerRadius();
1040
1041             UpdateImage(0, null);
1042         }
1043
1044         internal ResourceLoadingStatusType GetResourceStatus()
1045         {
1046             return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
1047         }
1048
1049         /// <summary>
1050         /// you can override it to clean-up your own resources.
1051         /// </summary>
1052         /// <param name="type">DisposeTypes</param>
1053         /// <since_tizen> 3 </since_tizen>
1054         protected override void Dispose(DisposeTypes type)
1055         {
1056             if (disposed)
1057             {
1058                 return;
1059             }
1060
1061             if (type == DisposeTypes.Explicit)
1062             {
1063                 //Called by User
1064                 //Release your own managed resources here.
1065                 //You should release all of your own disposable objects here.
1066                 _border?.Dispose();
1067                 _border = null;
1068                 borderSelector.Reset(this);
1069                 resourceUrlSelector.Reset(this);
1070             }
1071
1072             base.Dispose(type);
1073         }
1074
1075         /// This will not be public opened.
1076         [EditorBrowsable(EditorBrowsableState.Never)]
1077         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1078         {
1079             Interop.ImageView.delete_ImageView(swigCPtr);
1080         }
1081
1082         // Callback for View ResourceReady signal
1083         private void OnResourceReady(IntPtr data)
1084         {
1085             ResourceReadyEventArgs e = new ResourceReadyEventArgs();
1086             if (data != null)
1087             {
1088                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1089             }
1090
1091             if (_resourceReadyEventHandler != null)
1092             {
1093                 _resourceReadyEventHandler(this, e);
1094             }
1095         }
1096
1097         private void UpdateImageMap(PropertyMap fromMap)
1098         {
1099             PropertyMap imageMap = new PropertyMap();
1100             Tizen.NUI.Object.GetProperty(swigCPtr, ImageView.Property.IMAGE).Get(imageMap);
1101             imageMap.Merge(fromMap);
1102
1103             SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap));
1104         }
1105
1106         private void UpdateImage(int key, PropertyValue value)
1107         {
1108             PropertyMap temp = new PropertyMap();
1109
1110             if (_alphaMaskUrl != null)
1111             {
1112                 temp.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl));
1113             }
1114
1115             if (_resourceUrl == "")
1116             {
1117                 temp.Insert(ImageVisualProperty.URL, new PropertyValue(_resourceUrl));
1118                 SetProperty(ImageView.Property.IMAGE, new PropertyValue(temp));
1119                 return;
1120             }
1121
1122             if (_border == null)
1123             {
1124                 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
1125             }
1126             else
1127             {
1128                 temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1129                 temp.Insert(NpatchImageVisualProperty.Border, new PropertyValue(_border));
1130             }
1131
1132             temp.Insert(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue(_synchronosLoading));
1133
1134             if (backgroundExtraData != null && backgroundExtraData.CornerRadius > 0)
1135             {
1136                 temp.Insert(Visual.Property.CornerRadius, new PropertyValue(backgroundExtraData.CornerRadius));
1137             }
1138
1139             if (value != null)
1140             {
1141                 temp.Insert(key, value);
1142             }
1143
1144             // Do Fitting Buffer when desired dimension is set
1145             if (_desired_width != -1 && _desired_height != -1)
1146             {
1147                 if (_resourceUrl != null)
1148                 {
1149                     Size2D imageSize = ImageLoading.GetOriginalImageSize(_resourceUrl);
1150
1151                     int adjustedDesiredWidth, adjustedDesiredHeight;
1152                     float aspectOfDesiredSize = (float)_desired_height / (float)_desired_width;
1153                     float aspectOfImageSize = (float)imageSize.Height / (float)imageSize.Width;
1154                     if( aspectOfImageSize > aspectOfDesiredSize)
1155                     {
1156                         adjustedDesiredWidth = _desired_width;
1157                         adjustedDesiredHeight = imageSize.Height * _desired_width / imageSize.Width;
1158                     }
1159                     else
1160                     {
1161                         adjustedDesiredWidth = imageSize.Width * _desired_height/ imageSize.Height;
1162                         adjustedDesiredHeight = _desired_height;
1163                     }
1164                     temp.Insert(ImageVisualProperty.DesiredWidth, new PropertyValue(adjustedDesiredWidth));
1165                     temp.Insert(ImageVisualProperty.DesiredHeight, new PropertyValue(adjustedDesiredHeight));
1166                     temp.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)FittingModeType.ScaleToFill));
1167                 }
1168             }
1169
1170             UpdateImageMap(temp);
1171
1172             temp.Dispose();
1173             temp = null;
1174         }
1175
1176
1177         private void OnResourceLoaded(IntPtr view)
1178         {
1179             ResourceLoadedEventArgs e = new ResourceLoadedEventArgs();
1180             e.Status = (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
1181
1182             if (_resourceLoadedEventHandler != null)
1183             {
1184                 _resourceLoadedEventHandler(this, e);
1185             }
1186         }
1187
1188         /// <summary>
1189         /// Event arguments of resource ready.
1190         /// </summary>
1191         /// <since_tizen> 3 </since_tizen>
1192         public class ResourceReadyEventArgs : EventArgs
1193         {
1194             private View _view;
1195
1196             /// <summary>
1197             /// The view whose resource is ready.
1198             /// </summary>
1199             /// <since_tizen> 3 </since_tizen>
1200             public View View
1201             {
1202                 get
1203                 {
1204                     return _view;
1205                 }
1206                 set
1207                 {
1208                     _view = value;
1209                 }
1210             }
1211         }
1212
1213         internal class ResourceLoadedEventArgs : EventArgs
1214         {
1215             private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
1216             public ResourceLoadingStatusType Status
1217             {
1218                 get
1219                 {
1220                     return status;
1221                 }
1222                 set
1223                 {
1224                     status = value;
1225                 }
1226             }
1227         }
1228
1229         internal new class Property
1230         {
1231             internal static readonly int IMAGE = Interop.ImageView.ImageView_Property_IMAGE_get();
1232             internal static readonly int PRE_MULTIPLIED_ALPHA = Interop.ImageView.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
1233             internal static readonly int PIXEL_AREA = Interop.ImageView.ImageView_Property_PIXEL_AREA_get();
1234             internal static readonly int ACTION_RELOAD = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
1235             internal static readonly int ACTION_PLAY = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
1236             internal static readonly int ACTION_PAUSE = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
1237             internal static readonly int ACTION_STOP = Interop.ImageView.ImageView_IMAGE_VISUAL_ACTION_STOP_get();
1238         }
1239
1240         private enum ImageType
1241         {
1242             /// <summary>
1243             /// For Normal Image.
1244             /// </summary>
1245             Normal = 0,
1246
1247             /// <summary>
1248             /// For normal image, with synchronous loading and orientation correction property
1249             /// </summary>
1250             Specific = 1,
1251
1252             /// <summary>
1253             /// For nine-patch image
1254             /// </summary>
1255             Npatch = 2,
1256         }
1257
1258         private void OnBorderChanged(int x, int y, int width, int height)
1259         {
1260             Border = new Rectangle(x, y, width, height);
1261         }
1262         private void OnPixelAreaChanged(float x, float y, float z, float w)
1263         {
1264             PixelArea = new RelativeVector4(x, y, z, w);
1265         }
1266     }
1267 }