/// <summary> /// Returns an image from the Player.Copy.Mode part of the screen. See also: Player.Video.ToImage. /// </summary> public Image ToImage() { if (_cloneCopy && (_base._copyMode == CopyMode.Display || _base._copyMode == CopyMode.Video)) { return(_base.AV_DisplayCopy(_base._copyMode == CopyMode.Video, true)); } Bitmap memoryImage = null; if (_base._hasDisplay && (_base._hasVideo || _base._hasOverlayShown)) { Rectangle r; switch (_base._copyMode) { case CopyMode.Display: r = _base._display.RectangleToScreen(_base._display.DisplayRectangle); break; case CopyMode.Form: r = _base._display.FindForm().RectangleToScreen(_base._display.FindForm().DisplayRectangle); break; case CopyMode.Parent: r = _base._display.Parent.RectangleToScreen(_base._display.Parent.DisplayRectangle); break; case CopyMode.Screen: r = Screen.GetBounds(_base._display); break; default: // CopyMode.Video if (_base._hasVideo) { r = _base._display.RectangleToScreen(_base._videoBoundsClip); } else { r = _base._display.RectangleToScreen(_base._display.DisplayRectangle); } break; } try { memoryImage = new Bitmap(r.Width, r.Height); Graphics memoryGraphics = Graphics.FromImage(memoryImage); memoryGraphics.CopyFromScreen(r.Location.X, r.Location.Y, 0, 0, r.Size); memoryGraphics.Dispose(); _base._lastError = Player.NO_ERROR; } catch (Exception e) { if (memoryImage != null) { memoryImage.Dispose(); memoryImage = null; } _base._lastError = (HResult)Marshal.GetHRForException(e); } } else { _base._lastError = HResult.MF_E_NOT_AVAILABLE; } return(memoryImage); }
/// <summary> /// Returns a copy of the player's currently displayed video image (without display overlay). See also: Player.Copy.ToImage. /// </summary> public Image ToImage() { return(_base.AV_DisplayCopy(true, false)); }