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;
                    }
                }
            }
Example #2
0
        public Glow(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = base.GetDataReader();

            string blendModeSignature = null;
            uint   version            = r.ReadUInt32(); //two version specifications?!?

            switch (version)
            {
            case 0:
                this.Blur = r.ReadUInt32();
                this.Data = null;
                break;

            case 2:
                this.Blur      = (uint)r.ReadUInt16();
                this.Intensity = r.ReadUInt32();
                ushort something = r.ReadUInt16();
                this.Color = r.ReadPSDColor(16, true);

                this.BlendModeKey = this.ReadBlendKey(r);
                this.Enabled      = r.ReadBoolean();
                this.Opacity      = r.ReadByte();
                //TODO!
                if (this.Inner)
                {
                    this.Unknown = r.ReadByte();
                }
                this.UnknownColor = r.ReadPSDColor(16, true);
                this.Data         = r.ReadBytes((int)r.BytesToEnd);
                break;
            }
        }
Example #3
0
        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 ColorStop(BinaryPSDReader r)
            {
                this.Location = r.ReadUInt32();
                this.Midpoint = r.ReadUInt32();
                this.ColorMode = (ColorModes)r.ReadUInt16();

                this.Channels = r.ReadPSDChannelValues(4);

                this.Unknown = r.ReadUInt16();
            }
Example #5
0
        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 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 TypeToolObject(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort Version = r.ReadUInt16(); //1= Photoshop 5.0

            this.Transform = new Matrix2D(r);

            ushort TextDescriptorVersion = r.ReadUInt16(); //=50. For Photoshop 6.0.

            if (true)
            {
                this.TxtDescriptor = new DynVal(r, true);
            }
            else
            {
                uint XTextDescriptorVersion = r.ReadUInt32(); //=16. For Photoshop 6.0.
                this.TextDescriptor = new Descriptor(r);
            }
            this.Data = r.ReadBytes((int)r.BytesToEnd);

            ////ushort WarpDescriptorVersion = r.ReadUInt16(); //=50. For Photoshop 6.0.
            ////uint XWarpDescriptorVersion = r.ReadUInt32(); //=16. For Photoshop 6.0.
            ////Descriptor warpDescriptor = new Descriptor(r);
            //this.WarpDescriptor = new DynVal(r, true);

            //this.WarpRect = ERectangleF.FromLTRB((float)r.ReadPSDDouble(), (float)r.ReadPSDDouble(), (float)r.ReadPSDDouble(), (float)r.ReadPSDDouble());
            ////this.WarpRect.Left = r.ReadPSDDouble();
            ////double warpRectTop = r.ReadPSDDouble();
            ////double warpRectRight = r.ReadPSDDouble();
            ////double warpRectBottom = r.ReadPSDDouble();

            //this.Data = null;
        }
Example #8
0
        public Bevel(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            string blendModeSignature = null;

            uint version = r.ReadUInt32();

            switch (version)
            {
            case 0:
                this.Blur = r.ReadUInt32();
                this.Data = null;
                break;

            case 2:
                this.Angle    = (uint)r.ReadUInt16();
                this.Strength = (uint)r.ReadUInt16();
                this.Blur     = (uint)r.ReadUInt16();

                this.Unknown1 = r.ReadByte();
                this.Unknown2 = r.ReadByte();
                this.Unknown3 = r.ReadUInt16();
                this.Unknown4 = r.ReadUInt16();

                this.BlendModeKey       = this.ReadBlendKey(r);
                this.ShadowBlendModeKey = this.ReadBlendKey(r);

                this.Color       = r.ReadPSDColor(16, true);
                this.ShadowColor = r.ReadPSDColor(16, true);

                this.BevelStyle    = r.ReadByte();
                this.Opacity       = r.ReadByte();
                this.ShadowOpacity = r.ReadByte();

                this.Enabled        = r.ReadBoolean();
                this.UseGlobalAngle = r.ReadBoolean();
                this.Inverted       = r.ReadBoolean();

                System.Drawing.Color someColor  = r.ReadPSDColor(16, true);
                System.Drawing.Color someColor2 = r.ReadPSDColor(16, true);
                break;
            }
            this.Data = null;
        }
Example #9
0
        public LayerId(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Id   = r.ReadUInt32();
            this.Data = null;
        }
Example #10
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());
                }
            }
Example #11
0
        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();
        }
Example #12
0
        public DocumentSpecificIds(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.StartIndex = reader.ReadUInt32();
            reader.Close();
        }
        public GridGuidesInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            uint Version = reader.ReadUInt32();

            //Future implementation of document-specific grids. Initially, set the grid cycle to every quarter inch. At 72 dpi, that would be 18 * 32 = 576 (0x240)
            this.GridCycle = reader.ReadUInt64();

            uint guideCount = reader.ReadUInt32();

            for (int i = 0; i < guideCount; i++)
            {
                GridGuide guide = new GridGuide(reader);
                this.Guides.Add(guide);
            }

            reader.Close();
        }
Example #14
0
        public CommonState(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = base.GetDataReader();

            uint   version = r.ReadUInt32(); //two version specifications?!?
            bool   visible = r.ReadBoolean();
            ushort unused  = r.ReadUInt16();

            this.Data = null;
        }
Example #15
0
        public AlphaIdentifiers(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            while (reader.BytesToEnd > 0)
            {
                this._ids.Add(reader.ReadUInt32());
            }
            reader.Close();
        }
Example #16
0
        public Curves(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            byte   unknown       = r.ReadByte();
            ushort version       = r.ReadUInt16();
            uint   definedCurves = r.ReadUInt32();

            this.Records = new List <Curve>();
            int channelNum = -1;

            while (definedCurves > 0)
            {
                if ((definedCurves & 1) > 0)
                {
                    Curve curve = new Curve(r);
                    curve.Channel = channelNum;
                    this.Records.Add(curve);
                }
                channelNum++;
                definedCurves >>= 1;
            }

            if (r.BytesToEnd > 0)
            {
                //Same again? Clear Records and begin anew? Brrr... Adobe, argh!
                string head = new string(r.ReadPSDChars(4));
                version = r.ReadUInt16(); //version??
                uint numCurves = r.ReadUInt32();

                for (int i = 0; i < numCurves; i++)
                {
                    ushort channelId = r.ReadUInt16();
                    Curve  curve     = new Curve(r);
                    curve.Channel = (int)channelId - 1;
                }
            }

            this.Data = null;
        }
Example #17
0
        public PrintFlagsInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader  = imgRes.GetDataReader();
            ushort          version = reader.ReadUInt16();

            this.CenterCrop = reader.ReadByte();
            reader.ReadByte(); //padding?
            this.BleedWidthValue = reader.ReadUInt32();
            this.BleedWidthScale = reader.ReadUInt16();

            reader.Close();
        }
Example #18
0
        public ObjectBasedEffects(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            r.ReadUInt32(); //Object version, Always 0

            this.Descriptor = new DynVal(r, true);
            //r.ReadUInt32(); //Descriptor version, 16 = PS6.0
            //string unknown = Endogine.Serialization.ReadableBinary.CreateHexEditorString(r.ReadBytes(6));
            //this.Values = DynVal.ReadValues(r);
            //Action Descriptor(s)
        }
Example #19
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;
                }
            }
Example #20
0
        public SectionDivider(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Type = r.ReadUInt32(); //0 = any other type of layer, 1 = open folder, 2 = closed folder, 3 = bounding section divider, hidden in the UI
            if (r.BytesToEnd > 0)
            {
                string header = new string(r.ReadPSDChars(4));
                this.BlendKey = new string(r.ReadPSDChars(4));
                if (this.BlendKey != "pass")
                {
                }
            }
            this.Data = null;
        }
Example #21
0
        public Shadow(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = base.GetDataReader();

            string blendModeSignature = null;

            int version = r.ReadInt32();

            switch (version)
            {
            case 0:
                this.Blur      = r.ReadUInt32();
                this.Intensity = r.ReadUInt32();

                this.Angle    = r.ReadUInt32();
                this.Distance = r.ReadUInt32();

                this.Color = r.ReadPSDColor(16, true);

                this.BlendModeKey = this.ReadBlendKey(r);
                //this.BlendModeSignature = r.ReadUInt32();
                //this.BlendModeKey = r.ReadUInt32();
                this.Enabled        = r.ReadBoolean();
                this.UseGlobalAngle = r.ReadBoolean();
                this.Opacity        = r.ReadByte();
                break;

            case 2:
                this.Blur      = (uint)r.ReadUInt16();
                this.Intensity = r.ReadUInt32();

                this.Angle    = r.ReadUInt32();
                this.Distance = r.ReadUInt32();

                ushort something = r.ReadUInt16();    //TODO:?

                this.Color = r.ReadPSDColor(16, true);

                this.BlendModeKey   = this.ReadBlendKey(r);
                this.Enabled        = r.ReadBoolean();
                this.UseGlobalAngle = r.ReadBoolean();
                this.Opacity        = r.ReadByte();
                //TODO: 10 unknown bytes!
                break;
            }

            this.Data = null;
        }
Example #22
0
            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!
            }
Example #23
0
        public TypeTool(BinaryPSDReader areader)
            : base(areader)
        {
            BinaryPSDReader reader  = this.GetDataReader();
            ushort          Version = reader.ReadUInt16(); //1= Photoshop 5.0

            for (int i = 0; i < 6; i++)                    //2D transform matrix
            {
                reader.ReadPSDDouble();
            }


            //Font info:
            ushort FontVersion = reader.ReadUInt16(); //6 = Photoshop 5.0
            ushort FaceCount   = reader.ReadUInt16();

            this.FontInfos = new List <FontInfo>();
            for (int i = 0; i < FaceCount; i++)
            {
                this.FontInfos.Add(new FontInfo(reader));
            }

            //TODO: make classes of styles as well...
            ushort StyleCount = reader.ReadUInt16();

            for (int i = 0; i < StyleCount; i++)
            {
                ushort Mark      = reader.ReadUInt16();
                ushort FaceMark  = reader.ReadUInt16();
                uint   Size      = reader.ReadUInt32();
                uint   Tracking  = reader.ReadUInt32();
                uint   Kerning   = reader.ReadUInt32();
                uint   Leading   = reader.ReadUInt32();
                uint   BaseShift = reader.ReadUInt32();

                byte AutoKern = reader.ReadByte();
                byte Extra    = 0;
                if (Version <= 5)
                {
                    Extra = reader.ReadByte();
                }
                byte Rotate = reader.ReadByte();
            }

            //Text information
            ushort Type           = reader.ReadUInt16();
            uint   ScalingFactor  = reader.ReadUInt32();
            uint   CharacterCount = reader.ReadUInt32();

            uint HorizontalPlacement = reader.ReadUInt32();
            uint VerticalPlacement   = reader.ReadUInt32();

            uint SelectStart = reader.ReadUInt32();
            uint SelectEnd   = reader.ReadUInt32();

            ushort LineCount = reader.ReadUInt16();

            for (int i = 0; i < LineCount; i++)
            {
                uint   CharacterCountLine = reader.ReadUInt32();
                ushort Orientation        = reader.ReadUInt16();
                ushort Alignment          = reader.ReadUInt16();

                ushort DoubleByteChar = reader.ReadUInt16();
                ushort Style          = reader.ReadUInt16();
            }

            ushort ColorSpace = reader.ReadUInt16();

            for (int i = 0; i < 4; i++)
            {
                reader.ReadUInt16(); //Color compensation
            }
            byte AntiAlias = reader.ReadByte();
        }
 public TransparencyStop(BinaryPSDReader r)
 {
     this.Location = r.ReadUInt32();
     this.Midpoint = r.ReadUInt32();
     this.Opacity = r.ReadUInt16();
 }
Example #25
0
            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;
                }
            }
Example #26
0
            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 GridGuide(BinaryPSDReader reader)
 {
     this.Location     = reader.ReadUInt32();
     this.IsHorizontal = reader.ReadBoolean();
 }
Example #28
0
 public GridGuide(BinaryPSDReader reader)
 {
     this.Location = reader.ReadUInt32();
     this.IsHorizontal = reader.ReadBoolean();
 }
Example #29
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;
            }