StrokeExtents() публичный Метод

public StrokeExtents ( ) : Rectangle
Результат Rectangle
Пример #1
0
        public static Rectangle DrawRectangle(this Cairo.Context g, Cairo.Rectangle r, Cairo.Color color, int lineWidth)
        {
            // Put it on a pixel line
            if (lineWidth == 1)
            {
                r = new Rectangle(r.X - 0.5, r.Y - 0.5, r.Width, r.Height);
            }

            g.Save();

            g.MoveTo(r.X, r.Y);
            g.LineTo(r.X + r.Width, r.Y);
            g.LineTo(r.X + r.Width, r.Y + r.Height);
            g.LineTo(r.X, r.Y + r.Height);
            g.LineTo(r.X, r.Y);

            g.Color     = color;
            g.LineWidth = lineWidth;
            g.LineCap   = LineCap.Square;

            Rectangle dirty = g.StrokeExtents();

            g.Stroke();

            g.Restore();

            return(dirty);
        }
Пример #2
0
        public static Gdk.Rectangle GetBounds(this Path path)
        {
            Rectangle rect;

            using (Context g = new Context (PintaCore.Layers.CurrentLayer.Surface)) {
                g.AppendPath (PintaCore.Layers.SelectionPath);

                // We don't want the bounding box to include a stroke width
                // of 1, but setting it to 0 returns an empty rectangle.  Set
                // it to a sufficiently small width and rounding takes care of it
                g.LineWidth = .01;
                rect = g.StrokeExtents ();
            }

            int x = (int)Math.Round (rect.X);
            int y = (int)Math.Round (rect.Y);
            int w = (int)Math.Round (rect.Width);
            int h = (int)Math.Round (rect.Height);

            return new Gdk.Rectangle (x, y, w - x, h - y);
        }
Пример #3
0
        public static Rectangle GetBounds(this Path path)
        {
            Rectangle rect;

            using (Context g = new Context (PintaCore.Layers.CurrentLayer.Surface)) {
                g.AppendPath (PintaCore.Layers.SelectionPath);
                rect = g.StrokeExtents ();
            }

            return new Rectangle (rect.X, rect.Y, rect.Width - rect.X, rect.Height - rect.Y);
        }