Brush CreateColorResource(Direct2DDevice device, ColorResource colorResource) { var resource = Brush.FromColorResource(device, colorResource); AddResource(resource, colorResource.Shared); return(resource); }
public ShapeObject(ColorResource colorResource, IFShape shape, double x, double y) : base() { ColorResource = colorResource; Shape = shape; X = x; Y = y; }
public static void Init ( Color?RSPrimaryColor = null, Color?RSSecondColor = null, Color?RSTextColor = null, Color?RSBackground = null, Color?RSBackgroundDark = null ) { var color = new ColorResource(); if (RSPrimaryColor != null) { color[nameof(RSPrimaryColor)] = RSPrimaryColor; } if (RSSecondColor != null) { color[nameof(RSSecondColor)] = RSSecondColor; } if (RSTextColor != null) { color[nameof(RSTextColor)] = RSTextColor; } if (RSBackground != null) { color[nameof(RSBackground)] = RSBackground; } if (RSBackgroundDark != null) { color[nameof(RSBackgroundDark)] = RSBackgroundDark; } Application.Current.Resources.Add(color); }
public SimpleText(string text, double x, double y) { Color = ColorResource.DrakGray; X = x; Y = y; Text = text; }
public SimpleText(ColorResource color, string text, double x, double y) { Color = color; X = x; Y = y; Text = text; }
public TextObject( [NotNull] ColorResource colorResource, [NotNull] string text, double size, double x, double y) { ColorResource = colorResource; Text = text; X = x; Y = y; Size = size; }
public Brush GetBrushResource(ColorResource colorResource, bool shared = true) { var device = services.GetService <IDirect2DService>().Direct2DDevice; Brush result; if (TryGetResource(colorResource.Name, shared, out result)) { return(result); } var solidColor = colorResource as SolidColor; if (solidColor != null) { var brushes = GetResources <SolidColorBrush>(); result = brushes.FirstOrDefault(b => b.Color.Equals(solidColor.Color) && b.Shared == shared); } return(result ?? CreateColorResource(device, shared ? colorResource : colorResource.CopyAs('u' + colorResource.Name, false))); }
public static Color ToMediaColor(this ColorResource color) => Color.FromArgb(color.Color.A, color.Color.R, color.Color.G, color.Color.B);