コード例 #1
0
        public static HatchStyleDefinition HatchStyleDefinition(MetafileReader reader)
        {
            int hatchIndex = reader.ReadIndex();
            HatchStyleIndicator styleIndicator = ParseHatchStyleIndicator(reader.ReadEnum());
            double hatchDirectionStartX        = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
            double hatchDirectionStartY        = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
            double hatchDirectionEndX          = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
            double hatchDirectionEndY          = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
            double dutyCycleLength             = reader.ReadSizeSpecification(reader.Descriptor.InteriorStyleSpecificationMode);
            int    n         = reader.ReadInteger();
            var    gapWidths = new List <int>();

            for (int i = 0; i < n; i++)
            {
                gapWidths.Add(reader.ReadInteger());
            }
            var lineTypes = new List <int>();

            for (int i = 0; i < n; i++)
            {
                lineTypes.Add(reader.ReadInteger());
            }
            return(new HatchStyleDefinition(hatchIndex, styleIndicator,
                                            new PointF((float)hatchDirectionStartX, (float)hatchDirectionStartY),
                                            new PointF((float)hatchDirectionEndX, (float)hatchDirectionEndY),
                                            dutyCycleLength, gapWidths.ToArray(), lineTypes.ToArray()));
        }
コード例 #2
0
        public static PatternSize PatternSize(MetafileReader reader)
        {
            // NOTE: Pattern size may only be 'absolute' (VDC) in Version 1 and 2 metafiles. In Version 3 and 4 metafiles it may be
            //       expressed in any of the modes which can be selected with INTERIOR STYLE SPECIFICATION MODE.
            var specificationMode = reader.Properties.Version < 3 ? WidthSpecificationModeType.Absolute : reader.Descriptor.InteriorStyleSpecificationMode;

            return(new PatternSize(
                       new PointF((float)reader.ReadSizeSpecification(specificationMode), (float)reader.ReadSizeSpecification(specificationMode)),
                       new PointF((float)reader.ReadSizeSpecification(specificationMode), (float)reader.ReadSizeSpecification(specificationMode))));
        }
コード例 #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()));
        }
コード例 #4
0
        public static LineAndEdgeTypeDefinition LineAndEdgeTypeDefinition(MetafileReader reader)
        {
            int    lineType = reader.ReadIndex();
            double dashCycleRepeatLength = reader.ReadSizeSpecification(reader.Descriptor.LineWidthSpecificationMode);
            var    dashElements          = new List <int>();

            while (reader.HasMoreData())
            {
                dashElements.Add(reader.ReadInteger());
            }
            return(new LineAndEdgeTypeDefinition(lineType, dashCycleRepeatLength, dashElements.ToArray()));
        }
コード例 #5
0
 public static MarkerSize MarkerSize(MetafileReader reader)
 {
     return(new MarkerSize(reader.ReadSizeSpecification(reader.Descriptor.MarkerSizeSpecificationMode)));
 }
コード例 #6
0
 public static LineWidth LineWidth(MetafileReader reader)
 {
     return(new LineWidth(reader.ReadSizeSpecification(reader.Descriptor.LineWidthSpecificationMode)));
 }