コード例 #1
0
        public void LineTo(float x, float y)
        {
            currentCnt.AddPart(new GlyphLine(curX, curY, x, y));
            this.curX = x;
            this.curY = y;

            allPoints.Add(x);
            allPoints.Add(y);
        }
コード例 #2
0
        static GlyphContour CreateFitContour(GlyphContour contour, float pixelScale, bool x_axis, bool y_axis)
        {
            GlyphContour     newc  = new GlyphContour();
            List <GlyphPart> parts = contour.parts;
            int m = parts.Count;

            for (int n = 0; n < m; ++n)
            {
                GlyphPart p = parts[n];
                switch (p.Kind)
                {
                default: throw new NotSupportedException();

                case GlyphPartKind.Curve3:
                {
                    GlyphCurve3 curve3 = (GlyphCurve3)p;
                    newc.AddPart(new GlyphCurve3(
                                     curve3.FirstPoint.X * pixelScale, curve3.FirstPoint.Y * pixelScale,
                                     curve3.x1 * pixelScale, curve3.y1 * pixelScale,
                                     curve3.x2 * pixelScale, curve3.y2 * pixelScale));
                }
                break;

                case GlyphPartKind.Curve4:
                {
                    GlyphCurve4 curve4 = (GlyphCurve4)p;
                    newc.AddPart(new GlyphCurve4(
                                     curve4.FirstPoint.X * pixelScale, curve4.FirstPoint.Y * pixelScale,
                                     curve4.x1 * pixelScale, curve4.y1 * pixelScale,
                                     curve4.x2 * pixelScale, curve4.y2 * pixelScale,
                                     curve4.x3 * pixelScale, curve4.y3 * pixelScale
                                     ));
                }
                break;

                case GlyphPartKind.Line:
                {
                    GlyphLine line = (GlyphLine)p;
                    newc.AddPart(new GlyphLine(
                                     line.FirstPoint.X * pixelScale, line.FirstPoint.Y * pixelScale,
                                     line.x1 * pixelScale, line.y1 * pixelScale
                                     ));
                }
                break;
                }
            }
            return(newc);
        }