void DrawFoldSegment(Cairo.Context ctx, double x, double y, bool isOpen, bool isSelected)
            {
                var drawArea = new Cairo.Rectangle(System.Math.Floor(x + (Margin.Width - foldSegmentSize) / 2) + 0.5,
                                                   System.Math.Floor(y + (Editor.LineHeight - foldSegmentSize) / 2) + 0.5, foldSegmentSize, foldSegmentSize);

                ctx.Rectangle(drawArea);
                ctx.SetSourceColor(isOpen ? foldBgGC : foldToggleMarkerBackground);
                ctx.FillPreserve();
                ctx.SetSourceColor(isSelected ? foldLineHighlightedGC : foldLineGC);
                ctx.Stroke();

                ctx.DrawLine(isSelected ? foldLineHighlightedGC : foldToggleMarkerGC,
                             drawArea.X + drawArea.Width * 2 / 10,
                             drawArea.Y + drawArea.Height / 2,
                             drawArea.X + drawArea.Width - drawArea.Width * 2 / 10,
                             drawArea.Y + drawArea.Height / 2);

                if (!isOpen)
                {
                    ctx.DrawLine(isSelected ? foldLineHighlightedGC : foldToggleMarkerGC,
                                 drawArea.X + drawArea.Width / 2,
                                 drawArea.Y + drawArea.Height * 2 / 10,
                                 drawArea.X + drawArea.Width / 2,
                                 drawArea.Y + drawArea.Height - drawArea.Height * 2 / 10);
                }
            }
            void DrawFoldSegment(Cairo.Context ctx, double x, double y, bool isCollapsed)
            {
                var drawArea = new Cairo.Rectangle(System.Math.Floor(x + (Margin.Width - foldSegmentSize) / 2) + 0.5,
                                                   System.Math.Floor(y + (Editor.LineHeight - foldSegmentSize) / 2) + 0.5, foldSegmentSize, foldSegmentSize);

                ctx.Rectangle(drawArea);
                var useSolidColor = isCollapsed || FoldMarkerOcapitiy >= 1;
                var drawColor     = background;

                if (!useSolidColor)
                {
                    drawColor.A = FoldMarkerOcapitiy;
                }

                ctx.SetSourceColor(drawColor);
                ctx.FillPreserve();

                drawColor = foldLine;
                if (!useSolidColor)
                {
                    drawColor.A = FoldMarkerOcapitiy;
                }

                ctx.SetSourceColor(drawColor);
                ctx.Stroke();

                drawColor = foreground;
                if (!useSolidColor)
                {
                    drawColor.A = FoldMarkerOcapitiy;
                }

                ctx.DrawLine(drawColor,
                             drawArea.X + drawArea.Width * 2 / 10,
                             drawArea.Y + drawArea.Height / 2,
                             drawArea.X + drawArea.Width - drawArea.Width * 2 / 10,
                             drawArea.Y + drawArea.Height / 2);

                if (isCollapsed)
                {
                    ctx.DrawLine(drawColor,
                                 drawArea.X + drawArea.Width / 2,
                                 drawArea.Y + drawArea.Height * 2 / 10,
                                 drawArea.X + drawArea.Width / 2,
                                 drawArea.Y + drawArea.Height - drawArea.Height * 2 / 10);
                }
            }
Пример #3
0
        public void Render(Cairo.Context c, Control control)
        {
            Line line = control as Line;

            Cairo.PointD p1 = new Cairo.PointD(line.Location.X, line.Location.Y);
            Cairo.PointD p2 = new Cairo.PointD(line.End.X, line.End.Y);
            c.DrawLine(p1, p2, line.BackgroundColor.ToCairoColor(), line.LineWidth, line.LineType, true);
        }
Пример #4
0
        public Size Measure(Cairo.Context c, Control control)
        {
            Line line = control as Line;

            Cairo.PointD p1 = new Cairo.PointD(line.Location.X, line.Location.Y);
            Cairo.PointD p2 = new Cairo.PointD(line.End.X, line.End.Y);
            var          r  = c.DrawLine(p1, p2, line.BackgroundColor.ToCairoColor(), line.LineWidth, line.LineType, false);

            return(new Size(r.Width, r.Height));
        }
Пример #5
0
 public override void Render( Context c)
 {
     c.Save();
     if(true){
         Cairo.PointD p1 = new Cairo.PointD(line.Location.X ,line.Location.Y);
         Cairo.PointD p2 = new Cairo.PointD(line.End.X, line.End.Y);
      		c.DrawLine(p1,p2,line.BackgroundColor.ToCairoColor(), line.LineWidth,line.LineType,true);
     }
     c.Restore();
 }
Пример #6
0
        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.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip ();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;

                dirty = g.DrawLine (shape_origin, current_point , outline_color, BrushWidth);
            }

            return dirty;
        }