Beispiel #1
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 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();
        }
        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;
        }
Beispiel #4
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;
        }
Beispiel #5
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();
 }
            public ColorStop(BinaryPSDReader r)
            {
                this.Location = r.ReadUInt32();
                this.Midpoint = r.ReadUInt32();
                this.ColorMode = (ColorModes)r.ReadUInt16();

                this.Channels = r.ReadPSDChannelValues(4);

                this.Unknown = r.ReadUInt16();
            }
Beispiel #7
0
        public PrintFlagsInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader  = imgRes.GetDataReader();
            ushort          version = reader.ReadUInt16();

            this.CenterCrop = reader.ReadByte();
            reader.ReadByte(); //padding?
            this.BleedWidthValue = reader.ReadUInt32();
            this.BleedWidthScale = reader.ReadUInt16();

            reader.Close();
        }
Beispiel #8
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;
        }
        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;
        }
Beispiel #10
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();
        }
Beispiel #11
0
        public LayerStateInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.TargetLayerIndex = reader.ReadUInt16();
            reader.Close();
        }
Beispiel #12
0
            public FontInfo(BinaryPSDReader r)
            {
                this.Mark           = r.ReadUInt16();
                this.FontType       = r.ReadUInt32();
                this.FontName       = r.ReadPascalString();
                this.FontFamilyName = r.ReadPascalString();
                this.FontStyleName  = r.ReadPascalString();
                this.Script         = r.ReadUInt16();

                ushort NumDesignAxesVectors = r.ReadUInt16();

                this.DesignVectors = new List <uint>();
                for (int vectorNum = 0; vectorNum < NumDesignAxesVectors; vectorNum++)
                {
                    this.DesignVectors.Add(r.ReadUInt32());
                }
            }
Beispiel #13
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;
        }
        public Posterize(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            this.Value = r.ReadUInt16();
            //TODO: two bytes left---
            this.Data = null;
        }
Beispiel #15
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));
                }
            }
Beispiel #16
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();
 }
Beispiel #17
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;
        }
Beispiel #18
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;
        }
Beispiel #19
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;
        }
        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;
        }
Beispiel #21
0
        public LayersGroupInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.GroupIds = new List <ushort>();
            while (reader.BytesToEnd > 0)
            {
                this.GroupIds.Add(reader.ReadUInt16());
            }

            reader.Close();
        }
Beispiel #22
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);
        }
 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;
 }
        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;
        }
Beispiel #25
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;
                }
            }
Beispiel #26
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;
        }
 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;
 }
Beispiel #28
0
        public TypeTool(BinaryPSDReader areader)
            : base(areader)
        {
            BinaryPSDReader reader  = this.GetDataReader();
            ushort          Version = reader.ReadUInt16(); //1= Photoshop 5.0

            for (int i = 0; i < 6; i++)                    //2D transform matrix
            {
                reader.ReadPSDDouble();
            }


            //Font info:
            ushort FontVersion = reader.ReadUInt16(); //6 = Photoshop 5.0
            ushort FaceCount   = reader.ReadUInt16();

            this.FontInfos = new List <FontInfo>();
            for (int i = 0; i < FaceCount; i++)
            {
                this.FontInfos.Add(new FontInfo(reader));
            }

            //TODO: make classes of styles as well...
            ushort StyleCount = reader.ReadUInt16();

            for (int i = 0; i < StyleCount; i++)
            {
                ushort Mark      = reader.ReadUInt16();
                ushort FaceMark  = reader.ReadUInt16();
                uint   Size      = reader.ReadUInt32();
                uint   Tracking  = reader.ReadUInt32();
                uint   Kerning   = reader.ReadUInt32();
                uint   Leading   = reader.ReadUInt32();
                uint   BaseShift = reader.ReadUInt32();

                byte AutoKern = reader.ReadByte();
                byte Extra    = 0;
                if (Version <= 5)
                {
                    Extra = reader.ReadByte();
                }
                byte Rotate = reader.ReadByte();
            }

            //Text information
            ushort Type           = reader.ReadUInt16();
            uint   ScalingFactor  = reader.ReadUInt32();
            uint   CharacterCount = reader.ReadUInt32();

            uint HorizontalPlacement = reader.ReadUInt32();
            uint VerticalPlacement   = reader.ReadUInt32();

            uint SelectStart = reader.ReadUInt32();
            uint SelectEnd   = reader.ReadUInt32();

            ushort LineCount = reader.ReadUInt16();

            for (int i = 0; i < LineCount; i++)
            {
                uint   CharacterCountLine = reader.ReadUInt32();
                ushort Orientation        = reader.ReadUInt16();
                ushort Alignment          = reader.ReadUInt16();

                ushort DoubleByteChar = reader.ReadUInt16();
                ushort Style          = reader.ReadUInt16();
            }

            ushort ColorSpace = reader.ReadUInt16();

            for (int i = 0; i < 4; i++)
            {
                reader.ReadUInt16(); //Color compensation
            }
            byte AntiAlias = reader.ReadByte();
        }
Beispiel #29
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));
     }
 }
Beispiel #30
0
 public CurvePoint(BinaryPSDReader r)
 {
     this.Output = r.ReadUInt16();
     this.Input = r.ReadUInt16();
 }
Beispiel #31
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;
            }
 public TransparencyStop(BinaryPSDReader r)
 {
     this.Location = r.ReadUInt32();
     this.Midpoint = r.ReadUInt32();
     this.Opacity = r.ReadUInt16();
 }
Beispiel #33
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();
 }
Beispiel #34
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();
 }
Beispiel #35
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();
        }
Beispiel #36
0
 public CurvePoint(BinaryPSDReader r)
 {
     this.Output = r.ReadUInt16();
     this.Input  = r.ReadUInt16();
 }