public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); //foreach (var gate in instances) { cr.MoveTo(-27.5, -15); cr.RelLineTo(7.5, 0); cr.RelCurveTo(10, 0, 15, 7.5, 20, 15); cr.RelCurveTo(-5, 7.5, -10, 15, -20, 15); cr.RelLineTo(-7.5, 0); cr.RelCurveTo(0, 0, 5, -7.5, 5, -15); cr.RelCurveTo(0, -7.5, -5, -15, -5, -15); cr.ClosePath(); cr.RelMoveTo(-5, 30); cr.RelCurveTo(0, 0, 5, -7.5, 5, -15); cr.RelCurveTo(0, -7.5, -5, -15, -5, -15); } cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { Span <Vector2i> points = stackalloc Vector2i[NumberOfPorts]; GetPorts(points); for (int i = 0; i < NumberOfPorts; i++) { IComponent.DrawRoundPort(cr, data, points, i); } } }
public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); //foreach (var gate in instances) { cr.Rectangle(-30, -15, 30, 30); cr.ClosePath(); } // FIXME: We probably shouldn't hardcode the color cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { Span <Vector2i> points = stackalloc Vector2i[NumberOfPorts]; GetPorts(points); for (int i = 0; i < NumberOfPorts; i++) { IComponent.DrawRoundPort(cr, data, points, i); } } }
// FIXME: Cleanup and possibly split draw into a 'outline' and 'fill' // call so we can do more efficient cairo rendering. public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); //foreach (var gate in instances) { cr.MoveTo(-30, -15); cr.RelLineTo(15, 0); cr.RelCurveTo(20, 0, 20, 30, 0, 30); cr.RelLineTo(-15, 0); cr.ClosePath(); } // FIXME: We probably shouldn't hardcode the color cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { Span <Vector2i> points = stackalloc Vector2i[NumberOfPorts]; GetPorts(points); foreach (var p in points) { var port = p * CircuitEditor.DotSpacing; // FIXME: Magic number radius... cr.Arc(port.X, port.Y, 2, 0, Math.PI * 2); cr.ClosePath(); } } cr.SetSourceRGB(0.2, 0.9, 0.2); cr.Fill(); }
// FIXME: Cleanup and possibly split draw into a 'outline' and 'fill' // call so we can do more efficient cairo rendering. public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); double height = CircuitEditor.DotSpacing * 3; double width = CircuitEditor.DotSpacing * 3; //foreach (var gate in instances) { var p1 = new Vector2d(-width, -height / 2); var p2 = new Vector2d(-width, height / 2); var p3 = new Vector2d(-width / 2, 0); // FIXME: This might be simplyfiable. If it's not maybe write a comment about why this works. double a1 = Math.PI / 2; double a2 = a1 + Math.PI; cr.MoveTo(p1); cr.Arc(p3.X, p3.Y, width / 2, -Math.PI / 2, Math.PI / 2); cr.LineTo(p2); cr.ClosePath(); } // FIXME: We probably shouldn't hardcode the color cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { var p1 = new Vector2i(-3, 1); var p2 = new Vector2i(-3, -1); var in1 = p1 * CircuitEditor.DotSpacing; var in2 = p2 * CircuitEditor.DotSpacing; var out1 = Vector2d.Zero; // FIXME: Magic number radius... cr.Arc(in1.X, in1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); cr.Arc(in2.X, in2.Y, 2, 0, Math.PI * 2); cr.ClosePath(); cr.Arc(out1.X, out1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); } cr.SetSourceRGB(0.2, 0.9, 0.2); cr.Fill(); }
public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); double height = CircuitEditor.DotSpacing * 1.5; double width = CircuitEditor.DotSpacing * 3; cr.LineJoin = LineJoin.Miter; //foreach (var gate in instances) { var p1 = new Vector2d(-width, height / 2); var p2 = new Vector2d(-width, -height / 2); var p3 = new Vector2d(-width * 0.365, 0); var p4 = new Vector2d(-width * 0.15, 0); cr.MoveTo(p1); cr.LineTo(p2); cr.LineTo(p3); cr.ClosePath(); const double r = 4.8; cr.MoveTo(p4 + new Vector2d(r + 0.2, 0)); cr.Arc(p4.X, p4.Y, r, 0, Math.PI * 2); cr.ClosePath(); } // FIXME: We probably shouldn't hardcode the color cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { var p1 = new Vector2i(-3, 0); var in1 = p1 * CircuitEditor.DotSpacing; var out1 = Vector2d.Zero; // FIXME: Magic number radius... cr.Arc(in1.X, in1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); cr.Arc(out1.X, out1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); } cr.SetSourceRGB(0.2, 0.9, 0.2); cr.Fill(); }
public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); var gate = data; //foreach (var gate in instances) { var c1 = new Vector2d(-3.264, -2.448) * CircuitEditor.DotSpacing; var c2 = new Vector2d(-3.264, +2.448) * CircuitEditor.DotSpacing; var c3 = new Vector2d(-6.086, 0) * CircuitEditor.DotSpacing; const double r1 = 4.08 * CircuitEditor.DotSpacing; const double r2 = 3.264 * CircuitEditor.DotSpacing; cr.NewSubPath(); cr.Arc(c1.X, c1.Y, r1, 37 * MathUtil.D2R, (37 + 53) * MathUtil.D2R); cr.NewSubPath(); cr.Arc(c2.X, c2.Y, r1, -90 * MathUtil.D2R, (-90 + 53) * MathUtil.D2R); cr.NewSubPath(); cr.Arc(c3.X, c3.Y, r2, -30 * MathUtil.D2R, (-30 + 60) * MathUtil.D2R); } cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { var p1 = new Vector2i(-3, 1); var p2 = new Vector2i(-3, -1); var in1 = p1 * CircuitEditor.DotSpacing; var in2 = p2 * CircuitEditor.DotSpacing; var out1 = Vector2d.Zero; // FIXME: Magic number radius... cr.Arc(in1.X, in1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); cr.Arc(in2.X, in2.Y, 2, 0, Math.PI * 2); cr.ClosePath(); cr.Arc(out1.X, out1.Y, 2, 0, Math.PI * 2); cr.ClosePath(); } cr.SetSourceRGB(0.2, 0.9, 0.2); cr.Fill(); }
public void Draw(Context cr, InstanceData data) { using var transform = IComponent.ApplyComponentTransform(cr, data); double height = CircuitEditor.DotSpacing * 1.5; double width = CircuitEditor.DotSpacing * 3; cr.LineJoin = LineJoin.Miter; //foreach (var gate in instances) { var p1 = new Vector2d(-width, height / 2); var p2 = new Vector2d(-width, -height / 2); var p3 = new Vector2d(-width * 0.365, 0); var p4 = new Vector2d(-width * 0.15, 0); cr.MoveTo(p1); cr.LineTo(p2); cr.LineTo(p3); cr.ClosePath(); const double r = 4.8; cr.MoveTo(p4 + new Vector2d(r + 0.2, 0)); cr.Arc(p4.X, p4.Y, r, 0, Math.PI * 2); cr.ClosePath(); } // FIXME: We probably shouldn't hardcode the color cr.SetSourceRGB(0.1, 0.1, 0.1); cr.LineWidth = Wires.WireWidth; cr.Stroke(); //foreach (var gate in instances) { Span <Vector2i> points = stackalloc Vector2i[NumberOfPorts]; GetPorts(points); for (int i = 0; i < NumberOfPorts; i++) { IComponent.DrawRoundPort(cr, data, points, i); } } }
public void Draw(Context cr, InstanceData data) { throw new NotImplementedException(); }