public IPTC_NAA(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            reader.ReadByte();
            reader.ReadUInt16();
            reader.ReadUInt16();
            reader.ReadUInt16();

            this.Entries = new List <IPTCEntry>();
            while (reader.BytesToEnd > 0)
            {
                byte starter = reader.ReadByte();
                if (starter != 0x1c)
                {
                    throw new Exception("IPTC error");
                }

                IPTCEntry entry = new IPTCEntry();
                entry.Id = (TypeId)reader.ReadUInt16();
                reader.ReadByte();
                entry.Name = reader.ReadPascalStringUnpadded();
                this.Entries.Add(entry);
            }

            reader.Close();
        }
Exemple #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;
            }
        }
        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;
        }
        public Thumbnail(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            //m_bThumbnailFilled = true;

            this.Format         = reader.ReadInt32();
            this.Width          = reader.ReadInt32();
            this.Height         = reader.ReadInt32();
            this.WidthBytes     = reader.ReadInt32(); //padded row bytes (
            this.Size           = reader.ReadInt32(); //Total size widthbytes * height * planes
            this.CompressedSize = reader.ReadInt32(); //used for consistancy check
            this.BitPerPixel    = reader.ReadInt16();
            this.Planes         = reader.ReadInt16();

            int numBytes = (int)reader.BytesToEnd;

            byte[] buffer = reader.ReadBytes(numBytes);

            if (this.ID == 1033)
            {
                // BGR
                for (int n = 0; n < numBytes - 2; n += 3)
                {
                    byte tmp = buffer[n + 2];
                    buffer[n + 2] = buffer[n];
                    buffer[n]     = tmp;
                }
            }
            System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
            this.Bitmap = new System.Drawing.Bitmap(stream);

            reader.Close();
        }
 public BlendClipping(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     this.Value = r.ReadBoolean();
     this.Data = null;
 }
 public CorrectionRecord(BinaryPSDReader r)
 {
     this.Cyan = r.ReadInt16();
     this.Magenta = r.ReadInt16();
     this.Yellow = r.ReadInt16();
     this.Black = r.ReadInt16();
 }
Exemple #7
0
        public Levels(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort version = r.ReadUInt16();

            this.Records = new List <LevelRecord>();
            int endPos = (int)Math.Min(r.BytesToEnd, 292);

            while (r.BaseStream.Position < endPos)
            {
                this.Records.Add(new LevelRecord(r));
            }

            if (r.BytesToEnd > 0)
            {
                string head     = new string(r.ReadPSDChars(4));
                ushort unknown1 = r.ReadUInt16();
                ushort unknown2 = r.ReadUInt16();
                while (r.BytesToEnd > 0)
                {
                    this.Records.Add(new LevelRecord(r));
                }
            }
            this.Data = null;
        }
Exemple #8
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 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;
                    }
                }
            }
Exemple #10
0
        public Txt2(BinaryPSDReader reader)
            : base(reader)
        {
            bool readData = false; //Set to true to see it in all its... glory.

            if (readData)
            {
                BinaryPSDReader r = this.GetDataReader();
                r.BaseStream.Position += 2;
                this.Values            = new DynVal();
                this.Values.Children   = new List <DynVal>();
                while (true)
                {
                    DynVal child = new DynVal();
                    this.Values.Children.Add(child);
                    try
                    {
                        if (child.ReadTdtaItem(r) == false)
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            this.Data = null;
        }
        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;
        }
        public ChannelMixer(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort version = r.ReadUInt16();
            r.BaseStream.Position += 1;
            this.Monochrome = r.ReadBoolean();
            //TODO: probably dependent on document.Channels
            this.Records = new List<MixerRecord>();
            int numChannels = 3;
            if (this.Monochrome)
                this.Records.Add(new MixerRecord(r, numChannels));
            else
            {
                for (int i = 0; i < numChannels; i++)
                    this.Records.Add(new MixerRecord(r, numChannels));
            }

            //Hmm, doesn't make sense... Why keep Monochrome if it isn't used..?
            if (r.BytesToEnd > 0 && !this.Monochrome)
                this.Records.Add(new MixerRecord(r, numChannels));

            this.Data = null;
        }
                public bool Read(BinaryPSDReader r)
                {
                    this.ID = "";
                    while (true)
                    {
                        char c = r.ReadChar();
                        if (c == 0x0a)
                        {
                            break;
                        }
                        this.ID += c;
                    }
                    byte[] buffer     = new byte[255];
                    int    bufPos     = 0;
                    int    nearEndCnt = 0;

                    while (true)
                    {
                        byte b = r.ReadByte();
                        buffer[bufPos++] = b;
                        if (b == 0x2f)
                        {
                            break;
                        }
                        if (b <= 0x00)
                        {
                            nearEndCnt++;
                            if (nearEndCnt == 12)
                            {
                                break;
                            }
                        }
                        else
                        {
                            nearEndCnt = 0;
                        }
                    }

                    if (this.ID.Contains(" "))
                    {
                        int index = this.ID.IndexOf(" ");
                        this.Value = this.ID.Substring(index + 1);
                        this.ID    = this.ID.Remove(index);
                    }

                    int endPos = bufPos - nearEndCnt - 1;

                    //See if it's only 0x09's:
                    for (int i = 0; i < endPos; i++)
                    {
                        if (buffer[i] != 0x09)
                        {
                            this.Data = Endogine.Serialization.ReadableBinary.CreateHexEditorString(buffer, 0, endPos);
                            break;
                        }
                    }

                    return(nearEndCnt == 0);
                }
Exemple #14
0
        public GlobalAngle(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Value = reader.ReadInt32();
            reader.Close();
        }
Exemple #15
0
        public LayerStateInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.TargetLayerIndex = reader.ReadUInt16();
            reader.Close();
        }
Exemple #16
0
 public RangeSettings(BinaryPSDReader r)
 {
     this.Values = new List <short>();
     for (int i = 0; i < 3; i++)
     {
         this.Values.Add(r.ReadInt16());
     }
 }
Exemple #17
0
 public LevelRecord(BinaryPSDReader r)
 {
     this.InputFloor    = r.ReadUInt16();
     this.InputCeiling  = r.ReadUInt16();
     this.OutputFloor   = r.ReadUInt16();
     this.OutputCeiling = r.ReadUInt16();
     this.Gamma         = r.ReadUInt16();
 }
Exemple #18
0
        public CopyrightInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Value = reader.ReadByte() == 0 ? false : true;
            reader.Close();
        }
Exemple #19
0
        public URL(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Value = new string(reader.ReadChars((int)reader.BytesToEnd));
            reader.Close();
        }
Exemple #20
0
        public DocumentSpecificIds(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.StartIndex = reader.ReadUInt32();
            reader.Close();
        }
Exemple #21
0
        public BlendElements(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadBoolean();
            this.Data  = null;
        }
Exemple #22
0
        public LayerNameSource(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            Name      = new string(r.ReadPSDChars((int)r.BytesToEnd));
            this.Data = null;
        }
Exemple #23
0
        public Knockout(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadBoolean();
            this.Data  = null;
        }
Exemple #24
0
        public LayerId(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Id   = r.ReadUInt32();
            this.Data = null;
        }
            public MixerRecord(BinaryPSDReader r, int numChannels)
            {
                this.Channels = new List<short>();
                for (int i = 0; i < numChannels; i++)
                    this.Channels.Add(r.ReadInt16());

                this.Unknown = r.ReadInt16();
                this.Constant = r.ReadInt16();
            }
Exemple #26
0
        public Protected(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            Unknown = r.ReadBytes((int)r.BytesToEnd);
            //this.Settings = r.ReadBoolean(); //4); //nLength?
            this.Data = null;
        }
 public Matrix2D(BinaryPSDReader r)
 {
     this.M11 = r.ReadPSDDouble();
     this.M12 = r.ReadPSDDouble();
     this.M13 = r.ReadPSDDouble();
     this.M21 = r.ReadPSDDouble();
     this.M22 = r.ReadPSDDouble();
     this.M23 = r.ReadPSDDouble();
 }
        public PatternFill(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Descriptor = new DynVal(r, true);

            this.Data = null;
        }
        public Posterize(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadUInt16();
            //TODO: two bytes left---
            this.Data = null;
        }
 public Screen(BinaryPSDReader reader)
 {
     this.FrequenceValue         = reader.ReadSingle(); //TODO: fixed single
     this.FrequenceScale         = reader.ReadUInt16();
     this.Angle                  = reader.ReadSingle(); //TODO: fixed single
     this.ShapeCode              = reader.ReadInt16();
     reader.BaseStream.Position += 4;
     this.AccurateScreens        = reader.ReadBoolean();
     this.DefaultScreens         = reader.ReadBoolean();
 }
Exemple #31
0
        public ReferencePoint(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Point   = new EPointF();
            this.Point.X = (float)r.ReadPSDDouble();
            this.Point.Y = (float)r.ReadPSDDouble();
            this.Data    = null;
        }
Exemple #32
0
        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;
        }
Exemple #33
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;
        }
Exemple #34
0
        public Levels(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort version = r.ReadUInt16();
            this.Records = new List<LevelRecord>();
            int endPos = (int)Math.Min(r.BytesToEnd, 292);
            while (r.BaseStream.Position < endPos)
                this.Records.Add(new LevelRecord(r));

            if (r.BytesToEnd > 0)
            {
                string head = new string(r.ReadPSDChars(4));
                ushort unknown1 = r.ReadUInt16();
                ushort unknown2 = r.ReadUInt16();
                while (r.BytesToEnd > 0)
                    this.Records.Add(new LevelRecord(r));
            }
            this.Data = null;
        }
Exemple #35
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;
        }
Exemple #36
0
 public LevelRecord(BinaryPSDReader r)
 {
     this.InputFloor = r.ReadUInt16();
     this.InputCeiling = r.ReadUInt16();
     this.OutputFloor = r.ReadUInt16();
     this.OutputCeiling = r.ReadUInt16();
     this.Gamma = r.ReadUInt16();
 }
Exemple #37
0
        public Txt2(BinaryPSDReader reader)
            : base(reader)
        {
            bool readData = false; //Set to true to see it in all its... glory.
            if (readData)
            {
                BinaryPSDReader r = this.GetDataReader();
                r.BaseStream.Position += 2;
                this.Values = new DynVal();
                this.Values.Children = new List<DynVal>();
                while (true)
                {
                    DynVal child = new DynVal();
                    this.Values.Children.Add(child);
                    try
                    {
                        if (child.ReadTdtaItem(r) == false)
                            break;
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }

            this.Data = null;
        }
Exemple #38
0
 public Curve(BinaryPSDReader r)
 {
     ushort numPoints = r.ReadUInt16();
     this.Points = new List<CurvePoint>();
     for (int i = 0; i < numPoints; i++)
     {
         this.Points.Add(new CurvePoint(r));
     }
 }
 public ColorTransferFunction(BinaryPSDReader reader)
 {
     this.Curve = new List<short>();
     for (int i = 0; i < 13; i++)
     {
         this.Curve.Add(reader.ReadInt16());
     }
     if (this.Curve[0] == -1 || this.Curve[12] == -1)
         throw new Exception("Error");
     this.Override = reader.ReadUInt16() > 0 ? true : false;
 }
Exemple #40
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;
            }
Exemple #41
0
 public CurvePoint(BinaryPSDReader r)
 {
     this.Output = r.ReadUInt16();
     this.Input = r.ReadUInt16();
 }
                public bool Read(BinaryPSDReader r)
                {
                    this.ID = "";
                    while (true)
                    {
                        char c = r.ReadChar();
                        if (c == 0x0a)
                            break;
                        this.ID += c;
                    }
                    byte[] buffer = new byte[255];
                    int bufPos = 0;
                    int nearEndCnt = 0;
                    while (true)
                    {
                        byte b = r.ReadByte();
                        buffer[bufPos++] = b;
                        if (b == 0x2f)
                            break;
                        if (b <= 0x00)
                        {
                            nearEndCnt++;
                            if (nearEndCnt == 12)
                                break;
                        }
                        else
                            nearEndCnt = 0;
                    }

                    if (this.ID.Contains(" "))
                    {
                        int index = this.ID.IndexOf(" ");
                        this.Value = this.ID.Substring(index + 1);
                        this.ID = this.ID.Remove(index);
                    }

                    int endPos = bufPos - nearEndCnt - 1;
                    //See if it's only 0x09's:
                    for (int i = 0; i < endPos; i++)
                    {
                        if (buffer[i] != 0x09)
                        {
                            this.Data = Endogine.Serialization.ReadableBinary.CreateHexEditorString(buffer, 0, endPos);
                            break;
                        }
                    }

                    return (nearEndCnt == 0);
                }
Exemple #43
0
 public SheetColor(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     this.Color = System.Drawing.Color.FromArgb(
         r.ReadByte(),
         r.ReadByte(),
         r.ReadByte(),
         r.ReadByte());
     this.Data = null;
 }
Exemple #44
0
 public LayerId(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     this.Id = r.ReadUInt32();
     this.Data = null;
 }
Exemple #45
0
 public Knockout(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     this.Value = r.ReadBoolean();
     this.Data = null;
 }
Exemple #46
0
 public LayerNameSource(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     Name = new string(r.ReadPSDChars((int)r.BytesToEnd));
     this.Data = null;
 }
Exemple #47
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)
        }
Exemple #48
0
        public Patterns(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Records = new List<Pattern>();
            while (r.BytesToEnd > 0)
            {
                this.Records.Add(new Pattern(r));
            }
            this.Data = null;
        }
 public GridGuide(BinaryPSDReader reader)
 {
     this.Location = reader.ReadUInt32();
     this.IsHorizontal = reader.ReadBoolean();
 }
Exemple #50
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;
        }
Exemple #51
0
 public Screen(BinaryPSDReader reader)
 {
     this.FrequenceValue = reader.ReadSingle(); //TODO: fixed single
     this.FrequenceScale = reader.ReadUInt16();
     this.Angle = reader.ReadSingle(); //TODO: fixed single
     this.ShapeCode = reader.ReadInt16();
     reader.BaseStream.Position += 4;
     this.AccurateScreens = reader.ReadBoolean();
     this.DefaultScreens = reader.ReadBoolean();
 }
Exemple #52
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;
 }
            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;
                }
            }
Exemple #54
0
 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 Matrix2D(BinaryPSDReader r)
 {
     this.M11 = r.ReadPSDDouble();
     this.M12 = r.ReadPSDDouble();
     this.M13 = r.ReadPSDDouble();
     this.M21 = r.ReadPSDDouble();
     this.M22 = r.ReadPSDDouble();
     this.M23 = r.ReadPSDDouble();
 }
Exemple #56
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!
            }
Exemple #57
0
 public Protected(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     Unknown = r.ReadBytes((int)r.BytesToEnd);
     //this.Settings = r.ReadBoolean(); //4); //nLength?
     this.Data = null;
 }
Exemple #58
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;
            }
        }
Exemple #59
0
 public ReferencePoint(BinaryPSDReader reader)
     : base(reader)
 {
     BinaryPSDReader r = this.GetDataReader();
     this.Point = new EPointF();
     this.Point.X = (float)r.ReadPSDDouble();
     this.Point.Y = (float)r.ReadPSDDouble();
     this.Data = null;
 }
Exemple #60
0
        public Effects(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            r.BaseStream.Position += 2; //unused
            ushort nNumEffects = r.ReadUInt16();
            this._resources = new Dictionary<string, LayerResource>();
            for (int nEffectNum = 0; nEffectNum < nNumEffects; nEffectNum++)
            {
                EffectBase res = (EffectBase)LayerResource.ReadLayerResource(r, typeof(EffectBase));
                //if (res.Tag != "cmnS")
                //  continue;
                this._resources.Add(res.Tag, res);
                //    case "sofi": //unknown
            }

            this.Data = null;
        }