static void InitStyle(ShapeStyle ss, Windows.UI.Color clr, bool dark) { SolidColorBrush fill = ss.Fill as SolidColorBrush; if (fill == null) { try { ss.FillAuto = ss.Fill = new SolidColorBrush(clr); } catch { } } else { fill.Color = clr; } fill = ss.Stroke as SolidColorBrush; Windows.UI.Color color = dark ? ColorPalette.Darken(clr) : clr; if (fill == null) { ss.StrokeAuto = ss.Stroke = new SolidColorBrush(color); } else { fill.Color = color; } }
/// <summary> /// Creates a circular solid colored brush that we can apply to a visual /// </summary> private CompositionEffectBrush CreateCircleBrushWithColor(Windows.UI.Color color) { var colorBrush = _compositor.CreateColorBrush(color); // // Because Windows.UI.Composition does not have a Circle visual, we will // work around by using a circular opacity mask // Create a simple Composite Effect, using DestinationIn (S * DA), // with a color source and a named parameter source. // var effect = new CompositeEffect { Mode = CanvasComposite.DestinationIn, Sources = { new ColorSourceEffect() { Color = color }, new CompositionEffectSourceParameter("mask") } }; var factory = _compositor.CreateEffectFactory(effect); var brush = factory.CreateBrush(); // // Create the mask brush using the circle mask // CompositionSurfaceBrush maskBrush = _compositor.CreateSurfaceBrush(); maskBrush.Surface = _circleMaskSurface.Surface; brush.SetSourceParameter("mask", maskBrush); return(brush); }
public ShapeStyle Next(bool dark) { ShapeStyle style2; ShapeStyle ss = new ShapeStyle(); if ((CustomBrushes != null) && (_colorGen == Dt.Charts.Palette.Default)) { InitStyle(ss, GetCustomBrush(_list.Count), dark); } else { Dt.Charts.Palette colorGenTheme = (_colorGen == Dt.Charts.Palette.Default) ? Dt.Charts.Palette.Apex : _colorGen; Windows.UI.Color clr = ColorPalette.GetOfficePalette(colorGenTheme).GetColor(_list.Count); InitStyle(ss, clr, dark); } ss.DarkOutline = dark; ss.StrokeThickness = 2.0; _list.Add(ss); style2 = new ShapeStyle { FillAuto = ss.FillAuto, Fill = ss.FillAuto, StrokeAuto = ss.StrokeAuto, Stroke = ss.StrokeAuto, StrokeThickness = 2.0 }; _list2.Add(style2); return(ss); }
void SetColors(Dt.Charts.Palette cg) { int num = _list.Count; if (cg == Dt.Charts.Palette.Default) { if (CustomBrushes != null) { for (int j = 0; j < num; j++) { Brush customBrush = GetCustomBrush(j); InitStyle(_list[j], customBrush, _list[j].DarkOutline); SyncStyle(j); } return; } cg = Dt.Charts.Palette.Apex; } for (int i = 0; i < num; i++) { Windows.UI.Color clr = ColorPalette.GetOfficePalette(cg).GetColor(i); InitStyle(_list[i], clr, _list[i].DarkOutline); SyncStyle(i); } }
private void UpdateGrid() { if (myMapView.Grid != null && myMapView.Grid.LevelCount > 0) { //Get proper color Windows.UI.Color defaultColor = new Windows.UI.Color(); System.Drawing.Color convertedDefaultColor = new System.Drawing.Color(); if (Application.Current.Resources[resourceNameGridColor] != null) { defaultColor = (Color)Application.Current.Resources[resourceNameGridColor]; convertedDefaultColor = System.Drawing.Color.FromArgb(defaultColor.A, defaultColor.R, defaultColor.G, defaultColor.B); } //Create line symbol for grid SimpleLineSymbol lineSym = new SimpleLineSymbol(); lineSym.Color = convertedDefaultColor; lineSym.Style = SimpleLineSymbolStyle.Solid; lineSym.Width = 1; //Update for each level of grid for (int levels = 0; levels < myMapView.Grid.LevelCount; levels++) { TextSymbol currentSymbol = (TextSymbol)myMapView.Grid.GetTextSymbol(levels); currentSymbol.Color = convertedDefaultColor; myMapView.Grid.SetTextSymbol(levels, (Esri.ArcGISRuntime.Symbology.Symbol)currentSymbol); myMapView.Grid.SetLineSymbol(levels, (Esri.ArcGISRuntime.Symbology.Symbol)lineSym); } } }
/// <summary> /// Will set the background grid of the map view /// NOTE: Since we can't add this code inside XAML, thanks to ESRI sdk, we need to force it here. /// </summary> public void SetBackgroundGrid() { if (myMapView.BackgroundGrid.GridLineWidth != 0) { Services.SettingsServices.SettingsService _settings = Services.SettingsServices.SettingsService.Instance; CustomResource customColors = new CustomResource(); customColors.InitializeComponent(); if (customColors.ContainsKey("MapViewBackgroundGridLightColor")) { var appT = _settings.AppTheme; if (_settings.AppTheme == ApplicationTheme.Light) { Windows.UI.Color lightDefault = (Windows.UI.Color)customColors["MapViewBackgroundGridLightColor"]; myMapView.BackgroundGrid.Color = System.Drawing.Color.FromArgb(lightDefault.A, lightDefault.R, lightDefault.G, lightDefault.B); //myMapView.BackgroundGrid.GridLineColor = (Windows.UI.Color)customColors["MapViewBackgroundGridDarkColor"]; //myMapView.BackgroundGrid.GridLineWidth = 5; } else { Windows.UI.Color darkDefault = (Windows.UI.Color)customColors["MapViewBackgroundGridDarkColor"]; myMapView.BackgroundGrid.Color = System.Drawing.Color.FromArgb(darkDefault.A, darkDefault.R, darkDefault.G, darkDefault.B); //myMapView.BackgroundGrid.GridLineColor = (Windows.UI.Color)customColors["MapViewBackgroundGridLightColor"]; //myMapView.BackgroundGrid.GridLineWidth = 5; } } myMapView.BackgroundGrid.GridLineWidth = 0; myMapView.UpdateLayout(); } }
internal static Brush GetRichTextFill(List <TextParagraph> richText, Workbook workbook) { TextRun firstRun = GetFirstRun(richText); TextParagraph firstParagraph = GetFirstParagraph(richText); Brush brush = null; IFillFormat fillFormat = null; if (firstRun != null) { fillFormat = firstRun.FillFormat; } if ((fillFormat == null) && (firstParagraph != null)) { fillFormat = firstParagraph.FillFormat; } if (fillFormat != null) { object fill = ExcelChartExtension.GetFill(fillFormat, workbook); SpreadDrawingColorSettings spreadDrawingColorSettings = ExcelChartExtension.GetSpreadDrawingColorSettings(fillFormat); if (fill is string) { if (workbook != null) { Windows.UI.Color color = Dt.Cells.Data.ColorHelper.UpdateColor(workbook.GetThemeColor((string)(fill as string)), spreadDrawingColorSettings, false); return(new SolidColorBrush(color)); } return(brush); } if (fill is Brush) { brush = fill as Brush; } } return(brush); }
/// <summary> /// Converts a <see cref="Color"/> to a premultiplied Int32 - 4 byte ARGB structure. /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The int representation of the color.</returns> public static int ToInt(this Color color) { var a = color.A + 1; var col = (color.A << 24) | ((byte)((color.R * a) >> 8) << 16) | ((byte)((color.G * a) >> 8) << 8) | (byte)((color.B * a) >> 8); return(col); }
public static IColorSequence Dipolar(Color negativeColor, Color positiveColor, int halfStepCount) { return new Ir1ColorSequence( new ColorSequenceImpl(positiveColor.LessFadingSpread(halfStepCount)), new ColorSequenceImpl(negativeColor.LessFadingSpread(halfStepCount)) ); }
/// <summary> /// Returns a drawing object based on a specified parameter. /// </summary> /// <param name="evaluator">The evaluator.</param> /// <param name="baseRow">The base row.</param> /// <param name="baseColumn">The base column.</param> /// <param name="actual">The current value.</param> /// <returns>The data bar object.</returns> public override object Evaluate(ICalcEvaluator evaluator, int baseRow, int baseColumn, IActualValue actual) { this.lastActualValue = actual; object val = actual.GetValue(baseRow, baseColumn); if (val != null) { double?nullable = ConditionValueConverter.TryDouble(val); if (!nullable.HasValue) { return(null); } double currentValue = nullable.Value; double?nullable2 = this.CalcuteMinValue(evaluator, baseRow, baseColumn, 0, actual); double?nullable3 = this.CalcuteMaxValue(evaluator, baseRow, baseColumn, 2, actual); if (nullable2.HasValue && nullable3.HasValue) { double?nullable5 = nullable2; double?nullable6 = nullable3; if ((((double)nullable5.GetValueOrDefault()) > ((double)nullable6.GetValueOrDefault())) && (nullable5.HasValue & nullable6.HasValue)) { double?nullable4 = nullable3; nullable3 = nullable2; nullable2 = nullable4; } double axisScale = -1.0; double scale = this.EvaluateScale(currentValue, nullable2.Value, nullable3.Value, out axisScale); Windows.UI.Color fillColor = ((currentValue < 0.0) && this.useNegativeFillColor) ? this.negativeFillColor : this.color; return(new DataBarDrawingObject(baseRow, baseColumn, fillColor, ((currentValue < 0.0) && this.useNegativeBorderColor) ? this.negativeBorderColor : this.borderColor, this.showBorder, this.axisColor, this.gradient, this.direction, axisScale, scale, this.showBarOnly)); } } return(null); }
public static Color GetApplicationColor(ColoringBookColors Color) { Color color = new Windows.UI.Color(); switch (Color) { case ColoringBookColors.Red: color = GetApplicationColor(RED); break; case ColoringBookColors.Blue: color = GetApplicationColor(BLUE); break; case ColoringBookColors.Teal: color = GetApplicationColor(TEAL); break; case ColoringBookColors.Orange: color = GetApplicationColor(ORANGE); break; case ColoringBookColors.Purple: color = GetApplicationColor(PURPLE); break; default: break; } return(color); }
/// <summary> /// Constructor. Creates rendering brush; initializes graphics /// </summary> /// <param name="swapChainPanel">SwapChainPanel on which to render captured ink</param> /// <param name="brushType">Type of brush to use</param> /// <param name="thickness">Relative thickness of brush</param> /// <param name="color">Color of ink</param> /// <param name="style">Shape of brush (VectorBrush only)</param> public Renderer(SwapChainPanel swapChainPanel, VectorBrushStyle style, MediaColor color) { StrokeHandler = new VectorStrokeHandler(this, style, color); mSwapChainPanel = swapChainPanel; Graphics.GraphicsReady += OnGraphicsReady; Graphics.Initialize(mSwapChainPanel, false); }
public void SetColor(SolidColorBrush brush, Windows.UI.Color color) { if (color != _cachedColor) { _cachedColor = color; _line.Stroke = brush; } }
public static Windows.UI.Color GetContrastingColor(this Windows.UI.Color color) { var nThreshold = 105; int bgLuminance = Convert.ToInt32(color.R * 0.2 + color.G * 0.7 + color.B * 0.1); Windows.UI.Color contrastingColor = 255 - bgLuminance < nThreshold ? Colors.Black : Colors.White; return(contrastingColor); }
public static Windows.UI.Color Darken(Windows.UI.Color clr) { float hue = GetHue(clr); float saturation = GetSaturation(clr); float num3 = GetBrightness(clr) * 0.5f; return(ColorFromHSL((double)hue, (double)saturation, (double)num3)); }
public void Start(Windows.UI.Color color, Rect initialBounds, Rect finalBounds) { var colorVisual = CreateVisualWithColorAndPosition(color, initialBounds, finalBounds); _containerForVisuals.Children.InsertAtTop(colorVisual); TriggerBloomAnimation(colorVisual); }
/// <summary> /// Creates a border line with a specified color and style. /// </summary> /// <param name="color">The border color.</param> /// <param name="styleType">The border style type.</param> public BorderLine(Windows.UI.Color color, BorderLineStyle styleType) { this._context = null; this._themeColor = null; this._color = color; this._style = styleType; this._builtIn = false; }
/// <summary> /// Caution, only use for built-in borders creating. /// </summary> internal BorderLine(Windows.UI.Color color, BorderLineData style) { this._context = null; this._style = BorderLineStyle.None; this._color = color; this._styleData = style; this._builtIn = true; }
public static void ChangeTitlebarButtonColor(Color backGround,Color foreGround) { var view = ApplicationView.GetForCurrentView(); var otherB = backGround; var otherF = foreGround; view.TitleBar.ButtonBackgroundColor = backGround; view.TitleBar.ButtonForegroundColor = foreGround; }
public static Windows.UI.Color GetIdealForegroundForBackgroundColor(this Windows.UI.Color backgroundColor) { var nThreshold = 105; int bgLuminance = Convert.ToInt32(backgroundColor.R * 0.2 + backgroundColor.G * 0.7 + backgroundColor.B * 0.1); Windows.UI.Color foregroundColor = 255 - bgLuminance < nThreshold ? Colors.Black : Colors.White; return(foregroundColor); }
public InkingPreference() { penSize = 1; highlighterSize = 10; penColor = Colors.Red; highlighterColor = Colors.Yellow; drawingDevice = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen; this.version = CURRENT_INKING_PREF_VERSION; }
private CompositionMaskBrush CreateMaskBrush(int width, int height, Windows.UI.Color rateColor) { var _maskBrush = compositor.CreateMaskBrush(); LoadedImageSurface loadedSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/CircleMask.png"), new Windows.Foundation.Size(width, height)); _maskBrush.Source = compositor.CreateColorBrush(rateColor); _maskBrush.Mask = compositor.CreateSurfaceBrush(loadedSurface); return(_maskBrush); }
public void SetLEDColor(int index, String cssColor) { byte r = byte.Parse(cssColor.Substring(1, 2), NumberStyles.HexNumber); byte g = byte.Parse(cssColor.Substring(3, 2), NumberStyles.HexNumber); byte b = byte.Parse(cssColor.Substring(5, 2), NumberStyles.HexNumber); Windows.UI.Color color = Color.FromArgb(0, r, g, b); SetLEDColor(index, color); }
public Block(float x1, float y1, Windows.UI.Color color1, int height1, int width1) { x = x1; y = y1; color = color1; height = height1; width = width1; rect = new Rectangle((int)x1 - 20, (int)y1 - 20, height1 + 40, width1 + 40); }
/// <summary> /// Creates a <see cref="Color"/> from the specified hue, saturation, value, and alpha values. /// </summary> /// <param name="hue">0..360 range hue</param> /// <param name="saturation">0..1 range saturation</param> /// <param name="value">0..1 range value</param> /// <param name="alpha">0..1 alpha</param> /// <returns>The created <see cref="Color"/>.</returns> public static Color FromHsv(double hue, double saturation, double value, double alpha = 1.0) { if (hue < 0 || hue > 360) { throw new ArgumentOutOfRangeException(nameof(hue)); } double chroma = value * saturation; double h1 = hue / 60; double x = chroma * (1 - Math.Abs((h1 % 2) - 1)); double m = value - chroma; double r1, g1, b1; if (h1 < 1) { r1 = chroma; g1 = x; b1 = 0; } else if (h1 < 2) { r1 = x; g1 = chroma; b1 = 0; } else if (h1 < 3) { r1 = 0; g1 = chroma; b1 = x; } else if (h1 < 4) { r1 = 0; g1 = x; b1 = chroma; } else if (h1 < 5) { r1 = x; g1 = 0; b1 = chroma; } else { r1 = chroma; g1 = 0; b1 = x; } byte r = (byte)(255 * (r1 + m)); byte g = (byte)(255 * (g1 + m)); byte b = (byte)(255 * (b1 + m)); byte a = (byte)(255 * alpha); return(Color.FromArgb(a, r, g, b)); }
/// <summary> /// Assigns the default values to core. /// </summary> /// <param name="core">The core.</param> protected override void AssignDefaultValuesToSceneNode(SceneNode core) { material.Width = (float)Size.Width; material.Height = (float)Size.Height; material.Figure = Figure; material.FigureRatio = (float)FigureRatio; material.PointColor = Color.ToColor4(); material.FixedSize = FixedSize; base.AssignDefaultValuesToSceneNode(core); }
public static Block GenerateBlock(Windows.UI.Color color) { Random random = new Random(); int x = random.Next(700); int y = random.Next(700); Block block = new Block(x, y, color, 60, 60); return(block); }
public static Color AsColor(ColorARGB colorArgb) { Color color = new Color(); color.A = colorArgb.A; color.R = colorArgb.R; color.G = colorArgb.G; color.B = colorArgb.B; return color; }
/// <summary> /// Starts the color bloom transition using the specified color and boundary sizes. /// /// The bloom is achieved by creating a circular solid colored visual whose scale is progressively /// animated to fully flood a given area. /// /// <param name="color">Using the specified color</param> /// <param name="initialBounds">The transition begins with a visual with these bounds and position</param> /// <param name="finalBounds">The transition ends when the visual has "bloomed" to an area of this bounding size</param> /// </summary> public void Start(Windows.UI.Color color, Rect initialBounds, Rect finalBounds) { var colorVisual = CreateVisualWithColorAndPosition(color, initialBounds, finalBounds); // add our solid colored circle visual to the live visual tree via the container _containerForVisuals.Children.InsertAtTop(colorVisual); // now that we have a visual, let's run the animation TriggerBloomAnimation(colorVisual); }
public Blob(Blob source) { id = source.id; rect = source.rect; cog = source.cog; area = source.area; fullness = source.fullness; colorMean = source.colorMean; colorStdDev = source.colorStdDev; }
public override void StopSelectionMode() { if (IsSelecting) { mActiveTool = null; BrushColor = mSavedColor; mSelectTool = null; mRenderer.InvokeRedrawAllStrokes(); } }
//颜色选择器变化 private void ColorPicker_ColorChanged(Windows.UI.Color Color, SolidColorBrush Brush) { isSalf = true; this.Color = Color.FromArgb(Color.A, Color.R, Color.G, Color.B); //改变颜色 ColorChanged?.Invoke(this.Color); isSalf = false; Border.Background = Brush; }
public PathInfo(ICanvasResourceCreator rc, Windows.UI.Color color, System.Single strokeWidth, CanvasStrokeStyle strokeStyle) //Pen pen, bool fill, int shapeType) { Vector2 offset = new Vector2(0.0f, 0.0f); _cpb = new CanvasPathBuilder(rc); //_cpb.SetSegmentOptions(CanvasFigureSegmentOptions.ForceRoundLineJoin); _color = color; //_fill = fill; //_type = shapeType; }
public void FillEllipse(Vector2 center, float radiusX, float radiusY, Color color) { if (m_renderingType == TestSceneRenderingType.Default) { m_drawingSession.FillEllipse(center, radiusX, radiusY, color); } else { m_drawingSession.DrawEllipse(center, radiusX, radiusY, Colors.Black); } }
public void FillRectangle(Rect rect, Color color) { if (m_renderingType == TestSceneRenderingType.Default) { m_drawingSession.FillRectangle(rect, color); } else { m_drawingSession.DrawRectangle(rect, Colors.Black); } }
public void Clear(Color color) { if (m_renderingType == TestSceneRenderingType.Default) { m_drawingSession.Clear(color); } else { m_drawingSession.Clear(Colors.White); } }
public static ColorAnimation CreateColor(Color to, Duration duration, string targetProperty) { var animation = new ColorAnimation { To = to, Duration = duration, EnableDependentAnimation = true }; Storyboard.SetTargetProperty(animation, targetProperty); return animation; }
public void DrawLine(Vector2 p1, Vector2 p2, Color color, float strokeWidth, CanvasStrokeStyle strokeStyle) { if (m_renderingType == TestSceneRenderingType.Default) { m_drawingSession.DrawLine(p1, p2, color, strokeWidth, strokeStyle); } else { m_drawingSession.DrawLine(p1, p2, Colors.Black); } }
public ImageMarkupPage() { this.InitializeComponent(); this._inkManager = new InkManager(); //#FF003f82 this._brushColor = Colors.Blue; this.Loaded += DrawImageView_Loaded; }
public Brush(int oldX, int oldY, int currentX, int currentY, Windows.UI.Color brushColor, int brushSize, WriteableBitmap bmp, BrushModifierPanel mod) { OldX = oldX; OldY = oldY; CurrentX = currentX; CurrentY = currentY; BrushColor = brushColor; BrushSize = brushSize; Bmp = bmp; Mod = mod; }
public static Color Lerp(this Color color, Color target, float amount) { float sr = color.R, sg = color.G, sb = color.B; float er = target.R, eg = target.G, eb = target.B; byte r = (byte)sr.Lerp(er, amount), g = (byte)sg.Lerp(eg, amount), b = (byte)sb.Lerp(eb, amount); return Color.FromArgb(255, r, g, b); }
/// <summary> /// Outputs text with formating. /// </summary> /// <param name="target">The target <see cref="TextBlock"/>.</param> /// <param name="toOutput">String to output.</param> /// <param name="fontStyle">The font style.</param> /// <param name="fontWeight">The font weight.</param> /// <param name="fontColor">Color of the font.</param> public static void OutputWithFormat(this TextBlock target, string toOutput, FontStyle fontStyle = FontStyle.Normal, FontWeight fontWeight = default(FontWeight), Color fontColor = default(Color)) { var formatted = new Run { Text = toOutput, FontStyle = fontStyle, FontWeight = fontWeight.Equals(default(FontWeight)) ? FontWeights.Normal : fontWeight, Foreground = fontColor.Equals(default(Color)) ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(fontColor) }; target.Inlines.Add(formatted); }
static int ToInt(Color color) { var col = 0; if (color.A != 0) { var a = color.A + 1; col = (color.A << 24) | ((byte)((color.R * a) >> 8) << 16) | ((byte)((color.G * a) >> 8) << 8) | ((byte)((color.B * a) >> 8)); } return col; }
public static IColorSequence Quadrupolar( Color color1, Color color2, Color color3, Color color4, int quarterStepCount) { return new ColorSequenceImpl ( ColorEx.UniformSpread(color1, color2, quarterStepCount) .Concat(ColorEx.UniformSpread(color2, color3, quarterStepCount)) .Concat(ColorEx.UniformSpread(color3, color4, quarterStepCount)) .Concat(ColorEx.UniformSpread(color4, color1, quarterStepCount)) ); }
public static MapPolygon DrawCircle(List<BasicGeoposition> points, Color fillColor, Color strokeColor, int strokeThickness = 2, byte alpha = 80) { fillColor.A = alpha; strokeColor.A = alpha; var circle = new MapPolygon { StrokeThickness = strokeThickness, FillColor = fillColor, StrokeColor = strokeColor, Path = new Geopath(points) }; return circle; }
public static void SetThemeColor(Color color) { foreach (var brushKey in brushKeys) { if (Application.Current.Resources.ContainsKey(brushKey)) { var solidColorBrush = Application.Current.Resources[brushKey] as SolidColorBrush; if (solidColorBrush != null) solidColorBrush.Color = color; } } #if WINDOWS_PHONE_APP var statusBar = StatusBar.GetForCurrentView(); statusBar.ForegroundColor = color; #endif }
static Color ChangeColorBrightness(Color color, float correctionFactor) { float red = (float)color.R; float green = (float)color.G; float blue = (float)color.B; if (correctionFactor < 0) { correctionFactor = 1 + correctionFactor; red *= correctionFactor; green *= correctionFactor; blue *= correctionFactor; } else { red = (255 - red) * correctionFactor + red; green = (255 - green) * correctionFactor + green; blue = (255 - blue) * correctionFactor + blue; } return Color.FromArgb(color.A, (byte)red, (byte)green, (byte)blue); }
public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart) { Canvas.SetTop(Rectangle, current.ChartLocation.Y); Canvas.SetLeft(Rectangle, current.ChartLocation.X); Rectangle.Width = Width; Rectangle.Height = Height; if (IsNew) { Rectangle.Fill = new SolidColorBrush(Colors.Transparent); } if (HoverShape != null) { HoverShape.Width = Width; HoverShape.Height = Height; Canvas.SetLeft(HoverShape, current.ChartLocation.X); Canvas.SetTop(HoverShape, current.ChartLocation.Y); } if (DataLabel != null) { DataLabel.UpdateLayout(); Canvas.SetTop(DataLabel, current.ChartLocation.Y + (Height/2) - DataLabel.ActualHeight*.5); Canvas.SetLeft(DataLabel, current.ChartLocation.X + (Width/2) - DataLabel.ActualWidth*.5); } var targetColor = new Color { A = ColorComponents.A, R = ColorComponents.R, G = ColorComponents.G, B = ColorComponents.B }; if (chart.View.DisableAnimations) { Rectangle.Fill = new SolidColorBrush(targetColor); return; } var animSpeed = chart.View.AnimationsSpeed; Rectangle.Fill.BeginColorAnimation(nameof(SolidColorBrush.Color), targetColor, animSpeed); }
private Windows.UI.Xaml.UIElement CreateSymbol(string symbol, Color colour) { return new TextBlock { Text = symbol, FontSize = 40, Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(colour), HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center }; }
private void FireSelectedColorChangingEvent(Color selectedColor) { if (SelectedColorChanging != null) { SelectedColorEventArgs args = new SelectedColorEventArgs(selectedColor); SelectedColorChanging(this, args); } }
private static WordRenderData CreateText(PageRenderData context, TextElement element, bool bold, bool italic, double fontSize, double left, double top, Color? color) { return new WordRenderData { Text = element.Text, Bold = bold, Italic = italic, FontSize = fontSize, Left = left + context.OffsetX, Top = top + context.OffsetY, Color = color }; }
private static Color darkerColor(Color oldColor) { Color newColor = new Color(); newColor.A = 255; if (oldColor.R > 80) newColor.R = (byte)(oldColor.R - 32); else newColor.R = 0; if (oldColor.G > 80) newColor.G = (byte)(oldColor.G - 32); else newColor.G = 0; if (oldColor.B > 80) newColor.B = (byte)(oldColor.B - 32); else newColor.B = 0; return newColor; }
private Windows.UI.Xaml.UIElement CreateHighLightedSymbol(string symbol, Color colour) { return new Border { CornerRadius = new Windows.UI.Xaml.CornerRadius(40), BorderThickness = new Windows.UI.Xaml.Thickness(1), BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Colors.Red), Background = new Windows.UI.Xaml.Media.SolidColorBrush(Color.FromArgb(255, 96, 96, 96)), Padding = new Windows.UI.Xaml.Thickness(2, 5, 2, 2), Width = 80, Height = 80, Child = CreateSymbol(symbol, colour) }; }
/// <summary> /// Occurs when the range value of one of the color sliders changes. /// </summary> /// <param name="sender">The object where the event handler is attached.</param> /// <param name="e">The event data.</param> private void ColorSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { if (this.ignoreScreenColorListBoxSelectionChanging) { return; } var color = new Color() { R = (byte)this.RedSlider.Value, G = (byte)this.GreenSlider.Value, B = (byte)this.BlueSlider.Value, A = 255, }; ListBoxItem item = (ListBoxItem)this.ScreenColorListBox.SelectedItem; ((SolidColorBrush)item.BorderBrush).Color = color; ((SolidColorBrush)this.ColorPreviewRectangle.Fill).Color = color; int screenColor = this.ScreenColorListBox.SelectedIndex - 4; if (this.customTheme.ColorTable[(ScreenColor)screenColor] == color) { return; } this.customTheme.ColorTable[(ScreenColor)screenColor] = color; TerminalPageForceRender(fontChanged: false); }
public ColorRange(Color from, Color to) { this.From = from; this.To = to; }
public RichStringPart(string str, Color color) { String = str; Color = color; }
private RadialMenuButton CreateColorRadialMenuButtonWithSubMenu(Color sourceColor, double subMenuButtonCount) { var colorButton = CreateColorRadialMenuButton(sourceColor); colorButton.Submenu = new RadialMenu(); for (var i = 0; i < subMenuButtonCount; i++) { var lightenFactor = (float) i/10; colorButton.Submenu.AddButton(CreateColorRadialMenuButton(sourceColor.Lighten(lightenFactor))); } return colorButton; }
public void SetPixel(int x, int y, Color color) { SetPixel(x, y, ToInt(color)); }
/// <summary>${core_RawTheme_constructor_None_D}</summary> public RawTheme( ) { this.Fill = new SolidColorBrush(new Color() { A = 0x40 , R = 0x42 , G = 0x72 , B = 0xd7 }); this.Stroke = new SolidColorBrush(new Color() { A = 0xff , R = 0x50 , G = 0x82 , B = 0xe5 }); this.StrokeThickness = 2; this.Opacity = 1; this.Size = 8; this.Color = new SolidColorBrush(new Color() { A = 0xff , R = 0x42 , G = 0x72 , B = 0xd7 }); this.HoverVertexStyle = new PredefinedMarkerStyle() { Size = 12 , Symbol = PredefinedMarkerStyle.MarkerSymbol.Circle , //暂时找不到RadialGradientBrush的API,暂时设置为单一颜色 Color=new SolidColorBrush(Colors.Red) //Color = new RadialGradientBrush() //{ // GradientStops = new GradientStopCollection() // { // new GradientStop(){ Color=new Color(){ A=0xff,R=0xc2,G=0xc2,B=0xc2}, Offset=0.45}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x42,G=0x42,B=0x42}, Offset=0.703}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x8f,G=0x8e,B=0x8e}, Offset=0.687}, // new GradientStop(){ Color=new Color(){ A=0x00,R=0xff,G=0xff,B=0xff}, Offset=1}, // } //} }; this.SnapStyle = new PredefinedMarkerStyle() { Size = 12 , Symbol = PredefinedMarkerStyle.MarkerSymbol.Circle , //暂时找不到RadialGradientBrush的API,暂时设置为单一颜色 Color = new SolidColorBrush(Colors.Red) //Color = new RadialGradientBrush() // { // GradientStops = new GradientStopCollection() // { // new GradientStop(){ Color=new Color(){ A=0xff,R=0x2f,G=0x61,B=0xb2}, Offset=1}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x70,G=0xce,B=0x71}, Offset=0.631}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0xe5,G=0xe4,B=0xe4}, Offset=0.558}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x9c,G=0xb1,B=0xd3}, Offset=0.944}, // } // } }; this.HoverCenterStyle = new PredefinedMarkerStyle { Size = 12 , Symbol = PredefinedMarkerStyle.MarkerSymbol.Circle , //暂时找不到RadialGradientBrush的API,暂时设置为单一颜色 Color = new SolidColorBrush(Colors.Red) //Color = new RadialGradientBrush() //{ // GradientStops = new GradientStopCollection() // { // new GradientStop(){ Color=new Color(){ A=0xff,R=0xea,G=0xee,B=0xf0}, Offset=0}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0xf4,G=0xf6,B=0xf0}, Offset=0.66}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x4c,G=0xd5,B=0xef}, Offset=0.45}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x64,G=0xc8,B=0xf0}, Offset=0.65}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0xef,G=0xf5,B=0xea}, Offset=0.44}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x64,G=0xc8,B=0xf0}, Offset=1}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0xf3,G=0xf3,B=0xf3}, Offset=0.89}, // new GradientStop(){ Color=new Color(){ A=0xff,R=0x64,G=0xc8,B=0xf0}, Offset=0.9}, // } //} }; FCGreen = new Color { A = 0xff , R = 0x99 , G = 0xcc , B = 0x66 }; FCOrange = new Color { A = 0xff , R = 0xd9 , G = 0x82 , B = 0x57 }; FCBlue = new Color { A = 0xff , R = 0x95 , G = 0xd1 , B = 0xe5 }; FCYollew = new Color { A = 0xff , R = 0xe5 , G = 0xe5 , B = 0x45 }; }
private void SetOption(string symbol, Color colour, bool cellFixed = false) { if (!isSet) { isSet = true; Border border = new Border { Margin = margin, Background = background, Child = cellFixed ? CreateHighLightedSymbol(symbol, colour) : CreateSymbol(symbol, colour) }; this.Children.Add(border); Grid.SetColumnSpan(border, columns); Grid.SetRowSpan(border, rows); } }