public static NonUniformRationalBSpline NonUniformRationalBSpline(MetafileReader reader)
        {
            int splineOrder           = reader.ReadInteger();
            int numberOfControlPoints = reader.ReadInteger();
            var controlPoints         = new List <PointF>();

            for (int i = 0; i < numberOfControlPoints; i++)
            {
                controlPoints.Add(reader.ReadPoint());
            }
            var knots = new List <double>();

            for (int i = 0; i < splineOrder + numberOfControlPoints; i++)
            {
                knots.Add(reader.ReadReal());
            }
            double start   = reader.ReadReal();
            double end     = reader.ReadReal();
            var    weights = new List <double>();

            for (int i = 0; i < numberOfControlPoints; i++)
            {
                weights.Add(reader.ReadReal());
            }
            return(new NonUniformRationalBSpline(splineOrder, controlPoints.ToArray(), knots.ToArray(), start, end, weights.ToArray()));
        }
 public static BeginTileArray BeginTileArray(MetafileReader reader)
 {
     return(new BeginTileArray(
                reader.ReadPoint(),
                ParseCellPathDirection(reader.ReadEnum()),
                ParseLineProgressionDirection(reader.ReadEnum()),
                reader.ReadInteger(), reader.ReadInteger(),
                reader.ReadInteger(), reader.ReadInteger(),
                reader.ReadReal(), reader.ReadReal(),
                reader.ReadInteger(), reader.ReadInteger(),
                reader.ReadInteger(), reader.ReadInteger()));
 }
Ejemplo n.º 3
0
        public static InterpolatedInterior InterpolatedInterior(MetafileReader reader)
        {
            int style             = reader.ReadIndex();
            var referenceGeometry = new List <PointF>();
            var stageDesignators  = new List <double>();
            var colorSpecifiers   = new List <MetafileColor>();

            // Legal values of the style parameter are positive integers. [ISO/IEC 8632-1 7.7.43]
            // Values greater than 3 are reserved for future standardization and registration.
            if (style >= 1 && style <= 3)
            {
                // parallel: the number of scalars shall be 2. The FILL REFERENCE POINT is one defining
                //      point of a reference line. A second defining point of the reference line is defined by
                //      the 2 scalars, which are respectively the x and y offset of the second point from the
                //      FILL REFERENCE POINT.
                // elliptical: the number of scalars shall be 4. The FILL REFERENCE POINT is the centre of a
                //      reference ellipse. The first pair of scalars are respectively the x and y offset from
                //      the FILL REFERENCE POINT to the first CDP of ellipse and the second pair are
                //      respectively the x and y offset from the FILL REFERENCE POINT to the second
                //      CDP of ellipse.
                // triangular: the number of scalars shall be 4. The first pair of scalars are respectively the x and
                //      y offset from the FILL REFERENCE POINT to the second corner of a reference
                //      triangle and the second pair are respectively the x and y offset from the FILL
                //      REFERENCE POINT to the third corner of the reference triangle. The number of
                //      stages shall be 0 and the list of stage designators shall be empty.
                int geoCount;
                if (style == 1)
                {
                    geoCount = 2;
                }
                else
                {
                    geoCount = 4;
                }
                for (int i = 0; i < geoCount / 2; i++)
                {
                    double rgX = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
                    double rgY = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
                    referenceGeometry.Add(new PointF((float)rgX, (float)rgY));
                }

                int numberOfStages = reader.ReadInteger();
                for (int i = 0; i < numberOfStages; i++)
                {
                    stageDesignators.Add(reader.ReadReal());
                }

                int numberOfColors = style == 3 ? 3 : numberOfStages + 1;
                for (int i = 0; i < numberOfColors; i++)
                {
                    colorSpecifiers.Add(reader.ReadColor());
                }
            }
            return(new InterpolatedInterior(style, referenceGeometry.ToArray(), stageDesignators.ToArray(), colorSpecifiers.ToArray()));
        }
Ejemplo n.º 4
0
        public static VdcRealPrecision VdcRealPrecision(MetafileReader reader)
        {
            double minValue = reader.ReadReal();
            double maxValue = reader.ReadReal();

            // assume floating point; with their respective values from the binary encoding (also ANSI/IEEE 754 stuff)
            int exponentWidth = 12;
            int fractionWidth = 52;

            if ((float)minValue >= float.MinValue && (float)maxValue <= float.MaxValue)
            {
                exponentWidth = 9;
                fractionWidth = 23;
            }

            // TODO: same as MetafileDescriptorReader.RealPrecision
            int significantDigits = reader.ReadInteger();

            return(new VdcRealPrecision(RealRepresentation.FloatingPoint, exponentWidth, fractionWidth));
        }
        public static RealPrecision RealPrecision(MetafileReader reader)
        {
            double minValue = reader.ReadReal();
            double maxValue = reader.ReadReal();

            // assume floating point; with their respective values from the binary encoding (also ANSI/IEEE 754 stuff)
            int exponentWidth = 12;
            int fractionWidth = 52;

            if ((float)minValue >= float.MinValue && (float)maxValue <= float.MaxValue)
            {
                exponentWidth = 9;
                fractionWidth = 23;
            }

            // TODO: unless writing metafiles, we probably don't really care about the number of significant digits
            //       at least we don't for reading, and unless we should, we'll just ignore it here (intentionally unused)
            int significantDigits = reader.ReadInteger();

            return(new RealPrecision(RealRepresentation.FloatingPoint, exponentWidth, fractionWidth));
        }
        public static ColorValueExtent ColorValueExtent(MetafileReader reader)
        {
            ColorValueExtent result;

            if (reader.Descriptor.ColorModel == ColorModel.RGB)
            {
                MetafileColor min = reader.ReadDirectColor();
                MetafileColor max = reader.ReadDirectColor();
                result = new ColorValueExtent(ColorSpace.RGB, min, max);
            }
            else if (reader.Descriptor.ColorModel == ColorModel.CMYK)
            {
                MetafileColor min = reader.ReadDirectColor();
                MetafileColor max = reader.ReadDirectColor();
                result = new ColorValueExtent(ColorSpace.CMYK, min, max);
            }
            else if (reader.Descriptor.ColorModel == ColorModel.CIELAB || reader.Descriptor.ColorModel == ColorModel.CIELUV || reader.Descriptor.ColorModel == ColorModel.RGBrelated)
            {
                double firstScale   = reader.ReadReal();
                double firstOffset  = reader.ReadReal();
                double secondScale  = reader.ReadReal();
                double secondOffset = reader.ReadReal();
                double thirdScale   = reader.ReadReal();
                double thirdOffset  = reader.ReadReal();
                result = new ColorValueExtent(ColorSpace.CIE, firstScale, firstOffset, secondScale, secondOffset, thirdScale, thirdOffset);
            }
            else
            {
                // unsupported, just return a default unknown color space
                result = new ColorValueExtent();
            }

            return(result);
        }
Ejemplo n.º 7
0
 public static ScalingMode ScalingMode(MetafileReader reader)
 {
     return(new ScalingMode(ParseScalingMode(reader.ReadEnum()), reader.ReadReal()));
 }
Ejemplo n.º 8
0
 public static DeviceViewportSpecificationMode DeviceViewportSpecificationMode(MetafileReader reader)
 {
     return(new DeviceViewportSpecificationMode(ParseDeviceViewportSpecificationMode(reader.ReadEnum()), reader.ReadReal()));
 }
Ejemplo n.º 9
0
 public static MiterLimit MiterLimit(MetafileReader reader)
 {
     return(new MiterLimit(reader.ReadReal()));
 }
Ejemplo n.º 10
0
 public static TextAlignment TextAlignment(MetafileReader reader)
 {
     return(new TextAlignment(ParseHorizontalAlignment(reader.ReadEnum()), ParseVerticalAlignment(reader.ReadEnum()), reader.ReadReal(), reader.ReadReal()));
 }
Ejemplo n.º 11
0
 public static CharacterSpacing CharacterSpacing(MetafileReader reader)
 {
     return(new CharacterSpacing(reader.ReadReal()));
 }
Ejemplo n.º 12
0
 public static CharacterExpansionFactor CharacterExpansionFactor(MetafileReader reader)
 {
     return(new CharacterExpansionFactor(reader.ReadReal()));
 }
Ejemplo n.º 13
0
 public static EdgeTypeInitialOffset EdgeTypeInitialOffset(MetafileReader reader)
 {
     return(new EdgeTypeInitialOffset(reader.ReadReal()));
 }
Ejemplo n.º 14
0
 public static LineTypeInitialOffset LineTypeInitialOffset(MetafileReader reader)
 {
     return(new LineTypeInitialOffset(reader.ReadReal()));
 }