protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int count = reader.ReadInt32(); List<DescriptorStructure> dss = new List<DescriptorStructure>(); for (int i = 0; i < count; i++) { string s = reader.ReadAscii(4); string k = reader.ReadAscii(4); var c = reader.ReadByte(); var p = reader.ReadBytes(3); var l = reader.ReadInt32(); var p2 = reader.Position; var ds = new DescriptorStructure(reader); dss.Add(ds); reader.Position = p2 + l; } props["Items"] = dss; value = props; }
public DescriptorStructure(PsdReader reader, bool hasVersion) { if (hasVersion == true) { this.version = reader.ReadInt32(); } this.Add("Name", reader.ReadString()); this.Add("ClassID", reader.ReadKey()); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string key = reader.ReadKey(); string osType = reader.ReadType(); if (key == "EngineData") { this.Add(key.Trim(), new StructureEngineData(reader)); } else { object value = StructureReader.Read(osType, reader); this.Add(key.Trim(), value); } } }
public StructureDescriptor(PsdReader reader, bool hasVersion) { if (hasVersion == true) { this.version = reader.ReadInt32(); } ClassName = reader.ReadString(); ClassId = reader.ReadKey(); Items = new Properties(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string key = reader.ReadKey(); string osType = reader.ReadType(); if (key == "EngineData") { Items.Add(key.Trim(), new StructureEngineData(reader)); } else { StructureItem value = StructureReader.Read(osType, reader); Items.Add(key.Trim(), value); } } }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int count = reader.ReadInt32(); List <DescriptorStructure> dss = new List <DescriptorStructure>(); for (int i = 0; i < count; i++) { string s = reader.ReadAscii(4); string k = reader.ReadAscii(4); var c = reader.ReadByte(); var p = reader.ReadBytes(3); var l = reader.ReadInt32(); var p2 = reader.Position; var ds = new DescriptorStructure(reader); dss.Add(ds); reader.Position = p2 + l; } props["Items"] = dss; value = props; }
public StructureObjectArray(PsdReader reader) { int version = reader.ReadInt32(); this.Add("Name", reader.ReadString()); this.Add("ClassID", reader.ReadKey()); int count = reader.ReadInt32(); List <Properties> items = new List <Properties>(); for (int i = 0; i < count; i++) { Properties props = new Properties(); props.Add("Type1", reader.ReadKey()); props.Add("EnumName", reader.ReadType()); props.Add("Type2", PsdUtility.ToUnitType(reader.ReadType())); int d4 = reader.ReadInt32(); props.Add("Values", reader.ReadDoubles(d4)); items.Add(props); } this.Add("items", items.ToArray()); }
protected override void ReadValue(PsdReader reader, object userData, out LayerRecords value) { LayerRecords records = new LayerRecords(); records.Top = reader.ReadInt32(); records.Left = reader.ReadInt32(); records.Bottom = reader.ReadInt32(); records.Right = reader.ReadInt32(); records.ValidateSize(); int channelCount = reader.ReadUInt16(); records.ChannelCount = channelCount; for (int i = 0; i < channelCount; i++) { records.Channels[i].Type = reader.ReadChannelType(); records.Channels[i].Size = reader.ReadLength(); records.Channels[i].Width = records.Width; records.Channels[i].Height = records.Height; } reader.ValidateSignature(); records.BlendMode = reader.ReadBlendMode(); records.Opacity = reader.ReadByte(); records.Clipping = reader.ReadBoolean(); records.Flags = reader.ReadLayerFlags(); records.Filter = reader.ReadByte(); value = records; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int version = reader.ReadInt32(); if (version != 1) throw new InvalidFormatException(); props["HorizontalGrid"] = reader.ReadInt32(); props["VerticalGrid"] = reader.ReadInt32(); int guideCount = reader.ReadInt32(); List<int> hg = new List<int>(); List<int> vg = new List<int>(); for (int i = 0; i < guideCount; i++) { int n = reader.ReadInt32(); byte t = reader.ReadByte(); if (t == 0) vg.Add(n); else hg.Add(n); } props["HorizontalGuides"] = hg.ToArray(); props["VerticalGuides"] = vg.ToArray(); value = props; }
protected override void ReadData(PsdReader reader, object userData) { version = reader.ReadInt32(); hasCompatibilityImage = reader.ReadBoolean(); writerName = reader.ReadString(); readerName = reader.ReadString(); fileVersion = reader.ReadInt32(); }
protected override void ReadData(PsdReader reader, object userData) { Properties props = new Properties(6); props["HorizontalRes"] = reader.ReadInt16(); props["HorizontalResUnit"] = reader.ReadInt32(); props["WidthUnit"] = reader.ReadInt16(); props["VerticalRes"] = reader.ReadInt16(); props["VerticalResUnit"] = reader.ReadInt32(); props["HeightUnit"] = reader.ReadInt16(); }
protected override void ReadValue(PsdReader reader, Object userData, out IProperties value) { Properties props = new Properties(5); props["Version"] = reader.ReadInt32(); props["HasCompatibilityImage"] = reader.ReadBoolean(); props["WriterName"] = reader.ReadString(); props["ReaderName"] = reader.ReadString(); props["FileVersion"] = reader.ReadInt32(); value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(5); props["Version"] = reader.ReadInt32(); props["HasCompatibilityImage"] = reader.ReadBoolean(); props["WriterName"] = reader.ReadString(); props["ReaderName"] = reader.ReadString(); props["FileVersion"] = reader.ReadInt32(); value = props; }
protected override void ReadValue(PsdReader reader, Object userData, out IProperties value) { Properties props = new Properties(6); props["HorizontalRes"] = reader.ReadInt16(); props["HorizontalResUnit"] = reader.ReadInt32(); props["WidthUnit"] = reader.ReadInt16(); props["VerticalRes"] = reader.ReadInt16(); props["VerticalResUnit"] = reader.ReadInt32(); props["HeightUnit"] = reader.ReadInt16(); value = props; }
public override void ReadValue(PsdReader reader, object userData, out LayerMask value) { LayerMask mask = new LayerMask(); mask.Top = reader.ReadInt32(); mask.Left = reader.ReadInt32(); mask.Bottom = reader.ReadInt32(); mask.Right = reader.ReadInt32(); mask.Color = reader.ReadByte(); mask.Flag = reader.ReadByte(); value = mask; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(6); props["HorizontalRes"] = reader.ReadInt16(); props["HorizontalResUnit"] = reader.ReadInt32(); props["WidthUnit"] = reader.ReadInt16(); props["VerticalRes"] = reader.ReadInt16(); props["VerticalResUnit"] = reader.ReadInt32(); props["HeightUnit"] = reader.ReadInt16(); value = props; }
protected override void ReadData(PsdReader reader, object userData) { reader.ValidateType("plcL", "LayerResource PlLd"); var Version = reader.ReadInt32(); var UniqueID = reader.ReadPascalString(1); var PageNumbers = reader.ReadInt32(); var Pages = reader.ReadInt32(); var AntiAlias = reader.ReadInt32(); var LayerType = reader.ReadInt32(); Transformation = reader.ReadDoubles(8); reader.ValidateInt32(0, "WarpVersion"); var Warp = new StructureDescriptor(reader); }
protected override void ReadValue(PsdReader reader, object userData, out FileHeaderSection value) { value = new FileHeaderSection(); value.NumberOfChannels = reader.ReadInt16(); value.Height = reader.ReadInt32(); value.Width = reader.ReadInt32(); value.Depth = reader.ReadInt16(); value.ColorMode = reader.ReadColorMode(); if (value.Depth != 8) { throw new NotSupportedException("only support 8 Bit Channel"); } }
protected override void ReadValue(PsdReader reader, Object userData, out IProperties value) { value = new Properties(); Int16 version = reader.ReadInt16(); Int32 count = reader.ReadInt16(); for (Int32 i = 0; i < count; i++) { String _8bim = reader.ReadAscii(4); String effectType = reader.ReadAscii(4); Int32 size = reader.ReadInt32(); Int64 p = reader.Position; switch (effectType) { case "dsdw": { //ShadowInfo.Parse(reader); } break; case "sofi": { //this.solidFillInfo = SolidFillInfo.Parse(reader); } break; } reader.Position = p + size; } }
public override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); props["ID"] = reader.ReadInt32(); value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { value = new Properties(); short version = reader.ReadInt16(); int count = reader.ReadInt16(); for (int i = 0; i < count; i++) { string _8bim = reader.ReadAscii(4); string effectType = reader.ReadAscii(4); int size = reader.ReadInt32(); long p = reader.Position; switch (effectType) { case "dsdw": { //ShadowInfo.Parse(reader); } break; case "sofi": { //this.solidFillInfo = SolidFillInfo.Parse(reader); } break; } reader.Position = p + size; } }
protected override void ReadData(PsdReader reader, object userData) { short version = reader.ReadInt16(); int count = reader.ReadInt16(); for (int i = 0; i < count; i++) { string _8bim = reader.ReadAscii(4); string effectType = reader.ReadAscii(4); int size = reader.ReadInt32(); long p = reader.Position; switch (effectType) { case "dsdw": { //ShadowInfo.Parse(reader); } break; case "sofi": { //this.solidFillInfo = SolidFillInfo.Parse(reader); } break; } reader.Position = p + size; } }
protected override void ReadValue(PsdReader reader, object userData, out LinkedLayer value) { reader.ValidateSignature("liFD"); int version = reader.ReadInt32(); Guid id = new Guid(reader.ReadPascalString(1)); string name = reader.ReadString(); string type = reader.ReadType(); string creator = reader.ReadType(); long length = reader.ReadInt64(); IProperties properties = reader.ReadBoolean() == true ? new DescriptorStructure(reader) : null; bool isDocument = this.IsDocument(reader); LinkedDocumentReader documentReader = null; LinkedDocumnetFileHeaderReader fileHeaderReader = null; if (length > 0 && isDocument == true) { long position = reader.Position; documentReader = new LinkedDocumentReader(reader, length); reader.Position = position; fileHeaderReader = new LinkedDocumnetFileHeaderReader(reader, length); } value = new LinkedLayer(name, id, documentReader, fileHeaderReader); }
public StructureEngineData(PsdReader reader) { int length = reader.ReadInt32(); reader.Skip('\n', 2); this.ReadProperties(reader, 0, this); }
protected override void ReadValue(PsdReader reader, Object userData, out IProperties value) { Properties props = new Properties(); props["SectionType"] = (SectionType)reader.ReadInt32(); value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); props["Version"] = reader.ReadInt32(); value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); reader.ValidateType("plcL", "LayerResource PlLd"); props["Version"] = reader.ReadInt32(); props["UniqueID"] = reader.ReadPascalString(1); props["PageNumbers"] = reader.ReadInt32(); props["Pages"] = reader.ReadInt32(); props["AntiAlias"] = reader.ReadInt32(); props["LayerType"] = reader.ReadInt32(); props["Transformation"] = reader.ReadDoubles(8); reader.ValidateInt32(0, "WarpVersion"); props["Warp"] = new DescriptorStructure(reader); value = props; }
public StructureList(PsdReader reader) { Items = new List <StructureItem>(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string type = reader.ReadType(); StructureItem value = StructureReader.Read(type, reader); Items.Add(value); } }
protected override void ReadData(PsdReader reader, object userData) { int count = reader.ReadInt32(); List <StructureDescriptor> dss = new List <StructureDescriptor>(); for (int i = 0; i < count; i++) { string s = reader.ReadAscii(4); string k = reader.ReadAscii(4); var c = reader.ReadByte(); var p = reader.ReadBytes(3); var l = reader.ReadInt32(); var p2 = reader.Position; var ds = new StructureDescriptor(reader); dss.Add(ds); reader.Position = p2 + l; } //props["Items"] = dss; }
public BaseStructure(PsdReader reader) { List<object> items = new List<object>(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string type = reader.ReadType(); object value = StructureReader.Read(type, reader); items.Add(value); } this.Add("Items", items.ToArray()); }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int version = reader.ReadInt32(); if (version == 6) { var r1 = reader.ReadInt32(); var r2 = reader.ReadInt32(); var r3 = reader.ReadInt32(); var r4 = reader.ReadInt32(); string text = reader.ReadString(); var count = reader.ReadInt32(); List<IProperties> slices = new List<IProperties>(count); for (int i = 0; i < count; i++) { slices.Add(ReadSliceInfo(reader)); } } { var descriptor = new DescriptorStructure(reader) as IProperties; var items = descriptor["slices.Items[0]"] as object[]; List<IProperties> slices = new List<IProperties>(items.Length); foreach (var item in items) { slices.Add(ReadSliceInfo(item as IProperties)); } props["Items"] = slices.ToArray(); } value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int version = reader.ReadInt32(); if (version == 6) { var r1 = reader.ReadInt32(); var r2 = reader.ReadInt32(); var r3 = reader.ReadInt32(); var r4 = reader.ReadInt32(); string text = reader.ReadString(); var count = reader.ReadInt32(); List <IProperties> slices = new List <IProperties>(count); for (int i = 0; i < count; i++) { slices.Add(ReadSliceInfo(reader)); } } { var descriptor = new DescriptorStructure(reader) as IProperties; var items = descriptor["slices.Items[0]"] as object[]; List <IProperties> slices = new List <IProperties>(items.Length); foreach (var item in items) { slices.Add(ReadSliceInfo(item as IProperties)); } props["Items"] = slices.ToArray(); } value = props; }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); int version = reader.ReadInt32(); if (version != 1) { throw new InvalidFormatException(); } props["HorizontalGrid"] = reader.ReadInt32(); props["VerticalGrid"] = reader.ReadInt32(); int guideCount = reader.ReadInt32(); List <int> hg = new List <int>(); List <int> vg = new List <int>(); for (int i = 0; i < guideCount; i++) { int n = reader.ReadInt32(); byte t = reader.ReadByte(); if (t == 0) { vg.Add(n); } else { hg.Add(n); } } props["HorizontalGuides"] = hg.ToArray(); props["VerticalGuides"] = vg.ToArray(); value = props; }
public BaseStructure(PsdReader reader) { List <object> items = new List <object>(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string type = reader.ReadType(); object value = StructureReader.Read(type, reader); items.Add(value); } this.Add("Items", items.ToArray()); }
private long ReadLength(PsdReader reader, string resourceID) { long length = 0; if (doubleTypeKeys.Contains(resourceID) && reader.Version == 2) { length = reader.ReadInt64(); } else { length = reader.ReadInt32(); } return (length + 3) & (~3); }
private static Properties ReadSliceInfo(PsdReader reader) { Properties props = new Properties(); props["ID"] = reader.ReadInt32(); props["GroupID"] = reader.ReadInt32(); int origin = reader.ReadInt32(); if (origin == 1) { int asso = reader.ReadInt32(); } props["Name"] = reader.ReadString(); int type = reader.ReadInt32(); props["Left"] = reader.ReadInt32(); props["Top"] = reader.ReadInt32(); props["Right"] = reader.ReadInt32(); props["Bottom"] = reader.ReadInt32(); props["Url"] = reader.ReadString(); props["Target"] = reader.ReadString(); props["Message"] = reader.ReadString(); props["AltTag"] = reader.ReadString(); bool b = reader.ReadBoolean(); string cellText = reader.ReadString(); props["HorzAlign"] = reader.ReadInt32(); props["VertAlign"] = reader.ReadInt32(); props["Alpha"] = reader.ReadByte(); props["Red"] = reader.ReadByte(); props["Green"] = reader.ReadByte(); props["Blue"] = reader.ReadByte(); return props; }
public StructureObjectArray(PsdReader reader) { int version = reader.ReadInt32(); this.Add("Name", reader.ReadString()); this.Add("ClassID", reader.ReadKey()); int count = reader.ReadInt32(); List<Properties> items = new List<Properties>(); for (int i = 0; i < count; i++) { Properties props = new Properties(); props.Add("Type1", reader.ReadKey()); props.Add("EnumName", reader.ReadType()); props.Add("Type2", PsdUtility.ToUnitType(reader.ReadType())); int d4 = reader.ReadInt32(); props.Add("Values", reader.ReadDoubles(d4)); items.Add(props); } this.Add("items", items.ToArray()); }
private long ReadLength(PsdReader reader, string resourceID) { long length = 0; if (doubleTypeKeys.Contains(resourceID) && reader.Version == 2) { length = reader.ReadInt64(); } else { length = reader.ReadInt32(); } return((length + 3) & (~3)); }
public StructureObjectArray(PsdReader reader) { int version = reader.ReadInt32(); Name = reader.ReadString(); ClassId = reader.ReadKey(); int count = reader.ReadInt32(); Items = new List <ArrayResourceItem>(); for (int i = 0; i < count; i++) { ArrayResourceItem props = new ArrayResourceItem(); props.Type1 = reader.ReadKey(); props.EnumName = reader.ReadType(); props.Unit = PsdUtility.ToUnitType(reader.ReadType()); int d4 = reader.ReadInt32(); props.Values = reader.ReadDoubles(d4); Items.Add(props); } }
protected override void ReadData(PsdReader reader, object userData) { reader.ValidateSignature("liFE"); int version = reader.ReadInt32(); Guid id = new Guid(reader.ReadPascalString(1)); string name = reader.ReadString(); string type = reader.ReadType(); string creator = reader.ReadType(); long length = reader.ReadInt64(); IProperties properties = reader.ReadBoolean() == true ? new StructureDescriptor(reader).Items : null; Uri absoluteUri = this.ReadAboluteUri(reader); EmbeddedLayer = new EmbeddedLayer(id, reader.Resolver, absoluteUri); }
protected override void ReadValue(PsdReader reader, Object userData, out EmbeddedLayer value) { reader.ValidateSignature("liFE"); Int32 version = reader.ReadInt32(); Guid id = new Guid(reader.ReadPascalString(1)); String name = reader.ReadString(); String type = reader.ReadType(); String creator = reader.ReadType(); Int64 length = reader.ReadInt64(); IProperties properties = reader.ReadBoolean() == true ? new DescriptorStructure(reader) : null; Uri absoluteUri = this.ReadAboluteUri(reader); value = new EmbeddedLayer(id, reader.Resolver, absoluteUri); }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); while (reader.Position < this.EndPosition) { reader.ValidateSignature(); string resourceID = reader.ReadType(); long length = reader.ReadInt32(); length += length % 2; ResourceReaderBase resourceReader = ReaderCollector.CreateReader(resourceID, reader, length); string resourceName = ReaderCollector.GetDisplayName(resourceID); props[resourceName] = resourceReader; } value = props; }
protected override void ReadData(PsdReader reader, object userData) { var resources = new List <IResourceBlock>(); while (reader.Position < this.EndPosition) { reader.ValidateSignature(); string resourceID = reader.ReadType(); long length = reader.ReadInt32(); length += length % 2; var resourceReader = ReaderCollector.CreateReader(resourceID, reader, length); string resourceName = ReaderCollector.GetDisplayName(resourceID); resources.Add(resourceReader); } Resources = resources.ToArray(); }
protected override void ReadValue(PsdReader reader, object userData, out IProperties value) { Properties props = new Properties(); props["SectionType"] = (SectionType)reader.ReadInt32(); value = props; }
public void ReadHeader(PsdReader reader, CompressionType compressionType) { if (compressionType != CompressionType.RLE) return; this.rlePackLengths = new int[this.height]; if (reader.Version == 1) { for (int i = 0; i < this.height; i++) { this.rlePackLengths[i] = reader.ReadInt16(); } } else { for (int i = 0; i < this.height; i++) { this.rlePackLengths[i] = reader.ReadInt32(); } } }
protected override long OnLengthGet(PsdReader reader) { return reader.ReadInt32(); }
public StructureAlias(PsdReader reader) { int length = reader.ReadInt32(); this.Add("Alias", reader.ReadAscii(length)); }
public StructureOffset(PsdReader reader) { this.Add("Name", reader.ReadString()); this.Add("ClassID", reader.ReadKey()); this.Add("Offset", reader.ReadInt32()); }
public static object Read(string ostype, PsdReader reader) { switch (ostype) { case "obj ": return new StructureReference(reader); case "Objc": return new DescriptorStructure(reader, false); case "VlLs": return new StructureList(reader); case "doub": return reader.ReadDouble(); case "UntF": return new StructureUnitFloat(reader); case "TEXT": return reader.ReadString(); case "enum": return new StructureEnumerate(reader); case "long": return reader.ReadInt32(); case "bool": return reader.ReadBoolean(); case "GlbO": return new DescriptorStructure(reader, false); case "type": return new StructureClass(reader); case "GlbC": return new StructureClass(reader); case "alis": return new StructureAlias(reader); case "tdta": return new StructureUnknownOSType("Cannot read RawData"); case "prop": return new StructureProperty(reader); case "Clss": return new StructureClass(reader); case "Enmr": return new StructureEnumerate(reader); case "rele": return new StructureOffset(reader); case "Idnt": return new StructureUnknownOSType("Cannot read Identifier"); case "indx": return new StructureUnknownOSType("Cannot read Index"); case "name": return new StructureUnknownOSType("Cannot read Name"); case "ObAr": return new StructureObjectArray(reader); } throw new NotSupportedException(ostype); }