AnimatGuiCtrls.Video.VideoStream.Initialize C# (CSharp) Method

Initialize() private method

Initialize a new VideoStream
Used only by constructors
private Initialize ( int aviFile, bool writeCompressed, double frameRate, Bitmap firstFrameBitmap ) : void
aviFile int The file that contains the stream
writeCompressed bool true: create a compressed stream before adding frames
frameRate double Frames per second
firstFrameBitmap System.Drawing.Bitmap
return void
        private void Initialize(int aviFile, bool writeCompressed, double frameRate, Bitmap firstFrameBitmap)
        {
            this.aviFile = aviFile;
            this.writeCompressed = writeCompressed;
            this.frameRate = frameRate;
            this.firstFrame = 0;

            BitmapData bmpData = firstFrameBitmap.LockBits(new Rectangle(
                0, 0, firstFrameBitmap.Width, firstFrameBitmap.Height),
                ImageLockMode.ReadOnly, firstFrameBitmap.PixelFormat);

            this.frameSize = bmpData.Stride * bmpData.Height;
            this.width = firstFrameBitmap.Width;
            this.height = firstFrameBitmap.Height;
            this.countBitsPerPixel = ConvertPixelFormatToBitCount(firstFrameBitmap.PixelFormat);

            firstFrameBitmap.UnlockBits(bmpData);
        }