public static Bitmap screenshot(this Window window) { var left = window.windowRectangle().left; var top = window.windowRectangle().top; var right = window.windowRectangle().right; var bottom = window.windowRectangle().bottom; return(API_Cropper.captureSta(left, top, right - left, bottom - top)); }
public static Bitmap desktop <T>(this T control) where T : Control { return((Bitmap)control.invokeOnThread( () => { var cropper = new API_Cropper(); return cropper.capture_Desktop(); })); }
public static Bitmap capture <T>(this T control, int x, int y, int width, int height) where T : Control { return((Bitmap)control.invokeOnThread( () => { var cropper = new API_Cropper(); return cropper.capture(x, y, width, height); })); }
public static Bitmap capture_Desktop(this API_Cropper cropper) { return((Bitmap)cropper.invokeOnThread( () => { cropper.toClipboard(); cropper.CropperImageCapture.CaptureDesktop(); return cropper.fromClipboardGetImage(); })); }
public static Bitmap capture <T>(this API_Cropper cropper, T control) where T : Control { return((Bitmap)control.invokeOnThread( () => { var location = control.PointToScreen(Point.Empty); return cropper.capture(location.X, location.Y, control.Width, control.Height); })); }
//static for the cases where we have no live Control to get the STA thread from public static Bitmap captureSta(int x, int y, int width, int height) { Bitmap bitmap = null; var sync = new AutoResetEvent(false); O2Thread.staThread( () => { bitmap = new API_Cropper().capture(x, y, width, height); sync.Set(); }); sync.WaitOne(); return(bitmap); }
public static string video(this List <Bitmap> bitmaps) { var timeline = API_Cropper.timeline(); var videoTrack = timeline.add_VideoTrack(); foreach (var bitmap in bitmaps) { var file = bitmap.jpg(); //"file_: {0}".info(file); videoTrack.add_Image(file); //videoTrack.add_Image(bitmap); } return(timeline.renderVideo()); }
public API_AForge_Video() { VideoCodec = "WMV3 "; //use DIB for no compression // to use WMV3 Codec (I think) it is required to install this // http://www.microsoft.com/downloads/details.aspx?FamilyID=0c99c648-5800-4aa3-a2fe-3de948689db8&Displ FrameRate = 2; VideoWidth = 640; VideoHeight = 480; Cropper = new API_Cropper(); Desktop_Capture_Top = 0; Desktop_Capture_Left = 0; Desktop_Capture_Width = 800; Desktop_Capture_Height = 600; FrameCaptureDelay = 25; CapturingImages = false; AddDuplicateFrames = false; checkInstallation(); //start(); }
public static Bitmap capture(this API_Cropper cropper, int x, int y, int width, int height) { return((Bitmap)cropper.invokeOnThread( () => { //"__current ApartmentState: {0}".info(System.Threading.Thread.CurrentThread.GetApartmentState()); try { cropper.toClipboard(); cropper.captureComplete.Reset(); cropper.CropperImageCapture.Capture(x, y, width, height); cropper.waitForCapture(); return cropper.LastImage; //return cropper.fromClipboardGetImage(); } catch (Exception ex) { ex.log("in API_Cropper capture"); return null; } })); }
public static API_Cropper includeMouse(this API_Cropper cropper) { cropper.config().IncludeMouseCursorInCapture = true; return(cropper); }
public static API_Cropper toClipboard(this API_Cropper cropper) { cropper.CropperImageCapture.ImageFormat = ImageCapture.ImageOutputs["Clipboard"]; return(cropper); }
public static API_Cropper showConfig(this API_Cropper cropper) { cropper.invokeOnThread(() => show.info(Configuration.Current)); return(cropper); }
public static Settings settings(this API_Cropper cropper) { return(Configuration.Current); }
public static Settings config(this API_Cropper cropper) { return(cropper.settings()); }