在vb.net中使用Angus J Clipper库勾勒图形文本

在vb.net中使用Angus J Clipper库勾勒图形文本,vb.net,gdi+,polygon,outline,graphicspath,Vb.net,Gdi+,Polygon,Outline,Graphicspath,我正在GDI+GraphicsPath中使用DrawString创建文本,然后将其作为路径输出到PDF 目前,这一切都运转良好 我遇到问题的时候是所选字体导致轮廓相互重叠。我有一个图像的例子,虽然作为一个新用户,我不能上传它。。。(似乎毫无意义……) 我找到了一个和我在这方面所寻找的一样的人 虽然我一直从库中得到一个空的解决方案,但我已经将代码片段转换为vb.net 是否有其他人能够通过此库或类似库传入包含字符串的graphicsPath并检索概述的文本?以下是一些有效的C代码 usin

我正在GDI+GraphicsPath中使用DrawString创建文本,然后将其作为路径输出到PDF

目前,这一切都运转良好

我遇到问题的时候是所选字体导致轮廓相互重叠。我有一个图像的例子,虽然作为一个新用户,我不能上传它。。。(似乎毫无意义……)

我找到了一个和我在这方面所寻找的一样的人

虽然我一直从库中得到一个空的解决方案,但我已经将代码片段转换为vb.net

是否有其他人能够通过此库或类似库传入包含字符串的graphicsPath并检索概述的文本?

以下是一些有效的C代码

    using ClipperLib;

    static public void PathToPolygon(GraphicsPath path, Polygons polys, Single scale)
    {
        GraphicsPathIterator pathIterator = new GraphicsPathIterator(path);
        pathIterator.Rewind();
        polys.Clear();
        PointF[] points = new PointF[pathIterator.Count];
        byte[] types = new byte[pathIterator.Count];
        pathIterator.Enumerate(ref points, ref types);
        int i = 0;
        while (i < pathIterator.Count)
        {
            Polygon pg = new Polygon();
            polys.Add(pg);
            do {

                IntPoint pt = new IntPoint((int)(points[i].X * scale), (int)(points[i].Y * scale));
                    pg.Add(pt);
                i++;
            }
            while (i < pathIterator.Count && types[i] != 0);
        }
    }


    static private PointF[] PolygonToPointFArray(Polygon pg, float scale)
    {
        PointF[] result = new PointF[pg.Count];
        for (int i = 0; i < pg.Count; ++i)
        {
            result[i].X = (float)pg[i].X / scale;
            result[i].Y = (float)pg[i].Y / scale;
        }
        return result;
    }


    private void DrawBitmap()
    {
        Font f = new Font("Arial", 90);
        Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6);
        SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0));
        path.Reset();
        Polygons polys;
        path.AddString("ABC", f.FontFamily, (int)f.Style, f.Size, new Point(100, 100), null);
        path.Flatten();
        //scale all points up by 100 because Clipper uses integer coordinates
        PathToPolygon(path, polys, 100);
        path.Reset();
        //offset polys remembering to multiply delta by scaling amount ...
        polys = Clipper.OffsetPolygons(polys, 7 * 100, JoinType.jtRound);
        for (int i = 0; i < polys.Count(); i++)
        {
            //reverses scaling ...
            PointF[] pts2 = PolygonToPointFArray(polys[i], 100);
            path.AddPolygon(pts2);
        }
        newgraphic.FillPath(myBrush, path);
        newgraphic.DrawPath(myPen, path);
    }
使用ClipperLib;
静态公共空心路径拓扑多边形(图形路径、多边形多边形、单比例)
{
GraphicsPathIterator路径迭代器=新的GraphicsPathIterator(路径);
pathIterator.Rewind();
polys.Clear();
PointF[]points=新的PointF[pathIterator.Count];
字节[]类型=新字节[pathIterator.Count];
枚举(引用点、引用类型);
int i=0;
while(i
这里有一些C代码可以工作

    using ClipperLib;

    static public void PathToPolygon(GraphicsPath path, Polygons polys, Single scale)
    {
        GraphicsPathIterator pathIterator = new GraphicsPathIterator(path);
        pathIterator.Rewind();
        polys.Clear();
        PointF[] points = new PointF[pathIterator.Count];
        byte[] types = new byte[pathIterator.Count];
        pathIterator.Enumerate(ref points, ref types);
        int i = 0;
        while (i < pathIterator.Count)
        {
            Polygon pg = new Polygon();
            polys.Add(pg);
            do {

                IntPoint pt = new IntPoint((int)(points[i].X * scale), (int)(points[i].Y * scale));
                    pg.Add(pt);
                i++;
            }
            while (i < pathIterator.Count && types[i] != 0);
        }
    }


    static private PointF[] PolygonToPointFArray(Polygon pg, float scale)
    {
        PointF[] result = new PointF[pg.Count];
        for (int i = 0; i < pg.Count; ++i)
        {
            result[i].X = (float)pg[i].X / scale;
            result[i].Y = (float)pg[i].Y / scale;
        }
        return result;
    }


    private void DrawBitmap()
    {
        Font f = new Font("Arial", 90);
        Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6);
        SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0));
        path.Reset();
        Polygons polys;
        path.AddString("ABC", f.FontFamily, (int)f.Style, f.Size, new Point(100, 100), null);
        path.Flatten();
        //scale all points up by 100 because Clipper uses integer coordinates
        PathToPolygon(path, polys, 100);
        path.Reset();
        //offset polys remembering to multiply delta by scaling amount ...
        polys = Clipper.OffsetPolygons(polys, 7 * 100, JoinType.jtRound);
        for (int i = 0; i < polys.Count(); i++)
        {
            //reverses scaling ...
            PointF[] pts2 = PolygonToPointFArray(polys[i], 100);
            path.AddPolygon(pts2);
        }
        newgraphic.FillPath(myBrush, path);
        newgraphic.DrawPath(myPen, path);
    }
使用ClipperLib;
静态公共空心路径拓扑多边形(图形路径、多边形多边形、单比例)
{
GraphicsPathIterator路径迭代器=新的GraphicsPathIterator(路径);
pathIterator.Rewind();
polys.Clear();
PointF[]points=新的PointF[pathIterator.Count];
字节[]类型=新字节[pathIterator.Count];
枚举(引用点、引用类型);
int i=0;
while(i

谢谢你,安格斯。只是试图转换代码,虽然有点吹牛。。。你知道这是如何在vb中实现的吗?使用多边形=列表;再次谢谢。我从来没碰过VB。没问题,谢谢。我成功地转换了代码,虽然我的Q中的代码也能正常工作,但我必须使用ClipType.ctUnion。它工作得太快了!你们在那个里建立了一个很棒的库:)是的,我把轮廓误读为偏移,所以,当然,“联合”多边形正是你们需要做的。无论如何,谢谢你的鼓励性反馈。你是我的克利伯图书馆。谢谢你安格斯。只是试图转换代码,虽然有点吹牛。。。你知道这是如何在vb中实现的吗?使用多边形=列表;再次谢谢。我从来没碰过VB。没问题,谢谢。我成功地转换了代码,虽然我的Q中的代码也能正常工作,但我必须使用ClipType.ctUnion。我