コード例 #1
0
ファイル: GradientGlowFilter.cs プロジェクト: kaldap/XnaFlash
        public GradientGlowBevelFilter(SwfStream stream, bool bevel)
        {
            mId = bevel ? ID.GradientBevel : ID.GradientGlow;

            byte numColors = stream.ReadByte();
            GlowColors = stream.ReadRGBAArray(numColors);
            GlowRatios = stream.ReadByteArray(numColors);
            BlurX = stream.ReadFixed();
            BlurY = stream.ReadFixed();
            Strength = stream.ReadFixedHalf();
            mFlags = stream.ReadByte();
        }
コード例 #2
0
ファイル: DefineBitsTag.cs プロジェクト: kaldap/XnaFlash
        protected void Load(SwfStream stream, uint length, bool hasDeblock)
        {
            CharacterID = stream.ReadUShort();
            uint alpha = stream.ReadUInt();
            Deblock = hasDeblock ? (ushort?)stream.ReadUShort() : null;
            byte[] data = stream.ReadByteArray(length - 6);

            ImageData = new byte[alpha];
            Array.Copy(data, 0, ImageData, 0, (int)alpha);
            Format = BitmapUtils.DetectFormat(ImageData);
            if (Format == BitmapFormat.Jpeg)
                ImageData = BitmapUtils.RepairJpegMarkers(ImageData);

            CompressedAlpha = new byte[data.Length - alpha];
            if (CompressedAlpha.Length > 0)
                Array.Copy(data, (int)alpha, CompressedAlpha, 0, CompressedAlpha.Length);
        }
コード例 #3
0
        protected bool Load(SwfStream stream, uint length, bool hasAlpha)
        {
            CharacterID = stream.ReadUShort();

            byte format = stream.ReadByte();
            Width = stream.ReadUShort();
            Height = stream.ReadUShort();
            byte table = (format == 3) ? stream.ReadByte() : (byte)0;
            byte[] compressed = stream.ReadByteArray(length - stream.TagPosition);
            byte[] data;
            var inflater = new Inflater();
            inflater.SetInput(compressed);

            if (format == 3)
            {
                int rem = Width % 4;
                data = new byte[((rem == 0) ? Width : (Width + 4 - rem)) * Height * 4];
                if (inflater.Inflate(data) != data.Length)
                    throw new SwfCorruptedException("Bitmap data are not valid ZLIB stream!");
                Pixels = BitmapUtils.UnpackIndexed(data, Width, Height, table, hasAlpha);
            }
            else if (format == 4 && !hasAlpha)
            {
                data = new byte[(Width + Width & 0x01) * Height * 2];
                if (inflater.Inflate(data) != data.Length)
                    throw new SwfCorruptedException("Bitmap data are not valid ZLIB stream!");
                Pixels = BitmapUtils.UnpackPIX15(data, Width, Height);
            }
            else if (format == 5)
            {
                data = new byte[Width * Height * 4];
                if (inflater.Inflate(data) != data.Length)
                    return true;
                Pixels = BitmapUtils.UnpackPIX24(data, Width, Height, hasAlpha);
            }
            else
                throw new SwfCorruptedException("Invalid lossless bitmap format found!");

            return true;
        }
コード例 #4
0
 public void Load(SwfStream stream, uint length, byte version)
 {
     CharacterID = stream.ReadUShort();
     stream.ReadUInt();
     Data = stream.ReadByteArray(length - 6);
 }
コード例 #5
0
ファイル: JPEGTablesTag.cs プロジェクト: kaldap/XnaFlash
 public void Load(SwfStream stream, uint length, byte version)
 {
     JpegData = BitmapUtils.RepairJpegMarkers(stream.ReadByteArray(length));
 }
コード例 #6
0
ファイル: DefineBitsTag.cs プロジェクト: kaldap/XnaFlash
 public override void Load(SwfStream stream, uint length, byte version)
 {
     CharacterID = stream.ReadUShort();
     ImageData = BitmapUtils.RepairJpegMarkers(stream.ReadByteArray(length - 2));
     Format = BitmapUtils.DetectFormat(ImageData);
 }
コード例 #7
0
ファイル: DefineBitsTag.cs プロジェクト: kaldap/XnaFlash
 public virtual void Load(SwfStream stream, uint length, byte version)
 {
     CharacterID = stream.ReadUShort();
     ImageData = BitmapUtils.ComposeJpeg(stream.JpegTables.JpegData, BitmapUtils.RepairJpegMarkers(stream.ReadByteArray(length - 2)));
 }