Exemplo n.º 1
0
            internal Interface35 GetGlyph(char c, bool vertical, char fallback)
            {
                int key = vertical ? (int)-c : (int)c;

                lock (this.dictionary_0)
                {
                    Interface35 nterface35;
                    this.dictionary_0.TryGetValue(key, out nterface35);
                    if (nterface35 == null)
                    {
                        ShxShape shxShape = this.shxFile_0.GetShape(c) ?? this.shxFile_0.GetShape(fallback);
                        if (shxShape == null)
                        {
                            nterface35 = (Interface35) new Class866(c);
                        }
                        else
                        {
                            WW.Math.Point2D endPoint;
                            GeneralShape2D  generalShape2D = new GeneralShape2D(shxShape.GetGlyphShape(vertical, out endPoint), this.matrix2D_0, true);
                            double          m00            = this.matrix2D_0.M00;
                            endPoint.X *= m00;
                            endPoint.Y *= -m00;
                            nterface35  = (Interface35) new Class866(c, (IShape2D)generalShape2D, new Vector2D(endPoint.X, endPoint.Y), false);
                        }
                        this.dictionary_0.Add(key, nterface35);
                    }
                    return(nterface35);
                }
            }
Exemplo n.º 2
0
        public IShape2D GetGlyphShape(bool vertical, out WW.Math.Point2D endPoint)
        {
            IShape2D wrappedShape;

            if (vertical)
            {
                if (this.generalShape2D_1 == null)
                {
                    ShxShape.Class466 class466 = this.method_0(vertical);
                    this.generalShape2D_1 = class466.Shape;
                    this.point2D_1        = class466.CurrentPosition;
                }
                wrappedShape = (IShape2D)this.generalShape2D_1;
                endPoint     = this.point2D_1;
            }
            else
            {
                if (this.generalShape2D_0 == null)
                {
                    ShxShape.Class466 class466 = this.method_0(vertical);
                    this.generalShape2D_0 = class466.Shape;
                    this.point2D_0        = class466.CurrentPosition;
                }
                wrappedShape = (IShape2D)this.generalShape2D_0;
                endPoint     = this.point2D_0;
            }
            return((IShape2D) new CachedBoundsShape2D(wrappedShape));
        }
Exemplo n.º 3
0
 private static void smethod_2(GeneralShape2D result, double halfSize)
 {
     result.MoveTo(-halfSize, 0.0);
     result.LineTo(halfSize, 0.0);
     result.MoveTo(0.0, -halfSize);
     result.LineTo(0.0, halfSize);
 }
Exemplo n.º 4
0
        public GraphicsPath GetGraphicsPath(bool vertical, out PointF endPoint)
        {
            GraphicsPath graphicsPath;

            if (vertical)
            {
                if (this.generalShape2D_1 == null)
                {
                    ShxShape.Class466 class466 = this.method_0(vertical);
                    this.generalShape2D_1 = class466.Shape;
                    this.point2D_1        = class466.CurrentPosition;
                }
                graphicsPath = (GraphicsPath)this.generalShape2D_1;
                endPoint     = (PointF)this.point2D_1;
            }
            else
            {
                if (this.generalShape2D_0 == null)
                {
                    ShxShape.Class466 class466 = this.method_0(vertical);
                    this.generalShape2D_0 = class466.Shape;
                    this.point2D_0        = class466.CurrentPosition;
                }
                graphicsPath = (GraphicsPath)this.generalShape2D_0;
                endPoint     = (PointF)this.point2D_0;
            }
            return(graphicsPath);
        }
Exemplo n.º 5
0
        public Class472(
            string text,
            Interface14 font,
            Color color,
            short lineWeight,
            Interface35[] glyphs,
            Matrix2D basicTrafo,
            double charSpacingFactor)
        {
            this.string_0      = text;
            this.interface14_0 = font;
            this.color_0       = color;
            this.short_0       = lineWeight;
            this.interface35_0 = glyphs;
            this.double_0      = charSpacingFactor;
            this.matrix2D_0    = basicTrafo;
            foreach (ICanonicalGlyph glyph in glyphs)
            {
                this.vector2D_0 += glyph.Advance;
            }
            if (charSpacingFactor != 1.0)
            {
                this.vector2D_0.X *= charSpacingFactor;
            }
            this.generalShape2D_0 = new GeneralShape2D();
            Vector2D zero = Vector2D.Zero;

            foreach (Interface35 glyph in glyphs)
            {
                this.generalShape2D_0.Append(glyph.Path, false, Transformation3D.Translation(zero.X, zero.Y));
                zero += glyph.Advance * charSpacingFactor;
            }
        }
Exemplo n.º 6
0
        private static void smethod_3(GeneralShape2D result, double halfSize)
        {
            double num = 0.5 * System.Math.Sqrt(2.0) * halfSize;

            result.MoveTo(-num, -num);
            result.LineTo(num, num);
            result.MoveTo(num, -num);
            result.LineTo(-num, num);
        }
Exemplo n.º 7
0
 internal Class466(ShxFile shxFile, bool vertical)
 {
     this.shxFile_0        = shxFile;
     this.bool_0           = vertical;
     this.stack_0          = new Stack <WW.Math.Point2D>();
     this.double_0         = 1.0;
     this.generalShape2D_0 = new GeneralShape2D();
     this.point2D_0        = WW.Math.Point2D.Zero;
     this.PenDown          = true;
 }
Exemplo n.º 8
0
 public void Draw(Class386 context)
 {
     if (this.ishape4D_0.IsFilled)
     {
         using (GraphicsPath graphicsPath = ShapeTool.ToGraphicsPath(this.ishape4D_0.ToShape2D(context.Transform)))
             context.Graphics.FillPath((Brush)this.method_3((Class385)context), graphicsPath);
     }
     else
     {
         IShape2D       shape2D = this.ishape4D_0.ToShape2D(context.Transform);
         GeneralShape2D shape   = shape2D as GeneralShape2D ?? new GeneralShape2D(shape2D, true);
         context.FastRasterizer.DrawShape(shape, (uint)this.Color.ToArgb());
     }
 }
Exemplo n.º 9
0
 internal void method_0(DxfModel model)
 {
     if ((this.elementType_0 & DxfLineType.ElementType.IsShape) != DxfLineType.ElementType.None)
     {
         if (this.TextStyle == null)
         {
             return;
         }
         ShxFile shxFile = this.TextStyle.GetShxFile();
         if (shxFile == null)
         {
             return;
         }
         ShxShape shapeByIndex = shxFile.GetShapeByIndex((ushort)this.short_0);
         if (shapeByIndex == null)
         {
             return;
         }
         WW.Math.Point2D endPoint;
         this.fillableShape2D_0 = new FillableShape2D(shapeByIndex.GetGlyphShape(this.TextStyle.IsVertical, out endPoint), false);
     }
     else
     {
         if ((this.elementType_0 & DxfLineType.ElementType.IsText) == DxfLineType.ElementType.None || this.TextStyle == null)
         {
             return;
         }
         Class425        class425     = Class594.smethod_10(this.string_0, 1.0, this.TextStyle.ObliqueAngle, this.TextStyle.WidthFactor, this.TextStyle, Colors.White);
         List <Class908> class908List = new List <Class908>();
         class425.imethod_3((ICollection <Class908>)class908List, Matrix4D.Identity, (short)0);
         GeneralShape2D generalShape2D = new GeneralShape2D();
         bool           filled         = false;
         foreach (Class908 class908 in class908List)
         {
             generalShape2D.Append(class908.FontPath, false);
             if (class908.Font.Filled)
             {
                 filled = true;
             }
         }
         if (!generalShape2D.HasSegments)
         {
             return;
         }
         generalShape2D.ShrinkWrap();
         this.fillableShape2D_0 = new FillableShape2D((IShape2D) new CachedBoundsShape2D((IShape2D)generalShape2D), filled);
     }
 }
Exemplo n.º 10
0
            public Class866 method_0(char c)
            {
                Class866 class866;

                lock (this.dictionary_0)
                {
                    if (!this.dictionary_0.TryGetValue(c, out class866))
                    {
                        using (GraphicsPath path1 = new GraphicsPath())
                        {
                            StringFormat format = new StringFormat(StringFormat.GenericTypographic);
                            format.FormatFlags |= StringFormatFlags.NoWrap;
                            format.FormatFlags &= ~StringFormatFlags.NoFontFallback;
                            path1.AddString(c.ToString(), this.Font.FontFamily, (int)this.Font.Style, 144f, this.pointF_0, format);
                            IShape2D wrappedShape = (IShape2D)GeneralShape2D.Create(path1, Transformation2D.Scaling(this.double_0));
                            IShape2D path2        = wrappedShape.HasSegments ? (IShape2D) new CachedBoundsShape2D(wrappedShape) : (IShape2D)NullShape2D.Instance;
                            class866 = new Class866(c, path2, Vector2D.Zero, true);
                            format.Dispose();
                        }
                        this.dictionary_0.Add(c, class866);
                    }
                }
                return(class866);
            }
Exemplo n.º 11
0
        private WoutWareGlyph method_4(Stream stream, byte[] buffer)
        {
            char           letter         = WoutWareFont.smethod_5(stream, buffer);
            Vector2D       advance        = WoutWareFont.smethod_7(stream, buffer);
            GeneralShape2D generalShape2D = new GeneralShape2D();
            int            num;

            while (true)
            {
                num = stream.ReadByte();
                if (num >= 0)
                {
                    WoutWareFont.Enum12 enum12 = (WoutWareFont.Enum12)num;
                    if ((uint)enum12 <= 100U)
                    {
                        switch (enum12)
                        {
                        case WoutWareFont.Enum12.const_5:
                            goto label_11;

                        case WoutWareFont.Enum12.const_4:
                            double m00_1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m01   = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m02_1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m10   = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m11_1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m12_1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            generalShape2D.Append(this.ilist_0[WoutWareFont.smethod_1(stream, buffer)], false, new Matrix3D(m00_1, m01, m02_1, m10, m11_1, m12_1, 0.0, 0.0, 1.0));
                            continue;

                        case WoutWareFont.Enum12.const_0:
                            generalShape2D.Append(this.ilist_0[WoutWareFont.smethod_1(stream, buffer)], false);
                            continue;

                        default:
                            goto label_12;
                        }
                    }
                    else
                    {
                        switch (enum12)
                        {
                        case WoutWareFont.Enum12.const_3:
                            double m00_2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m02_2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m11_2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double m12_2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            generalShape2D.Append(this.ilist_0[WoutWareFont.smethod_1(stream, buffer)], false, new Matrix3D(m00_2, 0.0, m02_2, 0.0, m11_2, m12_2, 0.0, 0.0, 1.0));
                            continue;

                        case WoutWareFont.Enum12.const_2:
                            double x1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double y1 = (double)WoutWareFont.smethod_3(stream, buffer);
                            generalShape2D.Append(this.ilist_0[WoutWareFont.smethod_1(stream, buffer)], false, Transformation3D.Scaling(x1, y1));
                            continue;

                        case WoutWareFont.Enum12.const_1:
                            double x2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            double y2 = (double)WoutWareFont.smethod_3(stream, buffer);
                            generalShape2D.Append(this.ilist_0[WoutWareFont.smethod_1(stream, buffer)], false, Transformation3D.Translation(x2, y2));
                            continue;

                        default:
                            goto label_12;
                        }
                    }
                }
                else
                {
                    break;
                }
            }
            throw new IOException("Unexpected end of input!");
label_11:
            IShape2D outline = !generalShape2D.HasSegments ? (IShape2D)NullShape2D.Instance : (IShape2D) new CachedBoundsShape2D((IShape2D)generalShape2D);

            return(new WoutWareGlyph(letter, outline, advance));

label_12:
            throw new IOException("Invalid reference operator " + (object)num);
        }
Exemplo n.º 12
0
        private static IShape2D smethod_11(Stream stream, byte[] buffer)
        {
            GeneralShape2D generalShape2D = new GeneralShape2D();
            int            num;

            while (true)
            {
                num = stream.ReadByte();
                if (num >= 0)
                {
                    WoutWareFont.Enum11 enum11 = (WoutWareFont.Enum11)num;
                    if ((uint)enum11 <= 46U)
                    {
                        if (enum11 != WoutWareFont.Enum11.const_5)
                        {
                            if (enum11 == WoutWareFont.Enum11.const_4)
                            {
                                generalShape2D.Close();
                            }
                            else
                            {
                                goto label_15;
                            }
                        }
                        else
                        {
                            goto label_12;
                        }
                    }
                    else
                    {
                        switch (enum11)
                        {
                        case WoutWareFont.Enum11.const_3:
                            Point2D p1_1 = WoutWareFont.smethod_9(stream, buffer);
                            Point2D p2_1 = WoutWareFont.smethod_9(stream, buffer);
                            Point2D p3   = WoutWareFont.smethod_9(stream, buffer);
                            generalShape2D.CubicTo(p1_1, p2_1, p3);
                            continue;

                        case WoutWareFont.Enum11.const_1:
                            Point2D p1 = WoutWareFont.smethod_9(stream, buffer);
                            generalShape2D.LineTo(p1);
                            continue;

                        case WoutWareFont.Enum11.const_0:
                            Point2D p2 = WoutWareFont.smethod_9(stream, buffer);
                            generalShape2D.MoveTo(p2);
                            continue;

                        case WoutWareFont.Enum11.const_2:
                            Point2D p1_2 = WoutWareFont.smethod_9(stream, buffer);
                            Point2D p2_2 = WoutWareFont.smethod_9(stream, buffer);
                            generalShape2D.QuadTo(p1_2, p2_2);
                            continue;

                        default:
                            goto label_15;
                        }
                    }
                }
                else
                {
                    break;
                }
            }
            throw new IOException("Unexpected end of input!");
label_12:
            if (generalShape2D.HasSegments)
            {
                generalShape2D.ShrinkWrap();
            }
            else
            {
                generalShape2D = (GeneralShape2D)null;
            }
            return((IShape2D)generalShape2D);

label_15:
            throw new IOException("Invalid path operator " + (object)num);
        }
Exemplo n.º 13
0
        public void DrawShape(GeneralShape2D shape, uint argb)
        {
            int segmentCount = shape.SegmentCount;

            SegmentType[] segmentTypes = shape.SegmentTypes;
            Point2D[]     coordinates  = shape.Coordinates;
            int           index1       = 0;
            Point2D       point2D      = Point2D.Zero;

            for (int index2 = 0; index2 < segmentCount; ++index2)
            {
                switch (segmentTypes[index2])
                {
                case SegmentType.MoveTo:
                    point2D = coordinates[index1];
                    ++index1;
                    break;

                case SegmentType.LineTo:
                    Point2D p2_1 = coordinates[index1];
                    this.DrawLineSegment(point2D, p2_1, argb);
                    point2D = p2_1;
                    ++index1;
                    break;

                case SegmentType.QuadTo:
                    Point2D[] point2DArray1 = coordinates;
                    int       index3        = index1;
                    int       num1          = index3 + 1;
                    Point2D   p1_1          = point2DArray1[index3];
                    Point2D[] point2DArray2 = coordinates;
                    int       index4        = num1;
                    index1 = index4 + 1;
                    Point2D p2_2 = point2DArray2[index4];
                    this.DrawQuadraticBezier(point2D, p1_1, p2_2, argb);
                    point2D = p2_2;
                    break;

                case SegmentType.CubicTo:
                    Point2D[] point2DArray3 = coordinates;
                    int       index5        = index1;
                    int       num2          = index5 + 1;
                    Point2D   p1_2          = point2DArray3[index5];
                    Point2D[] point2DArray4 = coordinates;
                    int       index6        = num2;
                    int       num3          = index6 + 1;
                    Point2D   p2_3          = point2DArray4[index6];
                    Point2D[] point2DArray5 = coordinates;
                    int       index7        = num3;
                    index1 = index7 + 1;
                    Point2D p3 = point2DArray5[index7];
                    this.DrawCubicBezier(point2D, p1_2, p2_3, p3, argb);
                    point2D = p3;
                    break;

                case SegmentType.Close:
                    Point2D p2_4 = coordinates[0];
                    this.DrawLineSegment(point2D, p2_4, argb);
                    point2D = p2_4;
                    break;
                }
            }
        }
Exemplo n.º 14
0
 private static void smethod_1(GeneralShape2D result, double halfSize)
 {
     result.AddSquare(WW.Math.Point2D.Zero, halfSize);
     result.AddCircleApproximation(WW.Math.Point2D.Zero, halfSize);
 }
Exemplo n.º 15
0
        public static IShape2D CreateShape(PointDisplayMode pointDisplayMode, double size)
        {
            double num = 0.5 * size;

            switch (pointDisplayMode)
            {
            case PointDisplayMode.Point:
                return(Class384.ishape2D_0);

            case PointDisplayMode.None:
                return((IShape2D)NullShape2D.Instance);

            case PointDisplayMode.PlusSign:
                GeneralShape2D result1 = new GeneralShape2D(4, 4);
                Class384.smethod_2(result1, size);
                result1.Fixate();
                return((IShape2D)result1);

            case PointDisplayMode.XSign:
                GeneralShape2D result2 = new GeneralShape2D(4, 4);
                Class384.smethod_3(result2, size);
                result2.Fixate();
                return((IShape2D)result2);

            case (PointDisplayMode)4:
                GeneralShape2D result3 = new GeneralShape2D(4, 4);
                Class384.smethod_0(result3, num);
                result3.Fixate();
                return((IShape2D)result3);

            case (PointDisplayMode)32:
                GeneralShape2D generalShape2D1 = new GeneralShape2D(7, 15);
                generalShape2D1.AddPoint(WW.Math.Point2D.Zero);
                generalShape2D1.AddCircleApproximation(WW.Math.Point2D.Zero, num);
                generalShape2D1.Fixate();
                return((IShape2D)generalShape2D1);

            case (PointDisplayMode)33:
                GeneralShape2D generalShape2D2 = new GeneralShape2D(5, 13);
                generalShape2D2.AddCircleApproximation(WW.Math.Point2D.Zero, num);
                generalShape2D2.Fixate();
                return((IShape2D)generalShape2D2);

            case (PointDisplayMode)34:
                GeneralShape2D result4 = new GeneralShape2D(9, 17);
                Class384.smethod_2(result4, size);
                result4.AddCircleApproximation(WW.Math.Point2D.Zero, num);
                result4.Fixate();
                return((IShape2D)result4);

            case (PointDisplayMode)35:
                GeneralShape2D result5 = new GeneralShape2D(9, 17);
                Class384.smethod_3(result5, size);
                result5.AddCircleApproximation(WW.Math.Point2D.Zero, num);
                result5.Fixate();
                return((IShape2D)result5);

            case (PointDisplayMode)36:
                GeneralShape2D result6 = new GeneralShape2D(7, 15);
                Class384.smethod_0(result6, num);
                result6.AddCircleApproximation(WW.Math.Point2D.Zero, num);
                result6.Fixate();
                return((IShape2D)result6);

            case (PointDisplayMode)64:
                GeneralShape2D generalShape2D3 = new GeneralShape2D(6, 6);
                generalShape2D3.AddPoint(WW.Math.Point2D.Zero);
                generalShape2D3.AddSquare(WW.Math.Point2D.Zero, num);
                generalShape2D3.Fixate();
                return((IShape2D)generalShape2D3);

            case (PointDisplayMode)65:
                GeneralShape2D generalShape2D4 = new GeneralShape2D(4, 4);
                generalShape2D4.AddSquare(WW.Math.Point2D.Zero, num);
                generalShape2D4.Fixate();
                return((IShape2D)generalShape2D4);

            case (PointDisplayMode)66:
                GeneralShape2D result7 = new GeneralShape2D(8, 8);
                Class384.smethod_2(result7, size);
                result7.AddSquare(WW.Math.Point2D.Zero, num);
                result7.Fixate();
                return((IShape2D)result7);

            case (PointDisplayMode)67:
                GeneralShape2D result8 = new GeneralShape2D(8, 8);
                Class384.smethod_3(result8, size);
                result8.AddSquare(WW.Math.Point2D.Zero, num);
                result8.Fixate();
                return((IShape2D)result8);

            case (PointDisplayMode)68:
                GeneralShape2D result9 = new GeneralShape2D(7, 6);
                Class384.smethod_0(result9, num);
                result9.AddSquare(WW.Math.Point2D.Zero, num);
                result9.Fixate();
                return((IShape2D)result9);

            case (PointDisplayMode)96:
                GeneralShape2D result10 = new GeneralShape2D(11, 19);
                result10.AddPoint(WW.Math.Point2D.Zero);
                Class384.smethod_1(result10, num);
                result10.Fixate();
                return((IShape2D)result10);

            case (PointDisplayMode)97:
                GeneralShape2D result11 = new GeneralShape2D(9, 17);
                Class384.smethod_1(result11, num);
                result11.Fixate();
                return((IShape2D)result11);

            case (PointDisplayMode)98:
                GeneralShape2D result12 = new GeneralShape2D(13, 21);
                Class384.smethod_2(result12, size);
                Class384.smethod_1(result12, num);
                result12.Fixate();
                return((IShape2D)result12);

            case (PointDisplayMode)99:
                GeneralShape2D result13 = new GeneralShape2D(13, 21);
                Class384.smethod_3(result13, size);
                Class384.smethod_1(result13, num);
                result13.Fixate();
                return((IShape2D)result13);

            case (PointDisplayMode)100:
                GeneralShape2D result14 = new GeneralShape2D(11, 19);
                Class384.smethod_0(result14, num);
                Class384.smethod_1(result14, num);
                result14.Fixate();
                return((IShape2D)result14);

            default:
                return(Class384.ishape2D_0);
            }
        }