Ejemplo n.º 1
0
        public LayerExtraRecordsX(LayerMaskBlock layerMask,
                                  LayerBlendingRangesBlock blendingRanges,
                                  LayerResourceBlock resources,
                                  string name)
        {
            this.layerMask      = layerMask;
            this.blendingRanges = blendingRanges;
            this.resources      = resources;
            this.name           = name;

            IResourceBlock block = null;

            block = this.resources.Resources.FirstOrDefault(x => x is luniResource);

            if (block != null)
            {
                var luni = (luniResource)block;
                this.name = luni.Name;
            }

            block = this.resources.Resources.FirstOrDefault(x => x is lsctResource);

            if (block != null)
            {
                var lyvr = (lsctResource)block;
                this.sectionType = lyvr.SectionType;
            }

            //if (this.resources.Resources.Contains("SoLd.Idnt") == true)
            //          this.placedID = this.resources.Resources.ToGuid("SoLd.Idnt");
            //      else if (this.resources.Resources.Contains("SoLE.Idnt") == true)
            //          this.placedID = this.resources.Resources.ToGuid("SoLE.Idnt");
            placedID = Guid.Empty;
        }
Ejemplo n.º 2
0
        public void SetExtraRecords(LayerMaskBlock layerMask, LayerBlendingRangesBlock blendingRanges, IResourceBlock[] resources, string name)
        {
            this.layerMask      = layerMask;
            this.blendingRanges = blendingRanges;
            this.resources      = resources;
            this.name           = name;

            IResourceBlock block = null;

            block = this.Resources.FirstOrDefault(x => x is luniResource);

            if (block != null)
            {
                var luni = (luniResource)block;
                this.name = luni.Name;
            }

            block = this.Resources.FirstOrDefault(x => x is lyvrResource);

            if (block != null)
            {
                var lyvr = (lyvrResource)block;
                this.version = lyvr.Version;
            }

            block = this.Resources.FirstOrDefault(x => x is lsctResource);

            if (block != null)
            {
                var lyvr = (lsctResource)block;
                this.sectionType = lyvr.SectionType;
            }
            else
            {
                block = this.Resources.FirstOrDefault(x => x is lsdkResource);

                if (block != null)
                {
                    var lyvr = (lsdkResource)block;
                    this.sectionType = lyvr.SectionType;
                }
            }

            //if (this.resources.Contains("SoLd.Idnt") == true)
            //       this.placedID = this.resources.ToGuid("SoLd.Idnt");
            //   else if (this.resources.Contains("SoLE.Idnt") == true)
            //       this.placedID = this.resources.ToGuid("SoLE.Idnt");
            placedID = Guid.Empty;

            foreach (var item in this.channels)
            {
                switch (item.Type)
                {
                case ChannelType.Mask:
                {
                    if (this.layerMask != null)
                    {
                        item.Width  = this.layerMask.Width;
                        item.Height = this.layerMask.Height;
                    }
                }
                break;

                case ChannelType.Alpha:
                {
                    var iOpablock = this.Resources.FirstOrDefault(x => x is iOpaResource) as iOpaResource;

                    if (iOpablock != null)
                    {
                        var  iOpa = (iOpaResource)block;
                        byte opa  = iOpa.Opacity;
                        item.Opacity = opa / 255.0f;
                    }
                }
                break;
                }
            }
        }
Ejemplo n.º 3
0
        public static LayerMaskBlock Read(PsdReader reader)
        {
            LayerMaskBlock instance = new LayerMaskBlock(reader);

            return(instance);
        }