public void Bind(D3D9.Device dev, D3D9.Volume volume, D3D9.BaseTexture mipTex)
        {
            //Entering critical section
            LockDeviceAccess();

            var bufferResources = GetBufferResources(dev);
            var isNewBuffer     = false;

            if (bufferResources == null)
            {
                bufferResources = new BufferResources();
                this.mapDeviceToBufferResources.Add(dev, bufferResources);
                isNewBuffer = true;
            }

            bufferResources.MipTex = mipTex;
            bufferResources.Volume = volume;

            var desc = volume.Description;

            width  = desc.Width;
            height = desc.Height;
            depth  = desc.Depth;
            format = D3D9Helper.ConvertEnum(desc.Format);
            // Default
            rowPitch    = Width;
            slicePitch  = Height * Width;
            sizeInBytes = PixelUtil.GetMemorySize(Width, Height, Depth, Format);

            if (isNewBuffer && this.ownerTexture.IsManuallyLoaded)
            {
                foreach (var it in this.mapDeviceToBufferResources)
                {
                    if (it.Value != bufferResources && it.Value.Volume != null && it.Key.TestCooperativeLevel().Success&&
                        dev.TestCooperativeLevel().Success)
                    {
                        var fullBufferBox = new BasicBox(0, 0, 0, Width, Height, Depth);
                        var dstBox        = new PixelBox(fullBufferBox, Format);

                        var data = new byte[sizeInBytes];
                        using (var d = BufferBase.Wrap(data))
                        {
                            dstBox.Data = d;
                            BlitToMemory(fullBufferBox, dstBox, it.Value, it.Key);
                            BlitFromMemory(dstBox, fullBufferBox, bufferResources);
                            Array.Clear(data, 0, sizeInBytes);
                        }
                        break;
                    }
                }
            }

            //Leaving critical section
            UnlockDeviceAccess();
        }
            protected override void dispose(bool disposeManagedResources)
            {
                if (!IsDisposed)
                {
                    if (disposeManagedResources)
                    {
                        this.Surface.SafeDispose();
                        this.Surface = null;

                        this.Volume.SafeDispose();
                        this.Volume = null;
                    }
                }

                base.dispose(disposeManagedResources);
            }
Exemple #3
0
 /// <summary>
 /// Loads a volume from a source volume.
 /// </summary>
 /// <param name="destinationVolume">The destination volume.</param>
 /// <param name="sourceVolume">The source volume.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromVolume([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey)</unmanaged>
 public static void FromVolume(Volume destinationVolume, Volume sourceVolume, Filter filter, int colorKey, Box sourceBox, Box destinationBox)
 {
     FromVolume(destinationVolume, sourceVolume, filter, colorKey, sourceBox, destinationBox, null, null);
 }
Exemple #4
0
 /// <summary>
 /// Loads a volume from a source volume.
 /// </summary>
 /// <param name="destinationVolume">The destination volume.</param>
 /// <param name="sourceVolume">The source volume.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromVolume([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey)</unmanaged>
 public static void FromVolume(Volume destinationVolume, Volume sourceVolume, Filter filter, int colorKey)
 {
     D3DX9.LoadVolumeFromVolume(destinationVolume, null, IntPtr.Zero, sourceVolume, null, IntPtr.Zero, filter, colorKey);
 }
Exemple #5
0
 /// <summary>
 /// Loads a volume from a file on the disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileW([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] const wchar_t* pSrcFile,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey,[In] D3DXIMAGE_INFO* pSrcInfo)</unmanaged>
 public static void FromFile(Volume volume, string fileName, Filter filter, int colorKey, Box sourceBox, Box destinationBox)
 {
     unsafe
     {
         D3DX9.LoadVolumeFromFileW(volume, null, new IntPtr(&destinationBox), fileName, new IntPtr(&sourceBox), filter, colorKey, IntPtr.Zero);
     }
 }
Exemple #6
0
 /// <summary>
 /// Saves a volume to a <see cref="DataStream"/>. 
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="format">The format.</param>
 /// <param name="box">The box.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileInMemory([In] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In, Buffer] const PALETTEENTRY* pSrcPalette,[In] const void* pSrcBox)</unmanaged>
 public static DataStream ToStream(Volume volume, ImageFileFormat format, Box box, PaletteEntry[] palette)
 {
     unsafe
     {
         Blob blob;
         D3DX9.SaveVolumeToFileInMemory(out blob, format, volume, palette, new IntPtr(&box));
         return new DataStream(blob);
     }
 }
Exemple #7
0
 /// <summary>
 /// Saves a volume to a <see cref="DataStream"/>.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="format">The format.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileInMemory([In] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In, Buffer] const PALETTEENTRY* pSrcPalette,[In] const void* pSrcBox)</unmanaged>
 public static DataStream ToStream(Volume volume, ImageFileFormat format)
 {
     Blob blob;
     D3DX9.SaveVolumeToFileInMemory(out blob, format, volume, null, IntPtr.Zero);
     return new DataStream(blob);
 }
Exemple #8
0
 /// <summary>
 /// Saves a volume to a file on disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="format">The format.</param>
 /// <param name="box">The box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileW([In] const wchar_t* pDestFile,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox)</unmanaged>
 public static void ToFile(Volume volume, string fileName, ImageFileFormat format, Box box)
 {
     ToFile(volume, fileName, format, box, null);
 }
Exemple #9
0
 /// <summary>
 /// Loads a volume from a file in memory.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="memory">The memory.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <param name="palette">The palette.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInMemory(Volume volume, byte[] memory, Filter filter, int colorKey, Box sourceBox, Box destinationBox, PaletteEntry[] palette, out ImageInformation imageInformation)
 {
     unsafe
     {
         fixed (void* pMemory = memory)
             fixed (void* pImageInformation = &imageInformation)
                 D3DX9.LoadVolumeFromFileInMemory(volume, palette, new IntPtr(&destinationBox), (IntPtr)pMemory, memory.Length, new IntPtr(&sourceBox), filter, colorKey, (IntPtr)pImageInformation);
     }
 }
Exemple #10
0
 /// <summary>
 /// Loads a volume from a file in memory.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="memory">The memory.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInMemory(Volume volume, byte[] memory, Filter filter, int colorKey, Box sourceBox, Box destinationBox, out ImageInformation imageInformation)
 {
     FromFileInMemory(volume, memory, filter, colorKey, sourceBox, destinationBox, null, out imageInformation);
 }
Exemple #11
0
 /// <summary>
 /// Loads a volume from a file in memory.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="memory">The memory.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInMemory(Volume volume, byte[] memory, Filter filter, int colorKey, Box sourceBox, Box destinationBox)
 {
     unsafe
     {
         fixed (void* pMemory = memory)
             D3DX9.LoadVolumeFromFileInMemory(volume, null, new IntPtr(&destinationBox), (IntPtr)pMemory, memory.Length, new IntPtr(&sourceBox), filter, colorKey, IntPtr.Zero);
     }
 }
Exemple #12
0
 /// <summary>
 /// Loads a volume from a file in memory.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="memory">The memory.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInMemory(Volume volume, byte[] memory, Filter filter, int colorKey)
 {
     unsafe
     {
         fixed (void* pMemory = memory)
             D3DX9.LoadVolumeFromFileInMemory(volume, null, IntPtr.Zero, (IntPtr)pMemory, memory.Length, IntPtr.Zero, filter, colorKey, IntPtr.Zero);
     }
 }
Exemple #13
0
 /// <summary>
 /// Loads a volume from a file on the disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <param name="palette">The palette.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileW([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] const wchar_t* pSrcFile,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey,[In] D3DXIMAGE_INFO* pSrcInfo)</unmanaged>
 public static void FromFile(Volume volume, string fileName, Filter filter, int colorKey, Box sourceBox, Box destinationBox, PaletteEntry[] palette, out ImageInformation imageInformation)
 {
     unsafe
     {
         fixed (void* pImageInformation = &imageInformation)
             D3DX9.LoadVolumeFromFileW(volume, palette, new IntPtr(&destinationBox), fileName, new IntPtr(&sourceBox), filter, colorKey, (IntPtr)pImageInformation);
     }
 }
Exemple #14
0
        /// <summary>
        /// Loads a volume from a file on the disk.
        /// </summary>
        /// <param name="volume">The volume.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <param name="sourceBox">The source box.</param>
        /// <param name="destinationBox">The destination box.</param>
        /// <param name="imageInformation">The image information.</param>
        /// <returns>
        /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
        /// </returns>
        /// <unmanaged>HRESULT D3DXLoadVolumeFromFileW([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] const wchar_t* pSrcFile,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey,[In] D3DXIMAGE_INFO* pSrcInfo)</unmanaged>
        public static void FromFile(Volume volume, string fileName, Filter filter, int colorKey, Box sourceBox, Box destinationBox, out ImageInformation imageInformation)
        {

            FromFile(volume, fileName, filter, colorKey, sourceBox, destinationBox, null, out imageInformation);
        }
Exemple #15
0
 /// <summary>
 /// Loads a volume from a source volume.
 /// </summary>
 /// <param name="destinationVolume">The destination volume.</param>
 /// <param name="sourceVolume">The source volume.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <param name="destinationPalette">The destination palette.</param>
 /// <param name="sourcePalette">The source palette.</param>
 /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromVolume([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey)</unmanaged>
 public static void FromVolume(Volume destinationVolume, Volume sourceVolume, Filter filter, int colorKey, Box sourceBox, Box destinationBox, PaletteEntry[] destinationPalette, PaletteEntry[] sourcePalette)
 {
     unsafe
     {
         D3DX9.LoadVolumeFromVolume(destinationVolume, destinationPalette, new IntPtr(&destinationBox), sourceVolume, sourcePalette, new IntPtr(&sourceBox), filter, colorKey);
     }
 }
Exemple #16
0
 /// <summary>
 /// Saves a volume to a file on disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="format">The format.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileW([In] const wchar_t* pDestFile,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox)</unmanaged>
 public static void ToFile(Volume volume, string fileName, ImageFileFormat format)
 {
     D3DX9.SaveVolumeToFileW(fileName, format, volume, null, IntPtr.Zero);
 }
Exemple #17
0
        /// <summary>
        /// Loads a volume from a file in a strean.
        /// </summary>
        /// <param name="volume">The volume.</param>
        /// <param name="stream">The stream.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <returns>
        /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
        /// </returns>
        /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
        public static void FromFileInStream(Volume volume, Stream stream, Filter filter, int colorKey)
        {

            CreateFromFileInStream(volume, stream, filter, colorKey, IntPtr.Zero, IntPtr.Zero, null, IntPtr.Zero);
        }
Exemple #18
0
 /// <summary>
 /// Saves a volume to a file on disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="format">The format.</param>
 /// <param name="box">The box.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileW([In] const wchar_t* pDestFile,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In] const PALETTEENTRY* pSrcPalette,[In] const D3DBOX* pSrcBox)</unmanaged>
 public static void ToFile(Volume volume, string fileName, ImageFileFormat format, Box box, PaletteEntry[] palette)
 {
     unsafe
     {
         D3DX9.SaveVolumeToFileW(fileName, format, volume, palette, new IntPtr(&box));
     }
 }
Exemple #19
0
 /// <summary>
 /// Loads a volume from a file in a strean.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="stream">The stream.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInStream(Volume volume, Stream stream, Filter filter, int colorKey, Box sourceBox, Box destinationBox)
 {
     unsafe
     {
         CreateFromFileInStream(volume, stream, filter, colorKey, new IntPtr(&sourceBox), new IntPtr(&destinationBox), null, IntPtr.Zero);
     }
 }
Exemple #20
0
 /// <summary>
 /// Saves a volume to a <see cref="DataStream"/>.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="format">The format.</param>
 /// <param name="box">The box.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXSaveVolumeToFileInMemory([In] ID3DXBuffer** ppDestBuf,[In] D3DXIMAGE_FILEFORMAT DestFormat,[In] IDirect3DVolume9* pSrcVolume,[In, Buffer] const PALETTEENTRY* pSrcPalette,[In] const void* pSrcBox)</unmanaged>
 public static DataStream ToStream(Volume volume, ImageFileFormat format, Box box)
 {
     return ToStream(volume, format, box, null);
 }
Exemple #21
0
        /// <summary>
        /// Loads a volume from a file in a strean.
        /// </summary>
        /// <param name="volume">The volume.</param>
        /// <param name="stream">The stream.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <param name="sourceBox">The source box.</param>
        /// <param name="destinationBox">The destination box.</param>
        /// <param name="imageInformation">The image information.</param>
        /// <returns>
        /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
        /// </returns>
        /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
        public static void FromFileInStream(Volume volume, Stream stream, Filter filter, int colorKey, Box sourceBox, Box destinationBox, out ImageInformation imageInformation)
        {

            FromFileInStream(volume, stream, filter, colorKey, sourceBox, destinationBox, null, out imageInformation);
        }
Exemple #22
0
 /// <summary>
 /// Loads a volume from a file on the disk.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <returns>
 /// A <see cref="SharpDX.Result"/> object describing the result of the operation.
 /// </returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileW([In] IDirect3DVolume9* pDestVolume,[In] const PALETTEENTRY* pDestPalette,[In] const D3DBOX* pDestBox,[In] const wchar_t* pSrcFile,[In] const D3DBOX* pSrcBox,[In] unsigned int Filter,[In] D3DCOLOR ColorKey,[In] D3DXIMAGE_INFO* pSrcInfo)</unmanaged>
 public static void FromFile(Volume volume, string fileName, Filter filter, int colorKey)
 {
     D3DX9.LoadVolumeFromFileW(volume, null, IntPtr.Zero, fileName, IntPtr.Zero, filter, colorKey, IntPtr.Zero);
 }
Exemple #23
0
 /// <summary>
 /// Loads a volume from a file in a strean.
 /// </summary>
 /// <param name="volume">The volume.</param>
 /// <param name="stream">The stream.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="sourceBox">The source box.</param>
 /// <param name="destinationBox">The destination box.</param>
 /// <param name="palette">The palette.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
 /// <unmanaged>HRESULT D3DXLoadVolumeFromFileInMemory([In] IDirect3DVolume9* pDestVolume,[Out, Buffer] const PALETTEENTRY* pDestPalette,[In] const void* pDestBox,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] const void* pSrcBox,[In] D3DX_FILTER Filter,[In] int ColorKey,[In] void* pSrcInfo)</unmanaged>
 public static void FromFileInStream(Volume volume, Stream stream, Filter filter, int colorKey, Box sourceBox, Box destinationBox, PaletteEntry[] palette, out ImageInformation imageInformation)
 {
     unsafe
     {
         fixed (void* pImageInformation = &imageInformation)
             CreateFromFileInStream(volume, stream, filter, colorKey, new IntPtr(&sourceBox), new IntPtr(&destinationBox), palette, (IntPtr)pImageInformation);
     }
 }
			protected override void dispose( bool disposeManagedResources )
			{
				if ( !IsDisposed )
				{
					if ( disposeManagedResources )
					{
						this.Surface.SafeDispose();
						this.Surface = null;

						this.Volume.SafeDispose();
						this.Volume = null;
					}
				}

				base.dispose( disposeManagedResources );
			}
Exemple #25
0
        private static void CreateFromFileInStream(Volume volume, Stream stream, Filter filter, int colorKey, IntPtr sourceBox, IntPtr destinationBox, PaletteEntry[] palette, IntPtr imageInformation)
        {

            unsafe
            {
                if (stream is DataStream)
                    D3DX9.LoadVolumeFromFileInMemory(volume, palette, destinationBox, ((DataStream)stream).DataPointer, (int)stream.Length, sourceBox, filter, colorKey, (IntPtr)imageInformation);
                var data = Utilities.ReadStream(stream);
                fixed (void* pData = data)
                    D3DX9.LoadVolumeFromFileInMemory(volume, palette, destinationBox, (IntPtr)pData, data.Length, sourceBox, filter, colorKey, (IntPtr)imageInformation);
            }
        }