Exemplo n.º 1
0
 public Matrix2D(PsdBinaryReader r)
 {
     this.M11 = r.ReadDouble();
     this.M12 = r.ReadDouble();
     this.M13 = r.ReadDouble();
     this.M21 = r.ReadDouble();
     this.M22 = r.ReadDouble();
     this.M23 = r.ReadDouble();
 }
Exemplo n.º 2
0
 public LayerTypeToolInfo(PsdBinaryReader reader)
 {
     Version               = reader.ReadInt16();
     xx                    = reader.ReadDouble();
     xy                    = reader.ReadDouble();
     yx                    = reader.ReadDouble();
     yy                    = reader.ReadDouble();
     tx                    = reader.ReadDouble();
     ty                    = reader.ReadDouble();
     TextVersion           = reader.ReadInt16();
     TextDescriptorVestion = reader.ReadInt32();
     TextData              = new DescriptorStructure(reader);
     WarpVersion           = reader.ReadInt16();
     WarpDescriptorVestion = reader.ReadInt32();
     WarpData              = new DescriptorStructure(reader);
     left                  = reader.ReadInt32();
     top                   = reader.ReadInt32();
     right                 = reader.ReadInt32();
     bottom                = reader.ReadInt32();
 }
Exemplo n.º 3
0
 public UnitFloatStructure(PsdBinaryReader reader)
 {
     Unit  = reader.ReadAsciiChars(4);
     Value = reader.ReadDouble();
 }
Exemplo n.º 4
0
 public DoubleStructure(PsdBinaryReader reader)
 {
     Value = reader.ReadDouble();
 }
Exemplo n.º 5
0
        public static DynVal ReadValue(PsdBinaryReader r, bool skipKey)
        {
            DynVal vt = new DynVal();

            if (!skipKey)
            {
                vt.Name = GetMeaningOfFourCC(ReadSpecialString(r));
            }

            //TODO: should be assigned a sequential number?
            vt.Type = parseTypeString(r.ReadAsciiChars(4));
            switch (vt.Type)
            {
            case OSType.tdta:
                // unknown
                r.ReadUInt32();
                TdTaParser p = new TdTaParser(r);
                object     o = p.ParseOneTree();
                vt.Value = o;

                break;

            case OSType.Reference:
                vt.References = ReadValues(r, true);
                break;

            case OSType.Descriptor:
                vt.Value = DynVal.ReadDescriptor(r);
                break;

            case OSType.List:
                vt.Children = ReadValues(r, true);
                break;

            case OSType.Double:
                vt.Value = r.ReadDouble();
                break;

            case OSType.UnitFloat:                                    //Unif float
                string tst = GetMeaningOfFourCC(r.ReadAsciiChars(4)); //#Prc #Pxl #Ang = percent / pixels / angle?
                double d   = r.ReadDouble();
                tst     += ": " + d;
                vt.Value = tst;
                break;

            case OSType.Enumerated:
                string typeID  = ReadSpecialString(r);
                string enumVal = ReadSpecialString(r);
                vt.Value = GetMeaningOfFourCC(typeID) + "." + GetMeaningOfFourCC(enumVal);
                break;

            case OSType.Integer:
                vt.Value = r.ReadInt32();     //4 byte integer
                break;

            case OSType.Boolean:
                vt.Value = r.ReadBoolean();
                break;

            case OSType.String:
                vt.Value = r.ReadUnicodeString();    //r.ReadPSDUnicodeString();
                break;

            case OSType.LargeInteger:
                vt.Value = r.ReadInt64();
                break;

            case OSType.Class:
                vt.Value = ReadClass(r);
                break;

            case OSType.Alias:
                vt.Value = ReadAlias(r);
                break;

            case OSType.PropertyRef:
                vt.Value = ReadProperty(r);
                break;

            case OSType.EnumeratedRef:
                vt.Value = ReadEnumeratedRef(r);
                break;

            case OSType.OffestRef:
                vt.Value = ReadOffset(r);
                break;

            case OSType.IdentifierRef:
                vt.Value = r.ReadAsciiChars(4);
                break;

            case OSType.IndexRef:
                vt.Value = r.ReadUInt16();
                break;

            case OSType.NameRef:
                vt.Value = r.ReadAsciiChars(4);
                break;

            default:
                throw new Exception("Unhandled type: " + vt.Type);
            }
            return(vt);
        }
Exemplo n.º 6
0
        public static DynVal ReadValue(PsdBinaryReader r, bool skipKey)
        {
            DynVal vt = new DynVal();

            if (!skipKey)
            {
                vt.Name = GetMeaningOfFourCC(ReadSpecialString(r));
            }

            //TODO: should be assigned a sequential number?
            vt.Type = parseTypeString(System.Text.Encoding.ASCII.GetString(r.ReadBytes(4)));
            switch (vt.Type)
            {
            case  OSType.tdta:
                // unknown
                r.ReadUInt32();
                TdTaParser p = new TdTaParser(r);
                object     o = p.ParseOneTree();
                vt.Value = o;

                break;

            case  OSType.Descriptor:
                vt = DynVal.ReadDescriptor(r);
                break;

            case OSType.List:
                vt.Children = ReadValues(r, true);
                break;

            case OSType.Double:
                vt.Value = r.ReadDouble();
                break;

            case OSType.UnitFloat:                                                                     //Unif float
                //TODO: need a specific type for this, with a double and a type (percent/pixel)?
                string tst = GetMeaningOfFourCC(System.Text.Encoding.ASCII.GetString(r.ReadBytes(4))); //#Prc #Pxl #Ang = percent / pixels / angle?
                double d   = r.ReadDouble();
                tst     += ": " + d;
                vt.Value = tst;
                break;

            case OSType.Enumerated:
                string namesp = ReadSpecialString(r);
                string item   = ReadSpecialString(r);
                //vt.Value = namesp + "." + item; //TODO: cast to real enum
                vt.Value = GetMeaningOfFourCC(namesp) + "." + GetMeaningOfFourCC(item);
                break;

            case OSType.Integer:
                vt.Value = r.ReadInt32();     //4 byte integer
                break;

            case OSType.Boolean:
                vt.Value = r.ReadBoolean();
                break;

            case  OSType.String:
                vt.Value = r.ReadUnicodeString();                        //r.ReadPSDUnicodeString();
                break;

            default:
                throw new Exception("Unhandled type: " + vt.Type);
            }
            return(vt);
        }