Exemplo n.º 1
0
		public static void CacheBrush(IElementBackground element)
		{
			if (element.BackgroundImageSource.HasValue && !_pictureBrushes.ContainsKey(element.BackgroundImageSource.Value))
			{
				var brush = GetBrush(element.BackgroundImageSource.Value, element.IsVectorImage);
				_pictureBrushes.Add(element.BackgroundImageSource.Value, brush);
			}
		}
Exemplo n.º 2
0
		public static void UpgradeBackground(IElementBackground element)
		{
			if (element.BackgroundPixels != null)
			{
				var guid = ServiceFactory.ContentService.AddContent(element.BackgroundPixels);
				element.BackgroundImageSource = guid;
				element.BackgroundPixels = null;
				ServiceFactory.SaveService.PlansChanged = true;
			}
			PainterCache.CacheBrush(element);
		}
Exemplo n.º 3
0
		public ImagePropertiesViewModel(IElementBackground element)
		{
			_drawing = null;
			_wmf = null;
			_newImage = false;
			_element = element;
			_sourceName = _element.BackgroundSourceName;
			_imageSource = _element.BackgroundImageSource;
			_svgImageSource = _element.BackgroundSVGImageSource;
			_imageType = _element.ImageType;
			SelectPictureCommand = new RelayCommand(OnSelectPicture);
			RemovePictureCommand = new RelayCommand(OnRemovePicture, CanRemovePicture);
			UpdateImage();

		}
		public ImagePropertiesViewModel(IElementBackground element)
		{
			_drawing = null;
			_newImage = false;
			_element = element;
			_sourceName = _element.BackgroundSourceName;
			_imageSource = _element.BackgroundImageSource;
			_isVectorImage = _element.IsVectorImage;
			_settings = new WpfDrawingSettings()
			{
				IncludeRuntime = false,
				TextAsGeometry = true,
				OptimizePath = true,
			};
			SelectPictureCommand = new RelayCommand(OnSelectPicture);
			RemovePictureCommand = new RelayCommand(OnRemovePicture, CanRemovePicture);
			UpdateImage();
		}
Exemplo n.º 5
0
		public static Brush GetBrush(IElementBackground element)
		{
            if (element.BackgroundImageSource.HasValue)
            {
                CacheBrush(element);
                return _pictureBrushes[element.BackgroundImageSource.Value];
                //return GetBrush(element.BackgroundImageSource.Value);
            }
            else if (element.AllowTransparent && element.BackgroundColor == Colors.Transparent)
                return UseTransparentImage ? _transparentBackgroundBrush : TransparentBrush;
            else
                return GetBrush(element.BackgroundColor);
		}
Exemplo n.º 6
0
		public static Brush GetTransparentBrush(IElementBackground element)
		{
			var brush = GetBrush(element);
			if (!_transparentBrushes.ContainsKey(brush))
			{
				var transparent = brush.CloneCurrentValue();
				transparent.Opacity = 0.5;
				transparent.Freeze();
				_transparentBrushes.Add(brush, transparent);
			}
			return _transparentBrushes[brush];
		}
Exemplo n.º 7
0
		public static void UpgradeBackground(IElementBackground element)
		{
			PainterCache.CacheBrush(element);
		}