Ejemplo n.º 1
0
        /// <summary>
        /// Locks a rectangle on a texture resource.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="flags">The flags.</param>
        /// <returns>
        /// A <see cref="DataRectangle"/> describing the region locked.
        /// </returns>
        /// <unmanaged>HRESULT IDirect3DTexture9::LockRect([In] unsigned int Level,[Out] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
        public DataRectangle LockRectangle(int level, SharpDX.Direct3D9.LockFlags flags)
        {
            LockedRectangle lockedRect;

            LockRectangle(level, out lockedRect, IntPtr.Zero, flags);
            return(new DataRectangle(lockedRect.PBits, lockedRect.Pitch));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Locks a box on a volume texture resource.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="flags">The flags.</param>
        /// <returns>
        /// A <see cref="DataBox"/> describing the region locked.
        /// </returns>
        /// <unmanaged>HRESULT IDirect3DVolumeTexture9::LockBox([In] unsigned int Level,[Out] D3DLOCKED_BOX* pLockedVolume,[In] const void* pBox,[In] D3DLOCK Flags)</unmanaged>
        public DataBox LockBox(int level, SharpDX.Direct3D9.LockFlags flags)
        {
            LockedBox lockedRect;

            LockBox(level, out lockedRect, IntPtr.Zero, flags);
            return(new DataBox(lockedRect.PBits, lockedRect.RowPitch, lockedRect.SlicePitch));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Locks a rectangle on a texture resource.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="stream">The stream pointing to the locked region.</param>
        /// <returns>
        /// A <see cref="DataRectangle"/> describing the region locked.
        /// </returns>
        /// <unmanaged>HRESULT IDirect3DTexture9::LockRect([In] unsigned int Level,[Out] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
        public DataRectangle LockRectangle(int level, SharpDX.Direct3D9.LockFlags flags, out DataStream stream)
        {
            LockedRectangle lockedRect;

            LockRectangle(level, out lockedRect, IntPtr.Zero, flags);
            stream = new DataStream(lockedRect.PBits, lockedRect.Pitch * GetLevelDescription(level).Height, true, (flags & LockFlags.ReadOnly) == 0);
            return(new DataRectangle(lockedRect.PBits, lockedRect.Pitch));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Locks a box on a volume texture resource.
 /// </summary>
 /// <param name="level">The level.</param>
 /// <param name="box">The box.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// A <see cref="DataRectangle"/> describing the region locked.
 /// </returns>
 /// <unmanaged>HRESULT IDirect3DVolumeTexture9::LockBox([In] unsigned int Level,[Out] D3DLOCKED_BOX* pLockedVolume,[In] const void* pBox,[In] D3DLOCK Flags)</unmanaged>
 public DataBox LockBox(int level, Box box, SharpDX.Direct3D9.LockFlags flags)
 {
     unsafe
     {
         LockedBox lockedRect;
         LockBox(level, out lockedRect, new IntPtr(&box), flags);
         return(new DataBox(lockedRect.PBits, lockedRect.RowPitch, lockedRect.SlicePitch));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Locks a rectangle on a texture resource.
 /// </summary>
 /// <param name="level">The level.</param>
 /// <param name="rectangle">The rectangle.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// A <see cref="DataRectangle"/> describing the region locked.
 /// </returns>
 /// <unmanaged>HRESULT IDirect3DTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
 public DataRectangle LockRectangle(int level, Rectangle rectangle, SharpDX.Direct3D9.LockFlags flags)
 {
     unsafe
     {
         LockedRectangle lockedRect;
         LockRectangle(level, out lockedRect, new IntPtr(&rectangle), flags);
         return(new DataRectangle(lockedRect.PBits, lockedRect.Pitch));
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Locks a range of vertex data and obtains a pointer to the vertex buffer memory.
        /// </summary>
        /// <remarks>
        ///  As a general rule, do not hold a lock across more than one frame. When working with vertex buffers, you are allowed to make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set vertex buffer. The D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE flags are valid only on buffers created with D3DUSAGE_DYNAMIC. For information about using D3DLOCK_DISCARD or D3DLOCK_NOOVERWRITE with IDirect3DVertexBuffer9::Lock, see {{Using Dynamic Vertex and Index Buffers}}.
        /// </remarks>
        /// <param name="offsetToLock"> Offset into the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock. </param>
        /// <param name="sizeToLock"> Size of the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock. </param>
        /// <param name="lockFlags"> Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:    D3DLOCK_DISCARD D3DLOCK_NO_DIRTY_UPDATE D3DLOCK_NOSYSLOCK D3DLOCK_READONLY D3DLOCK_NOOVERWRITE   For a description of the flags, see <see cref="SharpDX.Direct3D9.LockFlags"/>.  </param>
        /// <returns>A <see cref="SharpDX.DataStream"/> if the method succeeds.</returns>
        /// <msdn-id>bb205917</msdn-id>
        /// <unmanaged>HRESULT IDirect3DVertexBuffer9::Lock([In] unsigned int OffsetToLock,[In] unsigned int SizeToLock,[Out] void** ppbData,[In] D3DLOCK Flags)</unmanaged>
        /// <unmanaged-short>IDirect3DVertexBuffer9::Lock</unmanaged-short>
        public DataStream Lock(int offsetToLock, int sizeToLock, SharpDX.Direct3D9.LockFlags lockFlags)
        {
            IntPtr bufferPointer;

            Lock_(offsetToLock, sizeToLock, out bufferPointer, lockFlags);
            if (sizeToLock == 0)
            {
                sizeToLock = Description.SizeInBytes;
            }
            return(new DataStream(bufferPointer, sizeToLock, true, (lockFlags & LockFlags.ReadOnly) == 0));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Locks a range of vertex data and obtains a pointer to the vertex buffer memory.
        /// </summary>
        /// <remarks>
        ///  As a general rule, do not hold a lock across more than one frame. When working with vertex buffers, you are allowed to make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set vertex buffer. The D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE flags are valid only on buffers created with D3DUSAGE_DYNAMIC. For information about using D3DLOCK_DISCARD or D3DLOCK_NOOVERWRITE with IDirect3DVertexBuffer9::Lock, see {{Using Dynamic Vertex and Index Buffers}}.
        /// </remarks>
        /// <param name="offsetToLock"> Offset into the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock. </param>
        /// <param name="sizeToLock"> Size of the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock. </param>
        /// <param name="lockFlags"> Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:    D3DLOCK_DISCARD D3DLOCK_NO_DIRTY_UPDATE D3DLOCK_NOSYSLOCK D3DLOCK_READONLY D3DLOCK_NOOVERWRITE   For a description of the flags, see <see cref="SharpDX.Direct3D9.LockFlags"/>.  </param>
        /// <returns>A <see cref="System.IntPtr"/> if the method succeeds.</returns>
        /// <msdn-id>bb205917</msdn-id>
        /// <unmanaged>HRESULT IDirect3DVertexBuffer9::Lock([In] unsigned int OffsetToLock,[In] unsigned int SizeToLock,[Out] void** ppbData,[In] D3DLOCK Flags)</unmanaged>
        /// <unmanaged-short>IDirect3DVertexBuffer9::Lock</unmanaged-short>
        public IntPtr LockToPointer(int offsetToLock, int sizeToLock, SharpDX.Direct3D9.LockFlags lockFlags)
        {
            IntPtr bufferPointer;

            if (sizeToLock == 0)
            {
                sizeToLock = Description.SizeInBytes;
            }
            Lock_(offsetToLock, sizeToLock, out bufferPointer, lockFlags);
            return(bufferPointer);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Locks a rectangle on a cube texture resource.
 /// </summary>
 /// <param name="faceType">Type of the face.</param>
 /// <param name="level">The level.</param>
 /// <param name="rectangle">The rectangle.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="stream">The stream pointing to the locked region.</param>
 /// <returns>
 /// A <see cref="DataRectangle"/> describing the region locked.
 /// </returns>
 /// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
 public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, Rectangle rectangle, SharpDX.Direct3D9.LockFlags flags, out DataStream stream)
 {
     unsafe
     {
         LockedRectangle lockedRect;
         LockRectangle(faceType, level, out lockedRect, new IntPtr(&rectangle), flags);
         stream = new DataStream(lockedRect.PBits, lockedRect.Pitch * GetLevelDescription(level).Height, true, (flags & LockFlags.ReadOnly) == 0);
         return(new DataRectangle(lockedRect.PBits, lockedRect.Pitch));
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Locks a rectangle on a cube texture resource.
 /// </summary>
 /// <param name="faceType">Type of the face.</param>
 /// <param name="level">The level.</param>
 /// <param name="rectangle">The rectangle.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// A <see cref="DataRectangle"/> describing the region locked.
 /// </returns>
 /// <unmanaged>HRESULT IDirect3DCubeTexture9::LockRect([In] D3DCUBEMAP_FACES FaceType,[In] unsigned int Level,[In] D3DLOCKED_RECT* pLockedRect,[In] const void* pRect,[In] D3DLOCK Flags)</unmanaged>
 public DataRectangle LockRectangle(SharpDX.Direct3D9.CubeMapFace faceType, int level, RawRectangle rectangle, SharpDX.Direct3D9.LockFlags flags)
 {
     unsafe
     {
         LockedRectangle lockedRect;
         LockRectangle(faceType, level, out lockedRect, new IntPtr(&rectangle), flags);
         return(new DataRectangle(lockedRect.PBits, lockedRect.Pitch));
     }
 }