public VersionInfo(ImageResource imgRes) : base(imgRes) { BinaryPSDReader reader = imgRes.GetDataReader(); this.Version = reader.ReadUInt32(); this.HasRealMergedData = reader.ReadBoolean(); this.WriterName = reader.ReadPSDUnicodeString(); this.ReaderName = reader.ReadPSDUnicodeString(); this.FileVersion = reader.ReadUInt32(); reader.Close(); }
public Descriptor(BinaryPSDReader r) { uint version = r.ReadUInt32(); //? r.BaseStream.Position += 6; //? string type = new string(r.ReadPSDChars(4)); uint unknown1 = r.ReadUInt32(); //? uint unknown2 = r.ReadUInt32(); //? string resType1 = new string(r.ReadPSDChars(4)); string resType2 = new string(r.ReadPSDChars(4)); string uniName = r.ReadPSDUnicodeString(); while (r.ReadByte() != 0x2f) { ; } this.Items = new List <Item>(); while (true) { Item item = new Item(); this.Items.Add(item); if (item.Read(r) == false) { break; } } }
public Slices(ImageResource imgRes) : base(imgRes) { BinaryPSDReader reader = imgRes.GetDataReader(); this.Version = reader.ReadUInt32(); this.Rectangle = reader.ReadPSDRectangle(); // new Rectangle(reader).ToERectangle(); this.SlicesName = reader.ReadPSDUnicodeString(); int cnt = (int)reader.ReadUInt32(); this.SliceList = new List <Slice>(); for (int i = 0; i < cnt; i++) { this.SliceList.Add(new Slice(reader)); } int unknown1 = (int)reader.ReadUInt32(); int unknown2 = (int)reader.ReadUInt32(); ushort unknown3 = reader.ReadUInt16(); string unknown4 = DynVal.ReadSpecialString(reader); int unknown5 = (int)reader.ReadUInt32(); this.Values = new List <DynVal>(); while (reader.BytesToEnd > 0) { DynVal val = DynVal.ReadValue(reader, false); this.Values.Add(val); } //this.Values = DynVal.ReadValues(reader); //this.Data = reader.ReadBytes((int)reader.BytesToEnd); reader.Close(); }
public UnicodeName(BinaryPSDReader reader) : base(reader) { BinaryPSDReader r = this.GetDataReader(); this.Name = r.ReadPSDUnicodeString(); //uint nUnicodeLength = r.ReadUInt32(); //this.Name = new string(r.ReadPSDChars((int)nUnicodeLength * 2)); this.Data = null; }
public GradientMap(BinaryPSDReader reader) : base(reader) { BinaryPSDReader r = this.GetDataReader(); ushort version = r.ReadUInt16(); this.Reverse = r.ReadBoolean(); this.Dither = r.ReadBoolean(); this.Name = r.ReadPSDUnicodeString(); r.JumpToEvenNthByte(2); ushort cnt = r.ReadUInt16(); this.ColorStops = new List <ColorStop>(); for (int i = 0; i < cnt; i++) { this.ColorStops.Add(new ColorStop(r)); } cnt = r.ReadUInt16(); this.TransparencyStops = new List <TransparencyStop>(); for (int i = 0; i < cnt; i++) { this.TransparencyStops.Add(new TransparencyStop(r)); } ushort expansionCount = r.ReadUInt16(); if (expansionCount > 0) { this.Interpolation = r.ReadInt16(); } ushort length = r.ReadUInt16(); this.Mode = r.ReadUInt16(); this.RandomSeed = r.ReadUInt32(); r.BaseStream.Position += 1; this.ShowTransparency = r.ReadBoolean(); r.BaseStream.Position += 1; this.UseVectorColor = r.ReadBoolean(); this.Roughness = r.ReadUInt32(); this.ColorModel = r.ReadUInt16(); //ColorMode?! this.MinChannelValues = r.ReadPSDChannelValues(4); this.MaxChannelValues = r.ReadPSDChannelValues(4); this.Data = r.ReadBytes((int)r.BytesToEnd); }
public UnicodeAlphaNames(ImageResource imgRes) : base(imgRes) { BinaryPSDReader reader = imgRes.GetDataReader(); while (reader.BytesToEnd > 0) { string name = reader.ReadPSDUnicodeString(); if (name.Length > 0) { this._names.Add(name); } } reader.Close(); }
public URLList(ImageResource imgRes) : base(imgRes) { BinaryPSDReader reader = imgRes.GetDataReader(); int numUrls = reader.ReadInt32(); this.URLs = new List <URLEntry>(); for (int i = 0; i < numUrls; i++) { reader.ReadUInt32(); //padding?? uint id = reader.ReadUInt32(); string url = reader.ReadPSDUnicodeString(); this.URLs.Add(new URLEntry(id, url)); this.URLsx.Add(url); } reader.Close(); }
public Pattern(BinaryPSDReader r) { long startPos = r.BaseStream.Position; uint length = r.ReadUInt32(); uint version = r.ReadUInt32(); this.ColorMode = (ColorModes)r.ReadUInt32(); this.Loc = new EPoint(r.ReadUInt16(), r.ReadUInt16()); //TODO: signed?? this.Name = r.ReadPSDUnicodeString(); this.Id = r.ReadPascalString(); //? if (this.ColorMode == ColorModes.Indexed) { this.PaletteForXml = ""; for (int i = 0; i < 256; i++) { string s = ""; for (int j = 0; j < 3; j++) { s += r.ReadByte().ToString("X"); } this.PaletteForXml += s; } } byte[] imageData = r.ReadBytes((int)(length - (int)r.BaseStream.Position - startPos)); //TODO: what is the format? //System.IO.MemoryStream stream = new System.IO.MemoryStream(imageData); //System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(stream); //this.ImageData = Endogine.Serialization.ReadableBinary.CreateHexEditorString(imageData); //TODO: length isn't correct! By 6 bytes always?? if (r.BytesToEnd < 20) { r.BaseStream.Position = r.BaseStream.Length; } }
public Slice(BinaryPSDReader reader) { this.ID = reader.ReadUInt32(); this.GroupID = reader.ReadUInt32(); this.Origin = reader.ReadUInt32(); this.Name = reader.ReadPSDUnicodeString(); this.Type = reader.ReadUInt32(); this.Rectangle = reader.ReadPSDRectangleReversed(); //new Rectangle(reader).ToERectangle(); this.URL = reader.ReadPSDUnicodeString(); this.Target = reader.ReadPSDUnicodeString(); this.Message = reader.ReadPSDUnicodeString(); this.AltTag = reader.ReadPSDUnicodeString(); this.CellTextIsHtml = reader.ReadBoolean(); this.CellText = reader.ReadPSDUnicodeString(); this.HorizontalAlignment = reader.ReadUInt32(); this.VerticalAlignment = reader.ReadUInt32(); this.Color = reader.ReadPSDColor(8, true); //TODO: same info seems to follow in another format! }
public Descriptor(BinaryPSDReader r) { uint version = r.ReadUInt32(); //? r.BaseStream.Position += 6; //? string type = new string(r.ReadPSDChars(4)); uint unknown1 = r.ReadUInt32(); //? uint unknown2 = r.ReadUInt32(); //? string resType1 = new string(r.ReadPSDChars(4)); string resType2 = new string(r.ReadPSDChars(4)); string uniName = r.ReadPSDUnicodeString(); while (r.ReadByte() != 0x2f) ; this.Items = new List<Item>(); while (true) { Item item = new Item(); this.Items.Add(item); if (item.Read(r) == false) break; } }
public Pattern(BinaryPSDReader r) { long startPos = r.BaseStream.Position; uint length = r.ReadUInt32(); uint version = r.ReadUInt32(); this.ColorMode = (ColorModes)r.ReadUInt32(); this.Loc = new EPoint(r.ReadUInt16(), r.ReadUInt16()); //TODO: signed?? this.Name = r.ReadPSDUnicodeString(); this.Id = r.ReadPascalString(); //? if (this.ColorMode == ColorModes.Indexed) { this.PaletteForXml = ""; for (int i = 0; i < 256; i++) { string s = ""; for (int j = 0; j < 3; j++) s += r.ReadByte().ToString("X"); this.PaletteForXml += s; } } byte[] imageData = r.ReadBytes((int)(length - (int)r.BaseStream.Position - startPos)); //TODO: what is the format? //System.IO.MemoryStream stream = new System.IO.MemoryStream(imageData); //System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(stream); //this.ImageData = Endogine.Serialization.ReadableBinary.CreateHexEditorString(imageData); //TODO: length isn't correct! By 6 bytes always?? if (r.BytesToEnd < 20) r.BaseStream.Position = r.BaseStream.Length; }