public void WriteApng(string path, bool firstFrameHidden, bool disposeAfter) { Size maxSize = new Size(); foreach (SharpApngFrame frame in m_frames) { if (frame.Bitmap.Width > maxSize.Width) { maxSize.Width = frame.Bitmap.Width; } if (frame.Bitmap.Height > maxSize.Height) { maxSize.Height = frame.Bitmap.Height; } } for (int i = 0; i < m_frames.Count; i++) { SharpApngFrame frame = m_frames[i]; if (frame.Bitmap.Width != maxSize.Width || frame.Bitmap.Height != maxSize.Height) { frame.Bitmap = ExtendImage(frame.Bitmap, maxSize); } SharpApngBasicWrapper.CreateFrameManaged(frame.Bitmap, frame.DelayNum, frame.DelayDen, i); } SharpApngBasicWrapper.SaveApngManaged(path, m_frames.Count, maxSize.Width, maxSize.Height, firstFrameHidden); if (disposeAfter) { Dispose(); } }
public void AddFrame(SharpApngFrame frame) { m_frames.Add(frame); }