/// <summary> /// Leave a footprint at the current position. /// </summary> /// <returns></returns> public virtual Footprint Stamp() { Brush b1 = outlineBrush.CloneCurrentValue(); b1.Opacity = footprintOutlineOpacity; Brush b2 = bodyBrush.CloneCurrentValue(); b2.Opacity = footprintBodyOpacity; Path theUIE = createDefaultTurtleUI(b1, b2); return(Stamp(theUIE)); }
public override AppliedProperties GetAppliedProperties(IDataModel dataModel, bool ignoreDynamic = false) { var applied = new AppliedProperties { X = X, Y = Y, Width = Width, Height = Height, Opacity = Opacity, Brush = Brush.CloneCurrentValue() }; if (ignoreDynamic) { return(applied); } foreach (var dynamicProperty in DynamicProperties) { dynamicProperty.ApplyProperty(dataModel, ref applied); } if (Math.Abs(applied.Opacity - 1) > 0.001) { applied.Brush = Brush.CloneCurrentValue(); applied.Brush.Opacity = applied.Opacity; } return(applied); }
/// <summary/> public static TextureFilter RenderBrushToTextureFilter(Brush b, Point uvMin, Point uvMax, Rect screenSpaceBounds) { // For null brushes we create a corresponding null TextureFilter so that the material pass is ignored if (b == null) { return(null); } if (b is SolidColorBrush) { return(RenderBrushToTextureFilter((SolidColorBrush)b.CloneCurrentValue())); } if (b is GradientBrush) { return(RenderBrushToTextureFilter((GradientBrush)b.CloneCurrentValue(), uvMin, uvMax)); } if (b is TileBrush) { return(RenderBrushToTextureFilter((TileBrush)b.CloneCurrentValue(), uvMin, uvMax, screenSpaceBounds)); } // unsupported types throw throw new ApplicationException("Unknown brush type"); }
/** * Increase brightness of a brush. * */ public static SolidColorBrush LightenBrush(Brush brush, byte amount) { if (brush == null) { throw new ArgumentException(@"Brush parameter may not be null"); } SolidColorBrush newBrush = (SolidColorBrush)brush.CloneCurrentValue(); Color color = newBrush.Color; color.R += amount; color.G += amount; color.B += amount; newBrush.Color = color; return(newBrush); }
public void UpdateNodeBrushes(Brush newBrush, IReadOnlyList <BubbleNode> nodes) { if (chart == null || nodes == null || nodes.Count == 0) { return; } chart.SetCurrentValue(BubbleChart.HighlightNodeProperty, null); foreach (var node in nodes) { node.Shape.Fill = newBrush.CloneCurrentValue(); node.OriginalBrush = node.Shape.Fill.CloneCurrentValue(); } }
/// <summary>Internal method used to set the background brush on a Grid object</summary> /// <param name="grid">The grid on which to set these values.</param> /// <param name="brush">The brush.</param> /// <param name="lightFactor">The light factor.</param> /// <param name="opacity">The opacity.</param> /// <remarks>Combines BackgroundBrush, BackgroundBrushLightFactor, and BackgroundBrushOpacity to set the Background property</remarks> private static void SetBackground(Panel grid, Brush brush, double lightFactor, double opacity) { if (brush == null) { return; } var brush2 = brush.CloneCurrentValue(); brush2.Opacity = opacity; if (lightFactor < .999d || lightFactor > 1.001d) { var converter = new LitBrushConverter(); brush2 = converter.Convert(brush2, typeof(Brush), lightFactor, CultureInfo.InvariantCulture) as Brush; if (brush2 != null) { brush2.Opacity = opacity; } } grid.Background = brush2; }
public void UpdateNodeBrushes(Brush brush, IReadOnlyDictionary <int, IReadOnlyList <SankeyNode> > nodes) { if (diagram == null || brush == null || nodes == null || nodes.Count < 2) { return; } if (diagram.UsePallette == SankeyPalette.NodesLinks) { return; } ClearHighlight(); foreach (var levelNodes in nodes.Values) { foreach (var node in levelNodes) { node.Shape.Fill = brush.CloneCurrentValue(); } } }
private TSegment ConfigureSegment <TSegment>(TSegment segment, bool isSrc, int index, string ipSegment, Brush color, double columnHeight, Dictionary <string, int> ipSegmentDic, List <TSegment> nodes, string partIp) where TSegment : IpFlowIpSegment { var count = ipSegmentDic.Values.Sum(); var height = ipSegmentDic[ipSegment] / (double)count * columnHeight; segment.Height = height; segment.Segment = ipSegment; segment.Color = color != null?color.CloneCurrentValue() : styleManager.SetNodeBrush(); segment.OriginalBrush = segment.Color.CloneCurrentValue(); segment.Count = ipSegmentDic[ipSegment]; segment.PartIp = partIp; segment.SegmentNodeToolTipTemplate = diagram.SegmentNodeToolTipTemplate; segment.SegmentFinder = new IpFlowIpSegmentFinder() { IsSource = isSrc, Segment = ipSegment, Index = index }; return(segment); }
void Initialize() { Window_Border = new Border(); this.Content = Window_Border; Window_Border.BorderThickness = new Thickness(1); Window_Border.Background = new SolidColorBrush(Color.FromRgb(56, 56, 56)); Window_Border.ClipToBounds = true; Window_Border.Child = Window_Grid; DarkenOverlay.Background = Brushes.Black; DarkenOverlay.Opacity = 0; DarkenOverlay.Visibility = System.Windows.Visibility.Collapsed; DarkenOverlay.BorderThickness = new Thickness(0); DarkenOverlay.IsHitTestVisible = false; Window_Grid.Children.Add(Window_TitleGrid); Window_Content_Grid.Children.Add(ContentPlaceHolder); Window_Grid.Children.Add(Window_Content_Grid); Window_Grid.Children.Add(DarkenOverlay); #region TITLE_BAR Window_TitleGrid.ClipToBounds = true; Window_TitleGrid.Height = TITLE_BAR_HEIGHT; Window_TitleGrid.VerticalAlignment = System.Windows.VerticalAlignment.Top; Window_TitleGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; Window_TitleGrid.Children.Add(TitleIcon); Window_TitleGrid.Children.Add(Window_TitleLabel); Window_TitleGrid.Children.Add(Window_Button_Close); Window_TitleGrid.Children.Add(Window_Button_Maximize); Window_TitleGrid.Children.Add(Window_Button_Minimize); Window_TitleLabel.VerticalAlignment = System.Windows.VerticalAlignment.Top; Window_TitleLabel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; Window_TitleLabel.Height = TITLE_BAR_HEIGHT - 2; Window_TitleLabel.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; Window_TitleLabel.Margin = new Thickness(30, 0, 140, 0); Window_TitleLabel.Foreground = Brushes.White; Window_Button_Close.MouseEnter += Window_Button_MouseEnter; Window_Button_Close.MouseLeave += Window_Button_MouseLeave; Window_Button_Close.Click += Window_Close; Window_Button_Close.Content = 'r'; Window_Button_Close.FontFamily = new System.Windows.Media.FontFamily("Webdings"); Window_Button_Close.FontSize = 11; Window_Button_Close.Height = 19; Window_Button_Close.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Window_Button_Close.VerticalAlignment = System.Windows.VerticalAlignment.Top; Window_Button_Close.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0); Window_Button_Close.Foreground = Brushes.Black; Window_Button_Close.BorderThickness = new Thickness(1); Window_Button_Close.FontWeight = FontWeights.Bold; Window_Button_Close.Width = X_BUTTON_NORMAL_WIDTH; Window_Button_Close.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 5, 0); Window_Button_Close.Focusable = false; WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Close, true); Window_Button_Maximize.MouseEnter += Window_Button_MouseEnter; Window_Button_Maximize.MouseLeave += Window_Button_MouseLeave; Window_Button_Maximize.Click += Window_MaximizeRestore; Window_Button_Maximize.Content = '1'; Window_Button_Maximize.FontFamily = new System.Windows.Media.FontFamily("Webdings"); Window_Button_Maximize.FontSize = 11; Window_Button_Maximize.Height = 19; Window_Button_Maximize.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Window_Button_Maximize.VerticalAlignment = System.Windows.VerticalAlignment.Top; Window_Button_Maximize.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0); Window_Button_Maximize.Foreground = Brushes.Black; Window_Button_Maximize.BorderThickness = new Thickness(1); Window_Button_Maximize.FontWeight = FontWeights.Bold; Window_Button_Maximize.Width = 30; Window_Button_Maximize.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 52, 0); Window_Button_Maximize.Focusable = false; WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Maximize, true); Window_Button_Minimize.MouseEnter += Window_Button_MouseEnter; Window_Button_Minimize.MouseLeave += Window_Button_MouseLeave; Window_Button_Minimize.Click += Window_Minimize; Window_Button_Minimize.Content = '0'; Window_Button_Minimize.FontFamily = new System.Windows.Media.FontFamily("Webdings"); Window_Button_Minimize.FontSize = 11; Window_Button_Minimize.Height = 19; Window_Button_Minimize.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Window_Button_Minimize.VerticalAlignment = System.Windows.VerticalAlignment.Top; Window_Button_Minimize.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0); Window_Button_Minimize.Foreground = Brushes.Black; Window_Button_Minimize.BorderThickness = new Thickness(1); Window_Button_Minimize.FontWeight = FontWeights.Bold; Window_Button_Minimize.Width = 30; Window_Button_Minimize.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 81, 0); Window_Button_Minimize.Focusable = false; WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Minimize, true); #endregion #region COLOR_PICKER foreach (ThemeColors t in AvailableThemeColors) { MenuItem NewItem = new MenuItem(); NewItem.Header = t; NewItem.Click += (o, e) => { ThemeColor = (ThemeColors)((MenuItem)e.Source).Header; }; ColorPicker.Items.Add(NewItem); } //Window_TitleGrid.ContextMenu = ColorPicker; #endregion Window_Button_Close.Style = (Style)this.FindResource("Window_Button_Close"); Window_Button_Maximize.Style = (Style)this.FindResource("Window_Button_Maximize"); Window_Button_Minimize.Style = (Style)this.FindResource("Window_Button_Minimize"); Window_TitleGrid.Style = (Style)this.FindResource("Window_Frame_Title_Bar"); Window_Border.Style = (Style)this.FindResource("Window_Frame_Border"); TitleEnabledBackground = Window_TitleGrid.Background.CloneCurrentValue(); TitleDisabledBackground = TitleEnabledBackground.CloneCurrentValue(); TitleDisabledBackground.Opacity = 0.4; TitleEnabledBackground.Freeze(); TitleDisabledBackground.Freeze(); }