private void toolStripButtonRecord_Click(object sender, EventArgs e) { if (is_recording == false) { saveFileDialog1.Filter = "avi file|*.avi"; saveFileDialog1.Title = "Save Video File"; saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveFileDialog1.FileName = "video_grab_" + System.DateTime.Today.Month.ToString() + "-" + System.DateTime.Today.Day.ToString() + "-" + System.DateTime.Today.Year.ToString(); saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != "") { // frame_rate = (float) m_imageProvider.get_floatParam("ResultingFrameRateAbs"); frame_rate = (float)1 / ((float)my_trigger.Period / (float)1000.0); Console.WriteLine(frame_rate); uint temp = ((uint)(frame_rate * 333333)); aw.Open(saveFileDialog1.FileName, ((uint)(temp)), (int)m_imageProvider.get_integerParam("Width"), (int)m_imageProvider.get_integerParam("Height")); is_recording = true; toolStripButtonRecord.BackColor = System.Drawing.SystemColors.GradientActiveCaption; // cmdRecord.BackColor = System.Drawing.SystemColors.GradientActiveCaption; // this.cmdRecord.UseVisualStyleBackColor = false; } } else { is_recording = false; aw.Close(); toolStripButtonRecord.BackColor = System.Drawing.SystemColors.Control; // cmdRecord.BackColor = System.Drawing.SystemColors.Control; // this.cmdRecord.UseVisualStyleBackColor = true; } }
private static void Main(string[] args) { var firstFrame = CaptureScreen(null); var aviWriter = new AviWriter(); var bitmap = aviWriter.Open("test.avi", 10, firstFrame.Width, firstFrame.Height); for (var i = 0; i < 25*5; i++) { CaptureScreen(bitmap); aviWriter.AddFrame(); } aviWriter.Close(); }
public static void Main() { try { Color[] palette = new Color[50]; for (int i = 0; i < 50; i++) { palette[i] = Color.FromArgb(i * 4, 255 - i * 4, 50 + i * 2); } int w = 600; int h = 600; AviWriter aw = new AviWriter(); Bitmap bmp = aw.Open("test.avi", 25, w, h); double f = 1.2; double centerX = -0.7454333; double centerY = -0.1130211; double pctAreaNewImage = 0.9; double endWidth_times_2 = 0.0001; while (f > endWidth_times_2) { MandelBrot.CalcMandelBrot( bmp, centerX - f, centerY - f, centerX + f, centerY + f, palette); f = Math.Sqrt(pctAreaNewImage * f * f); aw.AddFrame(); Console.Write("."); } aw.Close(); } catch (AviWriter.AviException e) { Console.WriteLine("AVI Exception in: " + e.ToString()); } }
/// <summary> /// Starts rendering in a thread. Each StartAsync() call *must* be balanced /// by a Dispose() call or bad things will happen. /// </summary> public void StartAsync() { System.Diagnostics.Debug.Assert(mAviWriter == null); System.Diagnostics.Debug.Assert(mThread == null); if (mThread != null) { return; // for sanity } mAddFrameFunc = doAddFrame; if (mDestFilename != null) { mAviWriter = new AviWriter(); mAviBmp = mAviWriter.Open(mDestFilename, (uint)mFps, mMovieSx, mMovieSy); } else { mAviBmp = new Bitmap(mMovieSx, mMovieSy); } mThreadMustStop = false; mThread = new Thread(threadEntryPoint); mThread.Start(); }