public void DefineBitsLoseless() { var swf = new SwfMovie(); swf.SetDefaultBackgroundColor(); swf.SetFrameLabel("main"); var bmp = GetTestBitmap(); ushort cid = swf.DefineBitmap(bmp); swf.ShowFrame(); var ms = new MemoryStream(); swf.Save(ms); ms.Flush(); ms.Position = 0; var swf2 = new SwfMovie(ms); var bmp2 = swf2.GetBitmap(cid); Assert.IsTrue(bmp.IsEqual(bmp2, true)); }
public static void SaveSwf(SwfMovie swf, string name) { string dir = Path.Combine(Root, "swf"); Directory.CreateDirectory(dir); swf.Save(Path.Combine(dir, name)); }
static void RemoveExports(string path) { var swf = new SwfMovie(); swf.Load(path, SwfTagDecodeOptions.DonotDecodeTags); for (int i = 0; i < swf.Tags.Count; ++i) { var tag = swf.Tags[i]; if (tag.TagCode == SwfTagCode.ExportAssets) { swf.Tags.RemoveAt(i); --i; } } swf.Save(path + ".noexports.swf"); }