예제 #1
0
        protected override void ReadData(PsdReader reader, object userData)
        {
            LayerRecords records = new LayerRecords();

            records.Top    = reader.ReadInt32();
            records.Left   = reader.ReadInt32();
            records.Bottom = reader.ReadInt32();
            records.Right  = reader.ReadInt32();
            records.ValidateSize();

            int channelCount = reader.ReadUInt16();

            records.ChannelCount = channelCount;

            for (int i = 0; i < channelCount; i++)
            {
                records.Channels[i].Type   = reader.ReadChannelType();
                records.Channels[i].Size   = reader.ReadLength();
                records.Channels[i].Width  = records.Width;
                records.Channels[i].Height = records.Height;
            }

            reader.ValidateSignature();

            records.BlendMode = reader.ReadBlendMode();
            records.Opacity   = reader.ReadByte();
            records.Clipping  = reader.ReadBoolean();
            records.Flags     = reader.ReadLayerFlags();
            records.Filter    = reader.ReadByte();

            Records = records;
        }
예제 #2
0
        protected override void ReadData(PsdReader reader, object userData)
        {
            reader.ValidateSignature("liFD");
            int version = reader.ReadInt32();

            Guid        id         = new Guid(reader.ReadPascalString(1));
            string      name       = reader.ReadString();
            string      type       = reader.ReadType();
            string      creator    = reader.ReadType();
            long        length     = reader.ReadInt64();
            IProperties properties = reader.ReadBoolean() == true ? new StructureDescriptor(reader).Items : null;

            bool isDocument = this.IsDocument(reader);
            LinkedDocumentBlock           documentReader   = null;
            LinkedDocumnetFileHeaderBlock fileHeaderReader = null;

            if (length > 0 && isDocument == true)
            {
                long position = reader.Position;
                documentReader   = new LinkedDocumentBlock(reader, length);
                reader.Position  = position;
                fileHeaderReader = new LinkedDocumnetFileHeaderBlock(reader, length);
            }

            LinkedLayer = new LinkedLayer(name, id, documentReader, fileHeaderReader);
        }
예제 #3
0
        protected override void ReadValue(PsdReader reader, Object userData, out LinkedLayer value)
        {
            reader.ValidateSignature("liFD");
            Int32 version = reader.ReadInt32();

            Guid        id         = new Guid(reader.ReadPascalString(1));
            String      name       = reader.ReadString();
            String      type       = reader.ReadType();
            String      creator    = reader.ReadType();
            Int64       length     = reader.ReadInt64();
            IProperties properties = reader.ReadBoolean() == true ? new DescriptorStructure(reader) : null;

            Boolean isDocument = this.IsDocument(reader);
            LinkedDocumentReader           documentReader   = null;
            LinkedDocumnetFileHeaderReader fileHeaderReader = null;

            if (length > 0 && isDocument == true)
            {
                Int64 position = reader.Position;
                documentReader   = new LinkedDocumentReader(reader, length);
                reader.Position  = position;
                fileHeaderReader = new LinkedDocumnetFileHeaderReader(reader, length);
            }

            value = new LinkedLayer(name, id, documentReader, fileHeaderReader);
        }
예제 #4
0
 protected override void ReadData(PsdReader reader, object userData)
 {
     version = reader.ReadInt32();
     hasCompatibilityImage = reader.ReadBoolean();
     writerName            = reader.ReadString();
     readerName            = reader.ReadString();
     fileVersion           = reader.ReadInt32();
 }
예제 #5
0
        protected override void ReadValue(PsdReader reader, Object userData, out IProperties value)
        {
            Properties props = new Properties(5);

            props["Version"] = reader.ReadInt32();
            props["HasCompatibilityImage"] = reader.ReadBoolean();
            props["WriterName"]            = reader.ReadString();
            props["ReaderName"]            = reader.ReadString();
            props["FileVersion"]           = reader.ReadInt32();

            value = props;
        }
예제 #6
0
        protected override void ReadValue(PsdReader reader, object userData, out IProperties value)
        {
            Properties props = new Properties(5);

            props["Version"] = reader.ReadInt32();
            props["HasCompatibilityImage"] = reader.ReadBoolean();
            props["WriterName"] = reader.ReadString();
            props["ReaderName"] = reader.ReadString();
            props["FileVersion"] = reader.ReadInt32();

            value = props;
        }
예제 #7
0
        protected override void ReadData(PsdReader reader, object userData)
        {
            reader.ValidateSignature("liFE");

            int version = reader.ReadInt32();

            Guid   id      = new Guid(reader.ReadPascalString(1));
            string name    = reader.ReadString();
            string type    = reader.ReadType();
            string creator = reader.ReadType();

            long        length      = reader.ReadInt64();
            IProperties properties  = reader.ReadBoolean() == true ? new StructureDescriptor(reader).Items : null;
            Uri         absoluteUri = this.ReadAboluteUri(reader);

            EmbeddedLayer = new EmbeddedLayer(id, reader.Resolver, absoluteUri);
        }
예제 #8
0
        protected override void ReadValue(PsdReader reader, Object userData, out EmbeddedLayer value)
        {
            reader.ValidateSignature("liFE");

            Int32 version = reader.ReadInt32();

            Guid   id      = new Guid(reader.ReadPascalString(1));
            String name    = reader.ReadString();
            String type    = reader.ReadType();
            String creator = reader.ReadType();

            Int64       length      = reader.ReadInt64();
            IProperties properties  = reader.ReadBoolean() == true ? new DescriptorStructure(reader) : null;
            Uri         absoluteUri = this.ReadAboluteUri(reader);

            value = new EmbeddedLayer(id, reader.Resolver, absoluteUri);
        }
예제 #9
0
        private static Properties ReadSliceInfo(PsdReader reader)
        {
            Properties props = new Properties();

            props["ID"]      = reader.ReadInt32();
            props["GroupID"] = reader.ReadInt32();
            int origin = reader.ReadInt32();

            if (origin == 1)
            {
                int asso = reader.ReadInt32();
            }
            props["Name"] = reader.ReadString();
            int type = reader.ReadInt32();

            props["Left"]   = reader.ReadInt32();
            props["Top"]    = reader.ReadInt32();
            props["Right"]  = reader.ReadInt32();
            props["Bottom"] = reader.ReadInt32();

            props["Url"]     = reader.ReadString();
            props["Target"]  = reader.ReadString();
            props["Message"] = reader.ReadString();
            props["AltTag"]  = reader.ReadString();

            bool b = reader.ReadBoolean();

            string cellText = reader.ReadString();

            props["HorzAlign"] = reader.ReadInt32();
            props["VertAlign"] = reader.ReadInt32();

            props["Alpha"] = reader.ReadByte();
            props["Red"]   = reader.ReadByte();
            props["Green"] = reader.ReadByte();
            props["Blue"]  = reader.ReadByte();

            return(props);
        }
예제 #10
0
        public static object Read(string ostype, PsdReader reader)
        {
            switch (ostype)
            {
            case "obj ":
                return(new StructureReference(reader));

            case "Objc":
                return(new DescriptorStructure(reader, false));

            case "VlLs":
                return(new StructureList(reader));

            case "doub":
                return(reader.ReadDouble());

            case "UntF":
                return(new StructureUnitFloat(reader));

            case "TEXT":
                return(reader.ReadString());

            case "enum":
                return(new StructureEnumerate(reader));

            case "long":
                return(reader.ReadInt32());

            case "bool":
                return(reader.ReadBoolean());

            case "GlbO":
                return(new DescriptorStructure(reader, false));

            case "type":
                return(new StructureClass(reader));

            case "GlbC":
                return(new StructureClass(reader));

            case "alis":
                return(new StructureAlias(reader));

            case "tdta":
                return(new StructureUnknownOSType("Cannot read RawData"));

            case "prop":
                return(new StructureProperty(reader));

            case "Clss":
                return(new StructureClass(reader));

            case "Enmr":
                return(new StructureEnumerate(reader));

            case "rele":
                return(new StructureOffset(reader));

            case "Idnt":
                return(new StructureUnknownOSType("Cannot read Identifier"));

            case "indx":
                return(new StructureUnknownOSType("Cannot read Index"));

            case "name":
                return(new StructureUnknownOSType("Cannot read Name"));

            case "ObAr":
                return(new StructureObjectArray(reader));
            }
            throw new NotSupportedException(ostype);
        }
예제 #11
0
        public static object Read(string ostype, PsdReader reader)
        {
            switch (ostype)
            {
                case "obj ":
                    return new StructureReference(reader);

                case "Objc":
                    return new DescriptorStructure(reader, false);

                case "VlLs":
                    return new StructureList(reader);

                case "doub":
                    return reader.ReadDouble();

                case "UntF":
                    return new StructureUnitFloat(reader);

                case "TEXT":
                    return reader.ReadString();

                case "enum":
                    return new StructureEnumerate(reader);

                case "long":
                    return reader.ReadInt32();

                case "bool":
                    return reader.ReadBoolean();

                case "GlbO":
                    return new DescriptorStructure(reader, false);

                case "type":
                    return new StructureClass(reader);

                case "GlbC":
                    return new StructureClass(reader);

                case "alis":
                    return new StructureAlias(reader);

                case "tdta":
                    return new StructureUnknownOSType("Cannot read RawData");

                case "prop":
                    return new StructureProperty(reader);

                case "Clss":
                    return new StructureClass(reader);

                case "Enmr":
                    return new StructureEnumerate(reader);

                case "rele":
                    return new StructureOffset(reader);

                case "Idnt":
                    return new StructureUnknownOSType("Cannot read Identifier");

                case "indx":
                    return new StructureUnknownOSType("Cannot read Index");

                case "name":
                    return new StructureUnknownOSType("Cannot read Name");

                case "ObAr":
                    return new StructureObjectArray(reader);

            }
            throw new NotSupportedException(ostype);
        }
예제 #12
0
 public StructureBool(PsdReader reader)
 {
     Value = reader.ReadBoolean();
 }
예제 #13
0
        private static Properties ReadSliceInfo(PsdReader reader)
        {
            Properties props = new Properties();
            props["ID"] = reader.ReadInt32();
            props["GroupID"] = reader.ReadInt32();
            int origin = reader.ReadInt32();
            if (origin == 1)
            {
                int asso = reader.ReadInt32();
            }
            props["Name"] = reader.ReadString();
            int type = reader.ReadInt32();

            props["Left"] = reader.ReadInt32();
            props["Top"] = reader.ReadInt32();
            props["Right"] = reader.ReadInt32();
            props["Bottom"] = reader.ReadInt32();

            props["Url"] = reader.ReadString();
            props["Target"] = reader.ReadString();
            props["Message"] = reader.ReadString();
            props["AltTag"] = reader.ReadString();

            bool b = reader.ReadBoolean();

            string cellText = reader.ReadString();

            props["HorzAlign"] = reader.ReadInt32();
            props["VertAlign"] = reader.ReadInt32();

            props["Alpha"] = reader.ReadByte();
            props["Red"] = reader.ReadByte();
            props["Green"] = reader.ReadByte();
            props["Blue"] = reader.ReadByte();

            return props;
        }