Example #1
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();
 }
Example #2
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);
        }
Example #3
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 #4
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 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;
        }
Example #6
0
        public Knockout(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadBoolean();
            this.Data  = null;
        }
Example #7
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 #8
0
        public BlendElements(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadBoolean();
            this.Data  = null;
        }
Example #9
0
        public HueSaturation(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort version = r.ReadUInt16();

            this.ColorizeMode      = r.ReadBoolean();
            r.BaseStream.Position += 1; //padding

            this.Settings = new List <HSLModifier>();
            if (version == 1)
            {
                this.Colorize            = new HSLModifier();
                this.Colorize.Hue        = (short)((int)r.ReadInt16() * 180 / 100);
                this.Colorize.Saturation = r.ReadInt16();
                this.Colorize.Lightness  = r.ReadInt16();

                for (int i = 0; i < 7; i++)
                {
                    HSLModifier hsl = new HSLModifier();
                    this.Settings.Add(hsl);
                    hsl.Hue = r.ReadInt16();
                }
                for (int i = 0; i < 7; i++)
                {
                    this.Settings[i].Saturation = r.ReadInt16();
                }
                for (int i = 0; i < 7; i++)
                {
                    this.Settings[i].Lightness = r.ReadInt16();
                }
            }
            else if (version == 2)
            {
                this.Colorize = new HSLModifier(r);

                HSLModifier hsl = new HSLModifier(r); //master
                this.Settings.Add(hsl);

                for (int i = 0; i < 6; i++)
                {
                    List <short> ranges = new List <short>();
                    for (int j = 0; j < 4; j++)
                    {
                        ranges.Add(r.ReadInt16());
                    }
                    hsl = new HSLModifier(r);
                    this.Settings.Add(hsl);
                    hsl.Ranges = ranges;
                }
            }

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

            //uint version = r.ReadUInt32();
            //TODO: no idea how to interpret colors... Not RGB or CMYK anyway!
            r.BaseStream.Position += 16;
            this.Density = r.ReadUInt16();
            this.PreserveLuminosity = r.ReadBoolean();
            //this.Data = null;
        }
        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();
        }
Example #13
0
        public PrintFlags(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Labels      = reader.ReadBoolean();
            this.CropMarks   = reader.ReadBoolean();
            this.ColorBars   = reader.ReadBoolean();
            this.RegMarks    = reader.ReadBoolean();
            this.Negative    = reader.ReadBoolean();
            this.Flip        = reader.ReadBoolean();
            this.Interpolate = reader.ReadBoolean();
            this.Caption     = reader.ReadBoolean();
            if (reader.BytesToEnd > 0)
            {
                this.Unknown = reader.ReadBoolean();
            }

            reader.Close();
        }
        public SelectiveColor(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort version = r.ReadUInt16();
            r.BaseStream.Position += 1;
            this.AbsoluteMode = r.ReadBoolean();

            this.Records = new List<CorrectionRecord>();
            for (int i = 0; i < 10; i++)
                this.Records.Add(new CorrectionRecord(r));

            this.Data = null;
        }
Example #15
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 #16
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 #17
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();
 }
Example #18
0
        public PathInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.PathNum = this.ID - 2000;
            this.ID      = 2000;

            ushort numKnots = 0;
            int    cnt      = 0;

            this.Commands = new List <object>();
            while (reader.BytesToEnd > 0)
            {
                RecordType rtype = (RecordType)(int)reader.ReadUInt16();
                //Should always start with PathFill (0)
                if (cnt == 0 && rtype != RecordType.PathFill)
                {
                    throw new Exception("PathInfo start error!");
                }

                switch (rtype)
                {
                case RecordType.InitialFill:
                    reader.BaseStream.Position += 1;
                    bool allPixelStart = reader.ReadBoolean();
                    reader.BaseStream.Position += 22;
                    break;

                case RecordType.PathFill:
                    if (cnt != 0)
                    {
                        throw new Exception("Path fill?!?");
                    }
                    reader.BaseStream.Position += 24;
                    break;

                case RecordType.Clipboard:
                    ERectangleF rct = new ERectangleF();
                    rct.Top    = reader.ReadPSDSingle();
                    rct.Left   = reader.ReadPSDSingle();
                    rct.Bottom = reader.ReadPSDSingle();
                    rct.Right  = reader.ReadPSDSingle();
                    Clipboard clp = new Clipboard();
                    clp.Rectangle = rct;
                    clp.Scale     = reader.ReadPSDSingle();
                    reader.BaseStream.Position += 4;
                    this.Commands.Add(clp);
                    break;

                case RecordType.ClosedPathLength:
                case RecordType.OpenPathLength:
                    numKnots = reader.ReadUInt16();
                    reader.BaseStream.Position += 22;
                    NewPath np = new NewPath();
                    np.Open = (rtype == RecordType.OpenPathLength);
                    this.Commands.Add(np);
                    break;

                case RecordType.ClosedPathBezierKnotLinked:
                case RecordType.ClosedPathBezierKnotUnlinked:
                case RecordType.OpenPathBezierKnotLinked:
                case RecordType.OpenPathBezierKnotUnlinked:
                    BezierKnot bz = new BezierKnot();

                    EPointF[] pts = new EPointF[3];
                    for (int i = 0; i < 3; i++)
                    {
                        float y = reader.ReadPSDFixedSingle();     //y comes first...
                        pts[i] = new EPointF(reader.ReadPSDFixedSingle(), y) / 256;
                    }
                    bz.Control1 = pts[0];
                    bz.Anchor   = pts[1];
                    bz.Control2 = pts[2];
                    bz.Linked   = (rtype == RecordType.ClosedPathBezierKnotLinked || rtype == RecordType.OpenPathBezierKnotLinked);
                    //bz.Open = (rtype == RecordType.OpenPathBezierKnotLinked || rtype == RecordType.OpenPathBezierKnotUnlinked);

                    this.Commands.Add(bz);
                    numKnots--;
                    break;
                }
                cnt++;
            }

            reader.Close();
        }
Example #19
0
 public GridGuide(BinaryPSDReader reader)
 {
     this.Location = reader.ReadUInt32();
     this.IsHorizontal = reader.ReadBoolean();
 }
 public GridGuide(BinaryPSDReader reader)
 {
     this.Location     = reader.ReadUInt32();
     this.IsHorizontal = reader.ReadBoolean();
 }