本文整理汇总了C#中SharpDX.Direct3D9.PaletteEntry类的典型用法代码示例。如果您正苦于以下问题:C# PaletteEntry类的具体用法?C# PaletteEntry怎么用?C# PaletteEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PaletteEntry类属于SharpDX.Direct3D9命名空间,在下文中一共展示了PaletteEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFromMemory
/// <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;
}
示例2: CreateFromStream
/// <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;
}
示例3: ToStream
/// <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);
}
}
示例4: FromStream
/// <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);
}
示例5: FromVolume
/// <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);
}
}
示例6: ToFile
/// <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));
}
}
示例7: FromFileInStream
/// <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);
}
}
示例8: CreateFromFile
/// <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;
}
示例9: FromFile
/// <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);
}
}
示例10: FromFileInMemory
/// <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);
}
}
示例11: FromMemory
/// <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);
}
示例12: FromFile
/// <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);
}
示例13: ComputeNormalMap
/// <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);
}
示例14: CreateFromPointer
/// <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;
}
示例15: CreateFromFileInStream
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);
}
}