public static EndFigure EndFigure(MetafileReader reader, CommandHeader commandHeader) { // END FIGURE: has no parameters return(new EndFigure()); }
public static NewRegion NewRegion(MetafileReader reader, CommandHeader commandHeader) { // NEW REGION: has no parameters return(new NewRegion()); }
public static ApplicationData ApplicationData(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) identifier // P2: (data record) application data record; data records are bound as strings in this encoding. return(new ApplicationData(reader.ReadInteger(), reader.ReadString())); }
public static MiterLimit MiterLimit(MetafileReader reader, CommandHeader commandHeader) { // P1: (real) mitre limit return(new MiterLimit(reader.ReadReal())); }
public static ClipRectangle ClipRectangle(MetafileReader reader, CommandHeader commandHeader) { // P1: (point) first corner // P2: (point) second corner return(new ClipRectangle(reader.ReadPoint(), reader.ReadPoint())); }
public static MetafileDescription MetafileDescription(MetafileReader reader, CommandHeader commandHeader) { // P1: (string fixed) metafile description string return(new MetafileDescription(reader.ReadString())); }
public static ColorIndexPrecision ColorIndexPrecision(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) Colour index precision: valid values are 8, 16, 24 or 32 return(new ColorIndexPrecision(reader.ReadInteger())); }
public static BeginCompoundTextPath BeginCompoundTextPath(MetafileReader reader, CommandHeader commandHeader) { // BEGIN COMPOUND TEXT PATH: has no parameters return(new BeginCompoundTextPath()); }
public static EndCompoundTextPath EndCompoundTextPath(MetafileReader reader, CommandHeader commandHeader) { // END COMPOUND TEXT PATH: has no parameters return(new EndCompoundTextPath()); }
public static BeginMetafile BeginMetafile(MetafileReader reader, CommandHeader commandHeader) { // P1: (string fixed) metafile name return(new BeginMetafile(reader.ReadString())); }
public static EndCompoundLine EndCompoundLine(MetafileReader reader, CommandHeader commandHeader) { // END COMPOUND LINE: has no parameters return(new EndCompoundLine()); }
public static BeginCompoundLine BeginCompoundLine(MetafileReader reader, CommandHeader commandHeader) { // BEGIN COMPOUND LINE: has no parameters return(new BeginCompoundLine()); }
public static EndProtectionRegion EndProtectionRegion(MetafileReader reader, CommandHeader commandHeader) { // END PROTECTION REGION: has no parameters return(new EndProtectionRegion()); }
public static BeginProtectionRegion BeginProtectionRegion(MetafileReader reader, CommandHeader commandHeader) { // P1: (index) region index return(new BeginProtectionRegion(reader.ReadIndex())); }
public static MaximumVdcExtent MaximumVdcExtent(MetafileReader reader, CommandHeader commandHeader) { // P1: (point) first corner // P2: (point) second corner return(new MaximumVdcExtent(reader.ReadPoint(), reader.ReadPoint())); }
public static CellArray CellArray(MetafileReader reader, CommandHeader commandHeader) { // P1: (point) corner point P // P2: (point) corner point Q // P3: (point) corner point R // P4: (integer) nx // P5: (integer) ny // P6: (integer) local colour precision: valid values are 0, 1, 2, 4, 8, 16, 24, and 32. If the value is zero (the // 'default colour precision indicator' value), the COLOUR (INDEX) PRECISION for the picture indicates the // precision with which the colour list is encoded. If the value is non-zero, the precision with which the colour // data is encoded is given by the value. // P7: (enumerated) cell representation mode: valid values are // 0 run length list mode // 1 packed list mode // P8: (colour list) array of cell colour values. // If the COLOUR SELECTION MODE is 'direct', the values will be direct colour values. If the COLOUR // SELECTION MODE is 'indexed', the values will be indexes into the COLOUR TABLE. // If the cell representation mode is 'packed list', the colour values are represented by rows of values, each // row starting on a word boundary. If the cell representation mode is 'run length', the colour list values are // represented by rows broken into runs of constant colour; each row starts on a word boundary. Each list // item consists of a cell count (integer) followed by a colour value. With the exception of the first run of a // row, the integer count of each run immediately follows the colour specifier of the preceding run with no // intervening padding. var p = reader.ReadPoint(); var q = reader.ReadPoint(); var r = reader.ReadPoint(); int nx = reader.ReadInteger(); int ny = reader.ReadInteger(); int localColorPrecision = reader.ReadInteger(); if (localColorPrecision == 0) { if (reader.Descriptor.ColorSelectionMode == ColorModeType.Direct) { localColorPrecision = reader.Descriptor.ColorPrecision; } else { localColorPrecision = reader.Descriptor.ColorIndexPrecision; } } // might be either 1/2/4 or 8/16/32 here; but we want byte-sizes in ReadColor if (localColorPrecision >= 8) { localColorPrecision /= 8; } var cellRepresentationMode = reader.ReadEnum <CellRepresentationMode>(); int totalCount = nx * ny; var colors = new List <MetafileColor>(); while (colors.Count < totalCount) { // chunks are split into rows; each row is word-aligned // word-align the next read if necessary if (reader.Position % 2 == 1 && reader.HasMoreData()) { reader.ReadByte(); } int rowCount = nx; while (rowCount > 0) { if (cellRepresentationMode == CellRepresentationMode.RunLengthList) { int cellCount = reader.ReadInteger(); rowCount -= cellCount; var cellColor = reader.ReadColor(localColorPrecision); colors.AddRange(Enumerable.Range(0, cellCount).Select(i => cellColor)); } else { rowCount--; colors.Add(reader.ReadColor(localColorPrecision)); } } } return(new CellArray(p, q, r, nx, ny, colors.ToArray())); }
public static SegmentPriorityExtent SegmentPriorityExtent(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) minimum segment priority value: valid values are non-negative integers // P2: (integer) maximum segment priority value: valid values are non-negative integers return(new SegmentPriorityExtent(reader.ReadInteger(), reader.ReadInteger())); }
public static Circle Circle(MetafileReader reader, CommandHeader commandHeader) { // P1: (point) centre of circle // P2: (vdc) radius of circle return(new Circle(reader.ReadPoint(), reader.ReadVdc())); }
public static IntegerPrecision IntegerPrecision(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) integer precision: valid values are 8, 16, 24 or 32 return(new IntegerPrecision(reader.ReadInteger())); }
public static ConnectingEdge ConnectingEdge(MetafileReader reader, CommandHeader commandHeader) { // CONNECTING EDGE: has no parameters return(new ConnectingEdge()); }
public static MaximumColorIndex MaximumColorIndex(MetafileReader reader, CommandHeader commandHeader) { // P1: (colour index) maximum colour index that may be encountered in the metafile return(new MaximumColorIndex(reader.ReadColorIndex())); }
private static Command ReadUnsupportedElement(MetafileReader reader, CommandHeader commandHeader) { // no need to seek here anymore; the whole unsupported element has been read into the temporary buffer already anyways return(new UnsupportedCommand(commandHeader.ElementClass, commandHeader.ElementId)); }
public static AuxiliaryColor AuxiliaryColor(MetafileReader reader, CommandHeader commandHeader) { // P1: (colour) auxiliary colour return(new AuxiliaryColor(reader.ReadColor())); }
public static BackgroundColor BackgroundColor(MetafileReader reader, CommandHeader header) { // P1: (direct colour) background colour. return(new BackgroundColor(reader.ReadDirectColor())); }
public static VdcIntegerPrecision VdcIntegerPrecision(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) VDC integer precision; legal values are 16, 24 or 32; the value 8 is not permitted. return(new VdcIntegerPrecision(reader.ReadInteger())); }
public static DeviceViewportSpecificationMode DeviceViewportSpecificationMode(MetafileReader reader, CommandHeader header) { // P1: (enumerated) VC specifier: valid values are // 0 fraction of drawing surface // 1 millimetres with scale factor // 2 physical device coordinates // P2: (real) metric scale factor, ignored if P1=0 or P1=2 // // This parameter is always encoded as floating point, regardless of the value of the fixed/floating flag of // REAL PRECISION. If a REAL PRECISION (floating, n, m) has preceded, then the precision used is n,m. // If a REAL PRECISION element for floating point has not preceded, then a default precision of 9,23 (32-bit // floating point) is used. int numFloatBytes = 32 / 8; if (reader.Descriptor.RealPrecision == RealPrecisionSpecification.FloatingPoint64Bit) { numFloatBytes = 64 / 8; } return(new DeviceViewportSpecificationMode(reader.ReadEnum <DeviceViewportSpecificationModeType>(), reader.ReadFloatingPoint(numFloatBytes))); }
public static RestorePrimitiveContext RestorePrimitiveContext(MetafileReader reader, CommandHeader commandHeader) { // P1: (name) context name return(new RestorePrimitiveContext(reader.ReadName())); }
public static MetafileVersion MetafileVersion(MetafileReader reader, CommandHeader commandHeader) { // P1: (integer) metafile version number: valid values are 1, 2, 3, 4 return(new MetafileVersion(reader.ReadInteger())); }
public static SegmentPickPriority SegmentPickPriority(MetafileReader reader, CommandHeader commandHeader) { // P1: (name) segment identifier // P2: (integer) segment pick priority: valid values are non-negative integers return(new SegmentPickPriority(reader.ReadName(), reader.ReadInteger())); }
public static BeginFigure BeginFigure(MetafileReader reader, CommandHeader commandHeader) { // BEGIN FIGURE: has no parameters return(new BeginFigure()); }