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(); }
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); }
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; }
public void Load(SwfStream stream, uint length, byte version) { CharacterID = stream.ReadUShort(); stream.ReadUInt(); Data = stream.ReadByteArray(length - 6); }
public void Load(SwfStream stream, uint length, byte version) { JpegData = BitmapUtils.RepairJpegMarkers(stream.ReadByteArray(length)); }
public override void Load(SwfStream stream, uint length, byte version) { CharacterID = stream.ReadUShort(); ImageData = BitmapUtils.RepairJpegMarkers(stream.ReadByteArray(length - 2)); Format = BitmapUtils.DetectFormat(ImageData); }
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))); }