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())); }
public static GeometricPatternDefinition GeometricPatternDefinition(MetafileReader reader) { int patternIndex = reader.ReadIndex(); int segmentIdentifier = reader.ReadName(); var firstCornerPoint = reader.ReadPoint(); var secondCornerPoint = reader.ReadPoint(); return(new GeometricPatternDefinition(patternIndex, segmentIdentifier, firstCornerPoint, secondCornerPoint)); }
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())); }
public static Polybezier Polybezier(MetafileReader reader) { int continuityIndicator = reader.ReadIndex(); var pointSequences = new List <PointF>(); while (reader.HasMoreData(2)) { pointSequences.Add(reader.ReadPoint()); } return(new Polybezier(continuityIndicator, pointSequences.ToArray())); }
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())); }
public static FontProperties FontProperties(MetafileReader reader) { var properties = new List <FontProperty>(); while (reader.HasMoreData()) { int propertyIndicator = reader.ReadIndex(); int priority = reader.ReadInteger(); // The SDR for each of the standardized properties contains only one member (typed sequence) [ISO/IEC 8632-1 7.3.21] var record = ApplicationStructureDescriptorReader.ParseStructuredDataRecord(reader.ReadString()); properties.Add(new FontProperty(propertyIndicator, priority, record.Elements.First())); } return(new FontProperties(properties.ToArray())); }
public static PatternTable PatternTable(MetafileReader reader) { int index = reader.ReadIndex(); int nx = reader.ReadInteger(); int ny = reader.ReadInteger(); // TODO: not really used in text encoding; but in case we ever need it, // the same check for zero as in binary encoding needs to happen. // intentionally unused until that time comes. int localColorPrecision = reader.ReadInteger(); var colors = new List <MetafileColor>(); int count = nx * ny; while (reader.HasMoreData(3) && count-- > 0) { colors.Add(reader.ReadColor()); } return(new PatternTable(index, nx, ny, colors.ToArray())); }
public static TextFontIndex TextFontIndex(MetafileReader reader) { return(new TextFontIndex(reader.ReadIndex())); }
public static MarkerType MarkerType(MetafileReader reader) { return(new MarkerType(reader.ReadIndex())); }
public static MarkerBundleIndex MarkerBundleIndex(MetafileReader reader) { return(new MarkerBundleIndex(reader.ReadIndex())); }
public static EdgeTypeContinuation EdgeTypeContinuation(MetafileReader reader) { return(new EdgeTypeContinuation(reader.ReadIndex())); }
public static EdgeJoin EdgeJoin(MetafileReader reader) { return(new EdgeJoin(reader.ReadIndex())); }
public static EdgeBundleIndex EdgeBundleIndex(MetafileReader reader) { return(new EdgeBundleIndex(reader.ReadIndex())); }
public static AlternateCharacterSetIndex AlternateCharacterSetIndex(MetafileReader reader) { return(new AlternateCharacterSetIndex(reader.ReadIndex())); }
public static CharacterSetIndex CharacterSetIndex(MetafileReader reader) { return(new CharacterSetIndex(reader.ReadIndex())); }
public static HatchIndex HatchIndex(MetafileReader reader) { return(new HatchIndex(reader.ReadIndex())); }
public static LineJoin LineJoin(MetafileReader reader) { return(new LineJoin(reader.ReadIndex())); }
public static LineCap LineCap(MetafileReader reader) { return(new LineCap(reader.ReadIndex(), reader.ReadIndex())); }
public static LineType LineType(MetafileReader reader) { return(new LineType(reader.ReadIndex())); }
public static EdgeType EdgeType(MetafileReader reader) { return(new EdgeType(reader.ReadIndex())); }
public static FillBundleIndex FillBundleIndex(MetafileReader reader) { return(new FillBundleIndex(reader.ReadIndex())); }
public static LineBundleIndex LineBundleIndex(MetafileReader reader) { return(new LineBundleIndex(reader.ReadIndex())); }
public static ProtectionRegionIndicator ProtectionRegionIndicator(MetafileReader reader) { // this one uses an index/integer type to store the enum, not a string like the others [ISO/IEC 8632-4 7.4] return(new ProtectionRegionIndicator(reader.ReadIndex(), (RegionIndicator)reader.ReadIndex())); }
public static EdgeCap EdgeCap(MetafileReader reader) { return(new EdgeCap(reader.ReadIndex(), reader.ReadIndex())); }
public static LineTypeContinuation LineTypeContinuation(MetafileReader reader) { return(new LineTypeContinuation(reader.ReadIndex())); }
public static PatternIndex PatternIndex(MetafileReader reader) { return(new PatternIndex(reader.ReadIndex())); }
public static RestrictedTextType RestrictedTextType(MetafileReader reader) { return(new RestrictedTextType(reader.ReadIndex())); }
public static BeginProtectionRegion BeginProtectionRegion(MetafileReader reader) { return(new BeginProtectionRegion(reader.ReadIndex())); }