protected override Rectangle DrawShape(Rectangle rect, Layer l) { Rectangle dirty; using (Context g = new Context (l.Surface)) { g.AppendPath (PintaCore.Layers.SelectionPath); g.FillRule = FillRule.EvenOdd; g.Clip (); g.Antialias = Antialias.Subpixel; if (FillShape && StrokeShape) dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth); else if (FillShape) dirty = g.FillRectangle (rect, outline_color); else dirty = g.DrawRectangle (rect, outline_color, BrushWidth); } return dirty; }
protected override Rectangle DrawShape(Rectangle rect, Layer l) { Document doc = PintaCore.Workspace.ActiveDocument; Rectangle dirty; using (Context g = new Context (l.Surface)) { g.AppendPath (doc.SelectionPath); g.FillRule = FillRule.EvenOdd; g.Clip (); g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None; if (FillShape && StrokeShape) dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth); else if (FillShape) dirty = g.FillRectangle (rect, outline_color); else dirty = g.DrawRectangle (rect, outline_color, BrushWidth); } return dirty; }
protected void UpdateRectangle(PointD point) { if (!is_drawing) return; Rectangle r = PointsToRectangle (shape_origin, point); Rectangle dirty; PintaCore.Layers.ToolLayer.Clear (); PintaCore.Layers.ToolLayer.Hidden = false; using (Context g = new Context (PintaCore.Layers.ToolLayer.Surface)) { g.Antialias = Antialias.Subpixel; dirty = g.FillStrokedRectangle (r, new Color (0, 0.4, 0.8, 0.1), new Color (0, 0, 0.9), 1); dirty = dirty.Clamp (); PintaCore.Workspace.Invalidate (last_dirty.ToGdkRectangle ()); PintaCore.Workspace.Invalidate (dirty.ToGdkRectangle ()); last_dirty = dirty; } }
public void Render (Context g) { var rect = GetHandleRect (); g.FillStrokedRectangle (rect, FillColor, StrokeColor, 1); }