internal void Fill(DrawingLayer drawingLayer, Brushes.Brush brush) { var bounds = GetBoundsInverted(); drawingLayer.PushState(); BrushHelper.PrepareBrush(brush, drawingLayer, bounds, GetCurrentTransform(), Matrix3x2.Identity); if (m_transformedGeometry != null) { m_transformedGeometry.Dispose(); m_transformedGeometry = null; } m_transformedGeometry = new TransformedGeometry(InternalRenderTargetResourceOwner.InternalRenderTarget.Factory, GetInternalGeometry(), GetCurrentTransform()); if (m_mesh == null) drawingLayer.D2DRenderTarget.InternalRenderTarget.FillGeometry(m_transformedGeometry, brush.InternalBrush); else { drawingLayer.D2DRenderTarget.InternalRenderTarget.AntialiasMode = AntialiasMode.Aliased; drawingLayer.D2DRenderTarget.InternalRenderTarget.FillMesh(m_mesh, brush.InternalBrush); } drawingLayer.PopState(); }
public void BrushAppliesBeforPenDefaultOptions() { this.operations.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), Vector2.Zero); var processor = this.Verify <FillRegionProcessor <Rgba32> >(0); this.Verify <FillRegionProcessor <Rgba32> >(1); }
public void FillsForEachACharachterWhenBrushSetAndNotPenDefaultOptions() { this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), null, Vector2.Zero); this.Verify <FillRegionProcessor <Rgba32> >(0); this.Verify <FillRegionProcessor <Rgba32> >(1); this.Verify <FillRegionProcessor <Rgba32> >(2); }
public void FillsForEachACharachterWhenBrushSet() { this.img.DrawText("123", this.Font, Brushes.Solid(Color.Red), Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied Assert.IsType <FillRegionProcessor <Color> >(this.img.ProcessorApplications[0].processor); }
public void FillsForEachACharachterWhenBrushSetDefaultOptions() { this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied Assert.IsType <FillRegionProcessor <Rgba32> >(this.img.ProcessorApplications[0].processor); }
public void FillsForEachACharachterWhenBrushSet() { this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), path, new TextGraphicsOptions(true)); this.Verify <FillRegionProcessor <Rgba32> >(0); this.Verify <FillRegionProcessor <Rgba32> >(1); this.Verify <FillRegionProcessor <Rgba32> >(2); }
public void BrushAppliesBeforPenDefaultOptions() { this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), path); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(2, this.img.ProcessorApplications.Count); Assert.IsType <FillRegionProcessor <Rgba32> >(this.img.ProcessorApplications[0].processor); Assert.IsType <FillRegionProcessor <Rgba32> >(this.img.ProcessorApplications[1].processor); }
public void ImageShouldBeFloodFilledWithPercent10() { Test("Percent10", Color.Blue, Brushes.Percent10(Color.HotPink, Color.LimeGreen), new Color[, ] { { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen }, { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen } }); }
public void FillsForEachACharacterWhenBrushSetDefaultOptions() { this.operations.DrawText("123", this.Font, Brushes.Solid(Color.Red), Vector2.Zero); var processor = this.Verify <DrawTextProcessor>(0); Assert.Equal(this.textOptions, processor.Options.TextOptions); Assert.Equal(this.options, processor.Options.GraphicsOptions); }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); Brushes.LoadVsBrushes(); AddIconCommand.Initialize(this); }
// Use this for initialization void Start() { Debug.Log("Controller starts"); player.transform.localScale = new Vector3(size, size, size); player.transform.GetComponent <Renderer> ().material.color = color; brush = Brushes.Sphere; isPainting = false; menuOpen = false; }
Control FillLinePath() { var control = new Drawable { Size = new Size(550, 200), BackgroundColor = Colors.Black }; control.Paint += (sender, e) => e.Graphics.FillPath(Brushes.White(Generator), Path); return(control); }
public void TestFillWithBlendFailsWithNonSolidBrush() { using var workaround = new Image <Rgb24>(Configuration.Default, 100, 100, Color.Black); Assert.ThrowsException <NotSupportedException>( () => workaround.Mutate(x => x.FillWithBlend(Brushes.Percent10(Color.Red))), "Can't handle non-solid brushed" ); }
public void BrushAppliesBeforPenDefaultOptions() { this.img.DrawText("1", this.Font, Brushes.Solid(Color.Red), Pens.Dash(Color.Red, 1), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(2, this.img.ProcessorApplications.Count); Assert.IsType <FillRegionProcessor <Color> >(this.img.ProcessorApplications[0].processor); Assert.IsType <DrawPathProcessor <Color> >(this.img.ProcessorApplications[1].processor); }
GridView Default(IEnumerable <object> items) { var control = new GridView { Size = new Size(300, 100), DataStore = items }; LogEvents(control); var dropDown = MyDropDown("DropDownKey"); control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), Editable = true, AutoSize = true, Resizable = false }); control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image") }); control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Editable = true, Sortable = true }); control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Editable = true, Sortable = true }); if (Platform.Supports <DrawableCell>()) { var drawableCell = new DrawableCell(); drawableCell.Paint += (sender, e) => { var m = e.Item as MyGridItem; if (m != null) { if (e.CellState.HasFlag(DrawableCellStates.Selected)) { e.Graphics.FillRectangle(Colors.Blue, e.ClipRectangle); } else { e.Graphics.FillRectangle(Brushes.Cached(m.Color), e.ClipRectangle); } var rect = e.ClipRectangle; rect.Inflate(-5, -5); e.Graphics.DrawRectangle(Colors.White, rect); e.Graphics.DrawLine(Colors.White, rect.Left, rect.Bottom, rect.MiddleX, rect.Top); e.Graphics.DrawLine(Colors.White, rect.Right, rect.Bottom, rect.MiddleX, rect.Top); } }; control.Columns.Add(new GridColumn { HeaderText = "Owner drawn", DataCell = drawableCell }); } return(control); }
private void cboTerrain_SelectionChanged(object sender, SelectionChangedEventArgs e) { Terrain terrain = cboTerrain.SelectedItem as Terrain; if (terrain != null) { ctlTerrain.Fill = Brushes.GetBrush(terrain.GetColor()); _selectedTerrain = terrain; } }
public void ImageShouldBeFloodFilledWithMin() { Test("Min", Rgba32.Blue, Brushes.Min(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[, ] { { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink } }); }
public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent() { Test("BackwardDiagonal_Transparent", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink), new Color[, ] { { Color.Blue, Color.Blue, Color.Blue, Color.HotPink }, { Color.Blue, Color.Blue, Color.HotPink, Color.Blue }, { Color.Blue, Color.HotPink, Color.Blue, Color.Blue }, { Color.HotPink, Color.Blue, Color.Blue, Color.Blue } }); }
public void ImageShouldBeFloodFilledWithVertical_transparent() { Test("Vertical_Transparent", Color.Blue, Brushes.Vertical(Color.HotPink), new Color[, ] { { Color.Blue, Color.HotPink, Color.Blue, Color.Blue }, { Color.Blue, Color.HotPink, Color.Blue, Color.Blue }, { Color.Blue, Color.HotPink, Color.Blue, Color.Blue }, { Color.Blue, Color.HotPink, Color.Blue, Color.Blue } }); }
public void ImageShouldBeFloodFilledWithBackwardDiagonal() { Test("BackwardDiagonal", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink, Color.LimeGreen), new Color[, ] { { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.HotPink }, { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen }, { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen }, { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen } }); }
public void ImageShouldBeFloodFilledWithMin_transparent() { Test("Min_Transparent", Color.Blue, Brushes.Min(Color.HotPink), new Color[, ] { { Color.Blue, Color.Blue, Color.Blue, Color.Blue }, { Color.Blue, Color.Blue, Color.Blue, Color.Blue }, { Color.Blue, Color.Blue, Color.Blue, Color.Blue }, { Color.HotPink, Color.HotPink, Color.HotPink, Color.HotPink }, }); }
public void ImageShouldBeFloodFilledWithVertical() { Test("Vertical", Color.Blue, Brushes.Vertical(Color.HotPink, Color.LimeGreen), new Color[, ] { { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen } }); }
public void ImageShouldBeFloodFilledWithPercent20_transparent() { Test("Percent20_Transparent", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink), new Rgba32[, ] { { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue }, { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue } }); }
public void ImageShouldBeFloodFilledWithMin_transparent() { Test("Min_Transparent", Rgba32.Blue, Brushes.Min(Rgba32.HotPink), new Rgba32[, ] { { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink }, }); }
public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent() { Test("BackwardDiagonal_Transparent", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink), new Rgba32[, ] { { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue }, { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink } }); }
public void ImageShouldBeFloodFilledWithPercent20() { Test("Percent20", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[, ] { { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen }, { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen } }); }
public void ImageShouldBeFloodFilledWithBackwardDiagonal() { Test("BackwardDiagonal", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[, ] { { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink } }); }
public void ImageShouldBeFloodFilledWithVertical_transparent() { Test("Vertical_Transparent", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink), new Rgba32[, ] { { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue }, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue } }); }
public void ImageShouldBeFloodFilledWithVertical() { Test("Vertical", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[, ] { { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen }, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen } }); }
public void ImageShouldBeFloodFilledWithPercent20_transparent() { Test("Percent20_Transparent", Color.Blue, Brushes.Percent20(Color.HotPink), new Color[, ] { { Color.HotPink, Color.Blue, Color.Blue, Color.Blue }, { Color.Blue, Color.Blue, Color.HotPink, Color.Blue }, { Color.HotPink, Color.Blue, Color.Blue, Color.Blue }, { Color.Blue, Color.Blue, Color.HotPink, Color.Blue } }); }
public void ImageShouldBeFloodFilledWithMin() { Test("Min", Color.Blue, Brushes.Min(Color.HotPink, Color.LimeGreen), new Color[, ] { { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }, { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }, { Color.HotPink, Color.HotPink, Color.HotPink, Color.HotPink } }); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { Brushes = new Brushes(); LastUsedBrush = Brushes.None; ResetCommand = new RelayCommand(() => { Status = "Activate a Command"; LastUsedBrush = Brushes.None; }); SimpleCommand = new RelayCommand(() => { Status = "Simple command executed"; LastUsedBrush = Brushes.Brush1; }); ParameterCommand1 = new RelayCommand<string>(p => { Status = string.Format("Parameter command executed ({0})", p); LastUsedBrush = Brushes.Brush2; }); ParameterCommand2 = new RelayCommand<string>(p => { Status = string.Format("Parameter command executed ({0})", p); LastUsedBrush = Brushes.Brush3; }); DisablableCommand = new RelayCommand<string>(p => { Status = string.Format("Disablable command executed ({0})", p); LastUsedBrush = Brushes.Brush4; }, p => p != "Hello"); MoveMouseCommand = new RelayCommand<MouseEventArgs>(e => { var element = e.OriginalSource as UIElement; var point = e.GetPosition(element); Status = string.Format("Position: {0}x{1}", point.X, point.Y); LastUsedBrush = Brushes.Brush5; }); }
/// <summary> /// Creates a new LinearGradientBrush for creating linear gradients. /// </summary> /// <param name="gradientStops">The gradient stop points</param> /// <param name="extendMode">The draw extend mode</param> /// <param name="startPoint">The gradient start point. This is relative to the end point if the Alignment property is a relative type</param> /// <param name="endPoint">The gradient stop point. This is relative to the start point if the Alignment property is a relative type</param> /// <returns>A new instance of LinearGradientBrush</returns> public Brushes.LinearGradientBrush CreateLinearGradientBrush(Brushes.GradientStop[] gradientStops, Brushes.ExtendMode extendMode, PointF startPoint, PointF endPoint) { return m_resources.CreateLinearGradientBrush(gradientStops, extendMode, startPoint, endPoint); }
/// <summary> /// Creates a new CreateRadialGradientBrush for creating radial gradients. /// </summary> /// <param name="gradientStops">The gradient stop points</param> /// <param name="extendMode">The draw extend mode</param> /// <param name="centerPoint">The center point of the radial gradient. </param> /// <param name="gradientOriginOffset">This offset to move the origin, from center, of the radial gradient</param> /// <param name="radius">The radius of the gradiant</param> /// <returns>A new instance of RadialGradientBrush</returns> public Brushes.RadialGradientBrush CreateRadialGradientBrush(Brushes.GradientStop[] gradientStops, Brushes.ExtendMode extendMode, PointF centerPoint, PointF gradientOriginOffset, SizeF radius) { return m_resources.CreateRadialGradientBrush(gradientStops, extendMode, centerPoint, gradientOriginOffset, radius); }