Exemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="CubeTexture"/> from a stream.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="stream">The stream.</param>
        /// <param name="sizeBytes">The size bytes.</param>
        /// <param name="size">The size.</param>
        /// <param name="levelCount">The level count.</param>
        /// <param name="usage">The usage.</param>
        /// <param name="format">The format.</param>
        /// <param name="pool">The pool.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="mipFilter">The mip filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <param name="imageInformation">The image information.</param>
        /// <param name="palette">The palette.</param>
        /// <returns>
        /// A <see cref="CubeTexture"/>
        /// </returns>
        /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
        public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
        {
            palette = new PaletteEntry[256];

            fixed(void *pImageInfo = &imageInformation)
            return(CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a <see cref="VolumeTexture"/> from a memory buffer.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="buffer">The buffer.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="levelCount">The level count.</param>
        /// <param name="usage">The usage.</param>
        /// <param name="format">The format.</param>
        /// <param name="pool">The pool.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="mipFilter">The mip filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <param name="imageInformation">The image information.</param>
        /// <param name="palette">The palette.</param>
        /// <returns>
        /// A <see cref="VolumeTexture"/>
        /// </returns>
        /// <unmanaged>HRESULT D3DXCreateVolumeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DVolumeTexture9** ppVolumeTexture)</unmanaged>
        public static unsafe VolumeTexture FromMemory(Device device, byte[] buffer, int width, int height, int depth, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
        {
            palette = new PaletteEntry[256];

            fixed(void *pImageInfo = &imageInformation)
            return(CreateFromMemory(device, buffer, width, height, depth, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a <see cref="Texture"/> from a file
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="filename">The filename.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="levelCount">The level count.</param>
        /// <param name="usage">The usage.</param>
        /// <param name="format">The format.</param>
        /// <param name="pool">The pool.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="mipFilter">The mip filter.</param>
        /// <param name="colorKey">The color key.</param>
        /// <param name="imageInformation">The image information.</param>
        /// <param name="palette">The palette.</param>
        /// <returns>
        /// A <see cref="Texture"/>
        /// </returns>
        /// <unmanaged>HRESULT D3DXCreateTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DTexture9** ppTexture)</unmanaged>
        public static unsafe Texture FromFile(Device device, string filename, int width, int height, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
        {
            palette = new PaletteEntry[256];

            fixed(void *pImageInfo = &imageInformation)
            return(CreateFromFile(device, filename, width, height, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a <see cref="CubeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="stream">The stream.</param>
 /// <param name="sizeBytes">The size bytes.</param>
 /// <param name="size">The size.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="CubeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
 public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
 {
     palette = new PaletteEntry[256];
     fixed (void* pImageInfo = &imageInformation)
         return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
 }
Exemplo n.º 5
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);
     }
 }
Exemplo n.º 6
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));
     }
 }
Exemplo n.º 7
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);
     }
 }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a <see cref="Texture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="Texture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DTexture9** ppTexture)</unmanaged>
 private static unsafe Texture CreateFromFile(Device device, string fileName, int width, int height, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     Texture cubeTexture;
     D3DX9.CreateTextureFromFileExW(
         device,
         fileName,
         width,
         height,
         levelCount,
         (int)usage,
         format,
         pool,
         (int)filter,
         (int)mipFilter,
         *(RawColorBGRA*)&colorKey,
         imageInformation,
         palette,
         out cubeTexture);
     return cubeTexture;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a <see cref="CubeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="pointer">The pointer.</param>
 /// <param name="sizeInBytes">The size in bytes.</param>
 /// <param name="size">The size.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="CubeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
 private static unsafe CubeTexture CreateFromPointer(Device device, IntPtr pointer, int sizeInBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     CubeTexture cubeTexture;
     D3DX9.CreateCubeTextureFromFileInMemoryEx(
         device,
         pointer,
         sizeInBytes,
         size,
         levelCount,
         (int)usage,
         format,
         pool,
         (int)filter,
         (int)mipFilter,
         (Color)colorKey,
         imageInformation,
         palette,
         out cubeTexture);
     return cubeTexture;
 }
Exemplo n.º 11
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);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a <see cref="VolumeTexture"/> from a memory buffer.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="buffer">The buffer.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="depth">The depth.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="VolumeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateVolumeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DVolumeTexture9** ppVolumeTexture)</unmanaged>
 public static unsafe VolumeTexture FromMemory(Device device, byte[] buffer, int width, int height, int depth, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
 {
     palette = new PaletteEntry[256];
     fixed (void* pImageInfo = &imageInformation)
         return CreateFromMemory(device, buffer, width, height, depth, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Creates a <see cref="Texture"/> from a file
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="filename">The filename.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="Texture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateTextureFromFileExW([In] IDirect3DDevice9* pDevice,[In] const wchar_t* pSrcFile,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[In] void* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DTexture9** ppTexture)</unmanaged>
 public static unsafe Texture FromFile(Device device, string filename, int width, int height, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette)
 {
     palette = new PaletteEntry[256];
     fixed (void* pImageInfo = &imageInformation)
         return CreateFromFile(device, filename, width, height, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Computes the normal map.
 /// </summary>
 /// <param name="texture">The texture.</param>
 /// <param name="sourceTexture">The source texture.</param>
 /// <param name="palette">The palette.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="channel">The channel.</param>
 /// <param name="amplitude">The amplitude.</param>
 /// <returns>A <see cref="SharpDX.Result" /> object describing the result of the operation.</returns>
 /// <unmanaged>HRESULT D3DXComputeNormalMap([In] IDirect3DTexture9* pTexture,[In] IDirect3DTexture9* pSrcTexture,[Out, Buffer] const PALETTEENTRY* pSrcPalette,[In] unsigned int Flags,[In] unsigned int Channel,[In] float Amplitude)</unmanaged>
 public static void ComputeNormalMap(Texture texture, Texture sourceTexture, PaletteEntry[] palette, NormalMapFlags flags, Channel channel, float amplitude)
 {
     D3DX9.ComputeNormalMap(texture, sourceTexture, palette, (int)flags, (int)channel, amplitude);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Creates a <see cref="CubeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="buffer">The buffer.</param>
 /// <param name="size">The size.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="CubeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
 private static unsafe CubeTexture CreateFromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     CubeTexture cubeTexture;
     fixed (void* pBuffer = buffer)
         cubeTexture = CreateFromPointer(
             device,
             (IntPtr)pBuffer,
             buffer.Length,
             size,
             levelCount,
             usage,
             format,
             pool,
             filter,
             mipFilter,
             colorKey,
             imageInformation,
             palette
             );
     return cubeTexture;
 }
Exemplo n.º 16
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);
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// Creates a <see cref="CubeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="stream">The stream.</param>
 /// <param name="sizeBytes">The size bytes.</param>
 /// <param name="size">The size.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>A <see cref="CubeTexture"/></returns>
 /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
 private static unsafe CubeTexture CreateFromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     CubeTexture cubeTexture;
     sizeBytes = sizeBytes == 0 ? (int)(stream.Length - stream.Position) : sizeBytes;
     if (stream is DataStream)
     {
         cubeTexture = CreateFromPointer(
             device,
             ((DataStream)stream).PositionPointer,
             sizeBytes,
             size,
             levelCount,
             usage,
             format,
             pool,
             filter,
             mipFilter,
             colorKey,
             imageInformation,
             palette
             );
     }
     else
     {
         var data = Utilities.ReadStream(stream);
         fixed (void* pData = data)
             cubeTexture = CreateFromPointer(
                 device,
                 (IntPtr)pData,
                 data.Length,
                 size,
                 levelCount,
                 usage,
                 format,
                 pool,
                 filter,
                 mipFilter,
                 colorKey,
                 imageInformation,
                 palette
                 );
     }
     stream.Position = sizeBytes;
     return cubeTexture;
 }
Exemplo n.º 18
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);
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Creates a <see cref="CubeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="size">The size.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="CubeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged>
 private static CubeTexture CreateFromFile(Device device, string fileName, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     CubeTexture cubeTexture;
     D3DX9.CreateCubeTextureFromFileExW(
         device,
         fileName,
         size,
         levelCount,
         (int)usage,
         format,
         pool,
         (int)filter,
         (int)mipFilter,
         (Color)colorKey,
         imageInformation,
         palette,
         out cubeTexture);
     return cubeTexture;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Creates a <see cref="VolumeTexture"/> from a stream.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="pointer">The pointer.</param>
 /// <param name="sizeInBytes">The size in bytes.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="depth">The depth.</param>
 /// <param name="levelCount">The level count.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="format">The format.</param>
 /// <param name="pool">The pool.</param>
 /// <param name="filter">The filter.</param>
 /// <param name="mipFilter">The mip filter.</param>
 /// <param name="colorKey">The color key.</param>
 /// <param name="imageInformation">The image information.</param>
 /// <param name="palette">The palette.</param>
 /// <returns>
 /// A <see cref="VolumeTexture"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateVolumeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DVolumeTexture9** ppVolumeTexture)</unmanaged>
 private static unsafe VolumeTexture CreateFromPointer(Device device, IntPtr pointer, int sizeInBytes, int width, int height, int depth, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette)
 {
     VolumeTexture cubeVolumeTexture;
     D3DX9.CreateVolumeTextureFromFileInMemoryEx(
         device,
         pointer,
         sizeInBytes,
         width,
         height,
         depth,
         levelCount,
         (int)usage,
         format,
         pool,
         (int)filter,
         (int)mipFilter,
         *(RawColorBGRA*)&colorKey,
         imageInformation,
         palette,
         out cubeVolumeTexture);
     return cubeVolumeTexture;
 }