public void AddFrame(Bitmap bmp)
{
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
BitmapData bmpDat = bmp.LockBits(
new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
if (countFrames == 0)
{
this.stride = (UInt32)bmpDat.Stride;
this.width = bmp.Width;
this.height = bmp.Height;
CreateStream();
}
int result = AviReadingMethods.AVIStreamWrite(aviStream,
countFrames, 1,
bmpDat.Scan0,
(Int32)(stride * height),
0, 0, 0);
if (result != 0)
{
throw new Exception("Problem podczas otwierania pliku AVI" + result.ToString());
}
bmp.UnlockBits(bmpDat);
countFrames++;
}