Beispiel #1
0
        public ResolutionInfo(ImageResource imgRes) : base(imgRes)
        {
            //m_bResolutionInfoFilled = true;
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.hRes      = reader.ReadInt16();
            this.hResUnit  = reader.ReadInt32();
            this.widthUnit = reader.ReadInt16();

            this.vRes       = reader.ReadInt16();
            this.vResUnit   = reader.ReadInt32();
            this.heightUnit = reader.ReadInt16();

            reader.Close();
        }
Beispiel #2
0
        public GlobalAngle(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Value = reader.ReadInt32();
            reader.Close();
        }
        public Thumbnail(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            //m_bThumbnailFilled = true;

            this.Format         = reader.ReadInt32();
            this.Width          = reader.ReadInt32();
            this.Height         = reader.ReadInt32();
            this.WidthBytes     = reader.ReadInt32(); //padded row bytes (
            this.Size           = reader.ReadInt32(); //Total size widthbytes * height * planes
            this.CompressedSize = reader.ReadInt32(); //used for consistancy check
            this.BitPerPixel    = reader.ReadInt16();
            this.Planes         = reader.ReadInt16();

            int numBytes = (int)reader.BytesToEnd;

            byte[] buffer = reader.ReadBytes(numBytes);

            if (this.ID == 1033)
            {
                // BGR
                for (int n = 0; n < numBytes - 2; n += 3)
                {
                    byte tmp = buffer[n + 2];
                    buffer[n + 2] = buffer[n];
                    buffer[n]     = tmp;
                }
            }
            System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
            this.Bitmap = new System.Drawing.Bitmap(stream);

            reader.Close();
        }
Beispiel #4
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;
        }
Beispiel #5
0
        public URLList(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader  = imgRes.GetDataReader();
            int             numUrls = reader.ReadInt32();

            this.URLs = new List <URLEntry>();
            for (int i = 0; i < numUrls; i++)
            {
                reader.ReadUInt32(); //padding??
                uint   id  = reader.ReadUInt32();
                string url = reader.ReadPSDUnicodeString();
                this.URLs.Add(new URLEntry(id, url));
                this.URLsx.Add(url);
            }
            reader.Close();
        }