protected override Bitmap CreatePainting() { // Transform the original images to the fast and unsafe bitmaps we require List <UnsafeBitmap> unsafeOriginals = new List <UnsafeBitmap>(); foreach (Bitmap original in this.originals) { unsafeOriginals.Add(new UnsafeBitmap(new Bitmap(original))); } List <UnsafeBitmap> unsafeMovieIntroFrames = new List <UnsafeBitmap>(); if (this.introMovieFrames != null) { foreach (Bitmap originalIntroFrame in this.introMovieFrames) { unsafeMovieIntroFrames.Add(new UnsafeBitmap(new Bitmap(originalIntroFrame))); } } try { using (UnsafeBitmap unsafePainting = CompositeNativeMomentPainterWrapper.CreatePainting(width, height, unsafeOriginals.ToArray(), this.locations, BrushCollection.Instance.AvailableBrushes, this.windowSize, this.generateMovie, unsafeMovieIntroFrames.ToArray(), this.MovieFilename)) { unsafePainting.UnlockBitmap(); return(new Bitmap(unsafePainting.Bitmap)); } } finally { // We're done with the unsafe originals, free them up. This will also // dispose of the originals foreach (UnsafeBitmap unsafeOriginal in unsafeOriginals) { unsafeOriginal.Dispose(); } // Dispose of the unsafe movie title frame, if it was created foreach (UnsafeBitmap unsafeIntroFrame in unsafeMovieIntroFrames) { unsafeIntroFrame.Dispose(); } // The originals were disposed of when the unsafe wrappers were // disposed of. So, simply null out this collection. this.originals = null; } }
public override int GetPercentComplete() { return(CompositeNativeMomentPainterWrapper.GetPercentComplete()); }