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.ComponentModel;
24 /// The Shadow composed of image for View
26 [EditorBrowsable(EditorBrowsableState.Never)]
27 public class ImageShadow : TransformablePropertyMap
31 private Rectangle border;
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public ImageShadow() : base()
41 private void OnBorderChanged(int x, int y, int width, int height)
46 private void UpdateUrl()
48 propertyMap[ImageVisualProperty.URL] = PropertyValue.CreateWithGuard(url);
49 OnPropertyChanged?.Invoke(this);
52 private void UpdateBorder()
54 propertyMap[ImageVisualProperty.Border] = PropertyValue.CreateWithGuard(border);
55 OnPropertyChanged?.Invoke(this);
59 /// The url for the shadow image to load.
61 [EditorBrowsable(EditorBrowsableState.Never)]
77 /// The border area of the n-patch image.
78 /// Set left, right, bottom, top length of the border you don't want to stretch in the image.
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public Rectangle Border
89 border = value == null? null : new Rectangle(OnBorderChanged, value);
94 override internal string ToDebugString()
101 override internal bool IsValid()
106 static internal new PropertyValue ToPropertyValue(TransformablePropertyMap instance)
108 if (instance == null || !instance.IsValid())
110 return new PropertyValue();
113 instance.propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
115 return new PropertyValue(instance.propertyMap);