←Select platform

SaveStillBitmap Method (PlayCtrl)

Summary

Saves a snapshot from the running stream to a file as a bitmap.

Syntax

C#
VB
C++
public virtual void SaveStillBitmap(  
   string fileName, 
   Leadtools.Multimedia.StillFormatType format, 
   int quality, 
   int flags, 
   int timeOut 
) 
Public Overridable Sub SaveStillBitmap( _ 
   ByVal fileName As String, _ 
   ByVal format As Leadtools.Multimedia.StillFormatType, _ 
   ByVal quality As Integer, _ 
   ByVal flags As Integer, _ 
   ByVal timeOut As Integer _ 
)  
public: 
virtual void SaveStillBitmap(  
   String^ fileName, 
   Leadtools.Multimedia.StillFormatType format, 
   int quality, 
   int flags, 
   int timeOut 
)  

Parameters

fileName
A string containing the name of the file in which to save the bitmap.

format
A StillFormatType enumeration value that represents the output file format.

quality
Value that represents the compression quality. For a list of possible values, refer to Compression Quality Factors. If and only if the StillFormatType parameter is equal to StillFormatType.CMP, you can use theStillQuality enumeration values .

flags
Reserved for future use. Pass 0.

timeOut
The timeout period in milliseconds. The method will fail if it was not able to take a sample in the specified time. Use -1 to wait indefinitely until a sample is snapped.

Remarks

This method blocks (does not return) until the timeout occurs or the sample is snapped. The following methods can also be used to obtain still images:

Example

C#
VB
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
public bool _result = false; 
public PlayCtrlForm _form = new PlayCtrlForm(); 
public PlayCtrl _playctrl = null; 
public string _bmpFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SaveStillBitmap.bmp"); 
 
public void SaveStillBitmapExample() 
{ 
   // input and output file names 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ShortSource.avi"); 
 
   try 
   { 
      // reference the convert control 
      _playctrl = _form.PlayCtrl; 
 
      // set a timer on the form to make the still bitmap 
      _form.TestTimer.Interval = 5000; 
      _form.TestTimer.Tick += new EventHandler(SaveStillBitmap_Helper); 
 
      // add an effects processor for playback 
      _playctrl.SelectedVideoProcessors.Add(_playctrl.VideoProcessors.EFXDizzy); 
 
      // set the still tap location to Processors so that we get 
      // our effect applied to the still image -- you could of course 
      // set the tap to Source to capture the still without the applied effect  
      _playctrl.StillTap = PlayStillTap.Processors; 
 
      // set the source and target files 
      _playctrl.SourceFile = inFile; 
 
      // now start the test timer for the still capture 
      _form.TestTimer.Start(); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
 
   // we'll loop on the state and pump messages for this example. 
   // but you should not need to if running from a Windows Forms application. 
   while (_playctrl.State == PlayState.Running) 
      Application.DoEvents(); 
} 
 
public void SaveStillBitmap_Helper(object sender, EventArgs e) 
{ 
   // cancel the timer 
   _form.TestTimer.Stop(); 
 
   // try to simulate an error condition 
   _playctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1); 
 
   // check for the capture file and set the result 
   if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile))) 
      _result = true; 
 
   _playctrl.Stop(); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"; 
} 
Imports Leadtools 
Imports Leadtools.Multimedia 
Imports LeadtoolsMultimediaExamples.Fixtures 
 
Public _result As Boolean = False 
Public _form As PlayCtrlForm = New PlayCtrlForm() 
Public _playctrl As PlayCtrl = Nothing 
Public _bmpFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SaveStillBitmap.bmp") 
 
Public Sub SaveStillBitmapExample() 
   ' input and output file names 
   Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ShortSource.avi") 
 
   Try 
      ' reference the convert control 
      _playctrl = _form.PlayCtrl 
 
      ' set a timer on the form to make the still bitmap 
      _form.TestTimer.Interval = 5000 
      AddHandler _form.TestTimer.Tick, AddressOf SaveStillBitmap_Helper 
 
      ' add an effects processor for playback 
      _playctrl.SelectedVideoProcessors.Add(_playctrl.VideoProcessors.EFXDizzy) 
 
      ' set the still tap location to Processors so that we get 
      ' our effect applied to the still image -- you could of course 
      ' set the tap to Source to capture the still without the applied effect  
      _playctrl.StillTap = PlayStillTap.Processors 
 
      ' set the source and target files 
      _playctrl.SourceFile = inFile 
 
      ' now start the test timer for the still capture 
      _form.TestTimer.Start() 
   Catch e1 As Exception 
      _result = False 
   End Try 
 
   ' we'll loop on the state and pump messages for this example. 
   ' but you should not need to if running from a Windows Forms application. 
   Do While _playctrl.State = PlayState.Running 
      Application.DoEvents() 
   Loop 
End Sub 
 
Public Sub SaveStillBitmap_Helper(ByVal sender As Object, ByVal e As EventArgs) 
   ' cancel the timer 
   _form.TestTimer.Stop() 
 
   ' try to simulate an error condition 
   _playctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1) 
 
   ' check for the capture file and set the result 
   If File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile)) Then 
      _result = True 
   End If 
 
   _playctrl.Stop() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media" 
End Class 
C#
VB
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
public bool _result = false; 
public PlayCtrlForm _form = new PlayCtrlForm(); 
public PlayCtrl _playctrl = null; 
public string _bmpFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SaveStillBitmap.bmp"); 
 
public void SaveStillBitmapExample() 
{ 
   // input and output file names 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ShortSource.avi"); 
 
   try 
   { 
      // reference the convert control 
      _playctrl = _form.PlayCtrl; 
 
      // set a timer on the form to make the still bitmap 
      _form.TestTimer.Interval = 5000; 
      _form.TestTimer.Tick += new EventHandler(SaveStillBitmap_Helper); 
 
      // add an effects processor for playback 
      _playctrl.SelectedVideoProcessors.Add(_playctrl.VideoProcessors.EFXDizzy); 
 
      // set the still tap location to Processors so that we get 
      // our effect applied to the still image -- you could of course 
      // set the tap to Source to capture the still without the applied effect  
      _playctrl.StillTap = PlayStillTap.Processors; 
 
      // set the source and target files 
      _playctrl.SourceFile = inFile; 
 
      // now start the test timer for the still capture 
      _form.TestTimer.Start(); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
 
   // we'll loop on the state and pump messages for this example. 
   // but you should not need to if running from a Windows Forms application. 
   while (_playctrl.State == PlayState.Running) 
      Application.DoEvents(); 
} 
 
public void SaveStillBitmap_Helper(object sender, EventArgs e) 
{ 
   // cancel the timer 
   _form.TestTimer.Stop(); 
 
   // try to simulate an error condition 
   _playctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1); 
 
   // check for the capture file and set the result 
   if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile))) 
      _result = true; 
 
   _playctrl.Stop(); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"; 
} 
Imports Leadtools 
Imports Leadtools.Multimedia 
Imports LeadtoolsMultimediaExamples.Fixtures 
 
Public _result As Boolean = False 
Public _form As PlayCtrlForm = New PlayCtrlForm() 
Public _playctrl As PlayCtrl = Nothing 
Public _bmpFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SaveStillBitmap.bmp") 
 
Public Sub SaveStillBitmapExample() 
   ' input and output file names 
   Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ShortSource.avi") 
 
   Try 
      ' reference the convert control 
      _playctrl = _form.PlayCtrl 
 
      ' set a timer on the form to make the still bitmap 
      _form.TestTimer.Interval = 5000 
      AddHandler _form.TestTimer.Tick, AddressOf SaveStillBitmap_Helper 
 
      ' add an effects processor for playback 
      _playctrl.SelectedVideoProcessors.Add(_playctrl.VideoProcessors.EFXDizzy) 
 
      ' set the still tap location to Processors so that we get 
      ' our effect applied to the still image -- you could of course 
      ' set the tap to Source to capture the still without the applied effect  
      _playctrl.StillTap = PlayStillTap.Processors 
 
      ' set the source and target files 
      _playctrl.SourceFile = inFile 
 
      ' now start the test timer for the still capture 
      _form.TestTimer.Start() 
   Catch e1 As Exception 
      _result = False 
   End Try 
 
   ' we'll loop on the state and pump messages for this example. 
   ' but you should not need to if running from a Windows Forms application. 
   Do While _playctrl.State = PlayState.Running 
      Application.DoEvents() 
   Loop 
End Sub 
 
Public Sub SaveStillBitmap_Helper(ByVal sender As Object, ByVal e As EventArgs) 
   ' cancel the timer 
   _form.TestTimer.Stop() 
 
   ' try to simulate an error condition 
   _playctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1) 
 
   ' check for the capture file and set the result 
   If File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile)) Then 
      _result = True 
   End If 
 
   _playctrl.Stop() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media" 
End Class 

Requirements

Target Platforms

See Also

Reference

PlayCtrl Class

PlayCtrl Members

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Multimedia Assembly
Click or drag to resize