Exemple #1
0
            public FontInfo(BinaryPSDReader r)
            {
                this.Mark           = r.ReadUInt16();
                this.FontType       = r.ReadUInt32();
                this.FontName       = r.ReadPascalString();
                this.FontFamilyName = r.ReadPascalString();
                this.FontStyleName  = r.ReadPascalString();
                this.Script         = r.ReadUInt16();

                ushort NumDesignAxesVectors = r.ReadUInt16();

                this.DesignVectors = new List <uint>();
                for (int vectorNum = 0; vectorNum < NumDesignAxesVectors; vectorNum++)
                {
                    this.DesignVectors.Add(r.ReadUInt32());
                }
            }
Exemple #2
0
            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 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;
            }