Пример #1
0
        public void Draw(Context cr, InstanceData data)
        {
            using var transform = IComponentGraphics.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++)
                {
                    IComponentGraphics.DrawRoundPort(cr, data, points, i);
                }
            }
        }
Пример #2
0
        // 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 = IComponentGraphics.ApplyComponentTransform(cr, data);

            //foreach (var gate in instances)
            {
                cr.MoveTo(-30, -15);
                cr.RelLineTo(30, 15);
                cr.RelLineTo(-30, 15);
                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++)
                {
                    IComponentGraphics.DrawRoundPort(cr, data, points, i);
                }
            }
        }
Пример #3
0
        public void Draw(Context cr, InstanceData data)
        {
            using var transform = IComponentGraphics.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++)
                {
                    IComponentGraphics.DrawRoundPort(cr, data, points, i);
                }
            }
        }