private void RetrieveFrameMetadata(DesktopFrame frame) { if (frameInfo.TotalMetadataBufferSize > 0) { // Get moved regions int movedRegionsLength = 0; OutputDuplicateMoveRectangle[] movedRectangles = new OutputDuplicateMoveRectangle[frameInfo.TotalMetadataBufferSize]; mDeskDupl.GetFrameMoveRects(movedRectangles.Length, movedRectangles, out movedRegionsLength); frame.MovedRegions = new MovedRegion[movedRegionsLength / Marshal.SizeOf(typeof(OutputDuplicateMoveRectangle))]; for (int i = 0; i < frame.MovedRegions.Length; i++) { frame.MovedRegions[i] = new MovedRegion() { Source = new System.Drawing.Point(movedRectangles[i].SourcePoint.X, movedRectangles[i].SourcePoint.Y), Destination = new System.Drawing.Rectangle(movedRectangles[i].DestinationRect.Left, movedRectangles[i].DestinationRect.Top, movedRectangles[i].DestinationRect.Width(), movedRectangles[i].DestinationRect.Height()) }; } // Get dirty regions int dirtyRegionsLength = 0; Rectangle[] dirtyRectangles = new Rectangle[frameInfo.TotalMetadataBufferSize]; mDeskDupl.GetFrameDirtyRects(dirtyRectangles.Length, dirtyRectangles, out dirtyRegionsLength); frame.UpdatedRegions = new System.Drawing.Rectangle[dirtyRegionsLength / Marshal.SizeOf(typeof(Rectangle))]; for (int i = 0; i < frame.UpdatedRegions.Length; i++) { frame.UpdatedRegions[i] = new System.Drawing.Rectangle(dirtyRectangles[i].Left, dirtyRectangles[i].Top, dirtyRectangles[i].Width(), dirtyRectangles[i].Height()); } } else { frame.MovedRegions = new MovedRegion[0]; frame.UpdatedRegions = new System.Drawing.Rectangle[0]; } }
private Texture2D PlatformGetTexture() { // This will return a null texture if // the video hasn't started playing yet // or the last frame if the video is stopped // as per XNA's behavior. if (_state != MediaState.Playing) { return(_lastFrame); } long pts; if (!_mediaEngine.HasVideo() || !_mediaEngine.OnVideoStreamTick(out pts)) { return(_lastFrame); } _lastFrame = new Texture2D(Game.Instance.GraphicsDevice, _currentVideo.Width, _currentVideo.Height, false, SurfaceFormat.Bgra32, Texture2D.SurfaceType.RenderTarget); var region = new SharpDX.Mathematics.Interop.RawRectangle(0, 0, _currentVideo.Width, _currentVideo.Height); _mediaEngine.TransferVideoFrame(_lastFrame.GetTexture(), null, region, null); return(_lastFrame); }
private Texture2D PlatformGetTexture() { // This will return a null texture if // the video hasn't started playing yet // or the last frame if the video is stopped // as per XNA's behavior. if (_state != MediaState.Playing) return _lastFrame; long pts; if (!_mediaEngine.HasVideo() || !_mediaEngine.OnVideoStreamTick(out pts)) return _lastFrame; _lastFrame = new Texture2D(Game.Instance.GraphicsDevice, _currentVideo.Width, _currentVideo.Height, false, SurfaceFormat.Bgra32, Texture2D.SurfaceType.RenderTarget); #if WINDOWS_UAP var region = new SharpDX.Mathematics.Interop.RawRectangle(0, 0, _currentVideo.Width, _currentVideo.Height); #else var region = new SharpDX.Rectangle(0, 0, _currentVideo.Width, _currentVideo.Height); #endif _mediaEngine.TransferVideoFrame(_lastFrame._texture, null, region, null); return _lastFrame; }
public virtual void OnRender() { lock (lockObject) { if (isVideoStopped) { return; } if (mediaEngineEx != null) { long pts; if (mediaEngineEx.OnVideoStreamTick(out pts)) { if (OutputVideoTexture != null) { var desc = OutputVideoTexture.Description; var dxgiSurface = OutputVideoTexture.QueryInterface <SharpDX.DXGI.Surface>(); var region = new SharpDX.Mathematics.Interop.RawRectangle(0, 0, desc.Width, desc.Height); try { // Blit the frame to the supplied rendertarget mediaEngineEx.TransferVideoFrame(dxgiSurface, null, region, null); } catch (Exception) { // This exception can be worked around by using DirectX 9 only (see configuration) Debug.WriteLine("Exception during TransferVideoFrame"); } } } } } }
public DrawTextureAndCatchIt(SharpDX.Direct3D9.Texture _texOut, SharpDX.Direct3D9.Texture _texIn, SharpDX.Mathematics.Interop.RawRectangle _rectangle, SharpDX.Vector3 _pos) { texOut = _texOut; texIn = _texIn; rectangle = _rectangle; pos = _pos; }
public static int GetHeight(this Rectangle rect) { return(rect.Bottom - rect.Top); }
public static int GetWidth(this Rectangle rect) { return(rect.Right - rect.Left); }
public static unsafe int Calliint116(void *thisObject, int arg0, SharpDX.Mathematics.Interop.RawRectangle arg1, void *arg2, void *methodPtr) { throw new NotImplementedException(); }
public static int Width(this Rectangle rectangle) { return(rectangle.Right - rectangle.Left); }
public static int Height(this Rectangle rectangle) { return(rectangle.Bottom - rectangle.Top); }
public DUIRectangle(System.Drawing.Rectangle rectangle) { this.rectangle = rectangle; this.dxRectangle = new SharpDX.Mathematics.Interop.RawRectangle(this.rectangle.Left, this.rectangle.Top, this.rectangle.Right, this.rectangle.Bottom); }
public static unsafe int CalliStdCallint0(void *thisObject, SharpDX.Mathematics.Interop.RawRectangle param0, void *methodPtr) { throw null; }
// Method to marshal from native to managed struct internal unsafe void __MarshalFrom(ref __Native @ref) { fixed (char* __ptr = &@ref.ImagePath) this.ImagePath = SharpDX.Utilities.PtrToStringUni((IntPtr)__ptr, 260); this.Flags = @ref.Flags; this.ViewID = @ref.ViewID; this.RcOverlay = @ref.RcOverlay; this.ObjID = @ref.ObjID; this.ValidPts = @ref.ValidPts; fixed (void* __to = &this.RgptCalloutLine[0]) fixed (void* __from = &@ref.RgptCalloutLine) SharpDX.Utilities.CopyMemory((IntPtr) __to, (IntPtr) __from, 5*sizeof ( SharpDX.Mathematics.Interop.RawPoint)); this.RcCalloutRect = @ref.RcCalloutRect; this.TextAlign = @ref.TextAlign; }
/// <summary> /// <p>Returns information about the placement and orientation of a glyph in a character cell.</p> /// </summary> /// <param name="glyph"><dd> <p>Glyph identifier.</p> </dd></param> /// <param name="textureOut"><dd> <p>Address of a reference to a <strong><see cref="SharpDX.Direct3D9.Texture"/></strong> object that contains the glyph.</p> </dd></param> /// <param name="blackBoxRef"><dd> <p>Pointer to the smallest rectangle object that completely encloses the glyph.</p> </dd></param> /// <param name="cellIncRef"><dd> <p>Pointer to the two-dimensional vector that connects the origin of the current character cell to the origin of the next character cell. See <strong><see cref="SharpDX.Mathematics.Interop.RawPoint"/></strong>.</p> </dd></param> /// <returns><p>If the method succeeds, the return value is <see cref="SharpDX.Result.Ok"/>. If the method fails, the return value can be one of the following: <see cref="SharpDX.Direct3D9.ResultCode.InvalidCall"/>, D3DXERR_INVALIDDATA.</p></returns> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID3DXFont::GetGlyphData']/*"/> /// <msdn-id>bb173966</msdn-id> /// <unmanaged>HRESULT ID3DXFont::GetGlyphData([In] unsigned int Glyph,[Out] IDirect3DTexture9** ppTexture,[Out] RECT* pBlackBox,[Out] POINT* pCellInc)</unmanaged> /// <unmanaged-short>ID3DXFont::GetGlyphData</unmanaged-short> public void GetGlyphData(int glyph, out SharpDX.Direct3D9.Texture textureOut, out SharpDX.Mathematics.Interop.RawRectangle blackBoxRef, out SharpDX.Mathematics.Interop.RawPoint cellIncRef) { unsafe { IntPtr textureOut_ = IntPtr.Zero; blackBoxRef = new SharpDX.Mathematics.Interop.RawRectangle(); cellIncRef = new SharpDX.Mathematics.Interop.RawPoint(); SharpDX.Result __result__; fixed (void* blackBoxRef_ = &blackBoxRef) fixed (void* cellIncRef_ = &cellIncRef) __result__= SharpDX.Direct3D9.LocalInterop.Calliint(_nativePointer, glyph, &textureOut_, blackBoxRef_, cellIncRef_,((void**)(*(void**)_nativePointer))[9]); textureOut= (textureOut_ == IntPtr.Zero)?null:new SharpDX.Direct3D9.Texture(textureOut_); __result__.CheckError(); } }
/// <summary> /// <p>Gets the scissor rectangle.</p> /// </summary> /// <param name="rectRef"><dd> <p>Returns a reference to a <strong><see cref="SharpDX.Mathematics.Interop.RawRectangle"/></strong> structure that defines the rendering area within the render target if scissor test is enabled.</p> </dd></param> /// <returns><p>If the method succeeds, the return value is <see cref="SharpDX.Direct3D9.ResultCode.Success"/>. If the method fails, the return value can be the following: <see cref="SharpDX.Direct3D9.ResultCode.InvalidCall"/>.</p></returns> /// <remarks> /// <p>The scissor rectangle is used as a rectangular clipping region.</p><p>See Rectangles (Direct3D 9) for further information on the use of rectangles in DirectX.</p> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='IDirect3DDevice9::GetScissorRect']/*"/> /// <msdn-id>bb174407</msdn-id> /// <unmanaged>HRESULT IDirect3DDevice9::GetScissorRect([Out] RECT* pRect)</unmanaged> /// <unmanaged-short>IDirect3DDevice9::GetScissorRect</unmanaged-short> internal void GetScissorRect(out SharpDX.Mathematics.Interop.RawRectangle rectRef) { unsafe { rectRef = new SharpDX.Mathematics.Interop.RawRectangle(); SharpDX.Result __result__; fixed (void* rectRef_ = &rectRef) __result__= SharpDX.Direct3D9.LocalInterop.Calliint(_nativePointer, rectRef_,((void**)(*(void**)_nativePointer))[76]); __result__.CheckError(); } }