示例#1
0
        public CustomLineCap(
            GraphicsPath fillPath,
            GraphicsPath strokePath,
            LineCap baseCap,
            float baseInset
            )
        {
            nativeCap = new GpCustomLineCap();
            GpPath nativeFillPath = null;
            GpPath nativeStrokePath = null;

            if (fillPath != null)
                nativeFillPath = fillPath.nativePath;
            if (strokePath != null)
                nativeStrokePath = strokePath.nativePath;

            lastResult = GdiPlus.GdipCreateCustomLineCap(
                            nativeFillPath, nativeStrokePath,
                            baseCap, baseInset, out nativeCap);
        }
示例#2
0
 public GraphicsPath(GraphicsPath path)
 {
     GpPath clonepath = null;
     SetStatus(GdiPlus.GdipClonePath(path.nativePath, out clonepath));
     SetNativePath(clonepath);
 }
示例#3
0
        public void AddPath(GraphicsPath addingPath, bool connect)
        {
            GpPath nativePath2 = null;
            if (addingPath != null) nativePath2 = addingPath.nativePath;

            SetStatus(GdiPlus.GdipAddPathPath(nativePath, nativePath2, connect));
        }
示例#4
0
        public GpStatus SetGraphicsPath(GraphicsPath path)
        {
            if (path == null)
                return SetStatus(GpStatus.InvalidParameter);

            return SetStatus(GdiPlus.GdipSetPathGradientPath(
                        (GpPathGradient)nativeBrush, path.nativePath));
        }
示例#5
0
 public GpStatus GetGraphicsPath(out GraphicsPath path)
 {
     path = new GraphicsPath();
     return SetStatus(GdiPlus.GdipGetPathGradientPath(
                 (GpPathGradient)nativeBrush, out path.nativePath));
 }
示例#6
0
        public PathGradientBrush(
            GraphicsPath path
            )
        {
            GpPathGradient brush = new GpPathGradient();

            lastResult = GdiPlus.GdipCreatePathGradientFromPath(
                                            path.nativePath, out brush);
            SetNativeBrush(brush);
        }
示例#7
0
 public void FillPath(BrushPlus brush, GraphicsPath path)
 {
     SetStatus(GdiPlus.GdipFillPath(nativeGraphics, brush.nativeBrush, path.nativePath));
 }
示例#8
0
 public void DrawPath(PenPlus pen,
                  GraphicsPath path)
 {
     SetStatus(GdiPlus.GdipDrawPath(nativeGraphics,
                                               pen != null ? pen.nativePen : null,
                                               path != null ? path.nativePath : null));
 }
示例#9
0
        private static GraphicsPath GetRoundPath(Rectangle rect, int r, int reflectionHeight, PathMode mode, RoundedCorners corners)
        {
            GraphicsPath path = new GraphicsPath();
            int x = rect.X, y = rect.Y, w = rect.Width, h = rect.Height;

            if (mode != PathMode.Bottom)
            {
                if ((corners & RoundedCorners.TopLeft) != 0) path.AddArc(x, y, r, r, 180, 90); else path.AddLine(x, y, x + r, y);
                if ((corners & RoundedCorners.TopRight) != 0) path.AddArc(x + w - r, y, r, r, 270, 90); else path.AddLine(x + w - r, y, x + w, y);
            }
            RectangleF gr = new RectangleF(x, y + r, w, h - r);

            if (mode != PathMode.All)
            {
                Point pt1 = new Point(x + w, y + reflectionHeight);
                Point pt2 = new Point(x, y + reflectionHeight);
                if (mode == PathMode.Top)
                {
                    path.AddLine(pt1, pt2);
                }
                else
                {
                    //pt1.Y--;
                    //pt2.Y--;
                    path.AddLine(pt2, pt1);
                }
            }
            if (mode != PathMode.Top)
            {
                if ((corners & RoundedCorners.BottomRight) != 0) path.AddArc(x + w - r, y + h - r, r, r, 0, 90); else path.AddLine(x + w, y + h, x + w - r, y + h);
                if ((corners & RoundedCorners.BottomLeft) != 0) path.AddArc(x, y + h - r, r, r, 90, 90); else path.AddLine(x + r, y + h, x, y + h);
            }

            path.CloseFigure();
            return path;
        }
示例#10
0
        private static GraphicsPath GetRectPath(Rectangle rect, int r, int reflectionHeight, PathMode mode, RoundedCorners corners)
        {
            switch (mode)
            {
                case PathMode.Top:
                    rect.Height = reflectionHeight;
                    break;

                case PathMode.Bottom:
                    rect.Height = rect.Height - reflectionHeight;
                    rect.Y += reflectionHeight;
                    break;

            }

            GraphicsPath path = new GraphicsPath();
            path.AddRectangle(rect);
            //            path.CloseFigure();
            return path;
        }
示例#11
0
        private static GraphicsPath GetNextPath(Rectangle rect, int r, int reflectionHeight, PathMode mode, RoundedCorners corners)
        {
            GraphicsPath path = new GraphicsPath();
            int x = rect.X, y = rect.Y, w = rect.Width, h = rect.Height;
            int h2 = rect.Height / 2;
            int offset = (h - h2 * 2);
            int r2 = r / 2;

            if (mode != PathMode.Bottom)
            {
                path.AddArc(x, y, r, r, 180, 90);
                path.AddArc(x + w - h2 - r2, y, r, r, 270, 45);
                path.AddArc(x + w - r, y + h2 - r2, r, r, 270 + 45, 45);
            }
            RectangleF gr = new RectangleF(x, y + r, w, h - r);

            if (mode != PathMode.All)
            {
                Point pt1 = new Point(x + w, y + h2);
                Point pt2 = new Point(x, y + h2);
                if (mode == PathMode.Top)
                {
                    path.AddLine(pt1, pt2);
                }
                else
                {
                    path.AddLine(pt2, pt1);
                }
            }
            if (mode != PathMode.Top)
            {
                path.AddArc(x + w - r, y + h2 - r2, r, r, 0, 45);
                path.AddArc(x + w - h2 - r2 + offset, y + h - r, r, r, 45, 45);
                path.AddArc(x, y + h - r, r, r, 90, 90);
            }

            path.CloseFigure();
            return path;
        }
示例#12
0
        private static GraphicsPath GetEllipsePath(Rectangle rect, int r, int reflectionHeight, PathMode mode, RoundedCorners corners)
        {
            GraphicsPath path = new GraphicsPath();
            switch (mode)
            {
                case PathMode.All:
                    path.AddEllipse(rect);
                    break;

                case PathMode.Top:
                    path.AddArc(rect, 180, 180);
                    break;

                case PathMode.Bottom:
                    path.AddArc(rect, 0, 180);
                    break;
            }

            path.CloseFigure();

            return path;
        }