![]() |
Paradox Game Engine
v1.0.0 beta06
|
Provides method to instantiate an image 1D/2D/3D supporting TextureArray and mipmaps on the CPU or to load/save an image from the disk. More...
Public Member Functions | |
delegate Image | ImageLoadDelegate (IntPtr dataPointer, int dataSize, bool makeACopy, GCHandle?handle) |
delegate void | ImageSaveDelegate (PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) |
void | Dispose () |
MipMapDescription | GetMipMapDescription (int mipmap) |
Gets the mipmap description of this instance for the specified mipmap level. More... | |
PixelBuffer | GetPixelBuffer (int arrayOrZSliceIndex, int mipmap) |
Gets the pixel buffer for the specified array/z slice and mipmap level. More... | |
PixelBuffer | GetPixelBuffer (int arrayIndex, int zIndex, int mipmap) |
Gets the pixel buffer for the specified array/z slice and mipmap level. More... | |
DataBox[] | ToDataBox () |
Gets the databox from this image. More... | |
void | Save (Stream imageStream, ImageFileType fileType) |
Saves this instance to a stream. More... | |
Static Public Member Functions | |
static void | Register (ImageFileType type, ImageLoadDelegate loader, ImageSaveDelegate saver) |
Registers a loader/saver for a specified image file type. More... | |
static Image | New (ImageDescription description) |
Creates a new instance of Image from an image description. More... | |
static Image | New1D (int width, MipMapCount mipMapCount, PixelFormat format, int arraySize=1) |
Creates a new instance of a 1D Image. More... | |
static Image | New2D (int width, int height, MipMapCount mipMapCount, PixelFormat format, int arraySize=1, int rowStride=0) |
Creates a new instance of a 2D Image. More... | |
static Image | NewCube (int width, MipMapCount mipMapCount, PixelFormat format) |
Creates a new instance of a Cube Image. More... | |
static Image | New3D (int width, int height, int depth, MipMapCount mipMapCount, PixelFormat format) |
Creates a new instance of a 3D Image. More... | |
static Image | New (ImageDescription description, IntPtr dataPointer) |
Creates a new instance of Image from an image description. More... | |
static Image | New (ImageDescription description, IntPtr dataPointer, int offset, GCHandle?handle, bool bufferIsDisposable) |
Initializes a new instance of the Image class. More... | |
static Image | New1D (int width, MipMapCount mipMapCount, PixelFormat format, int arraySize, IntPtr dataPointer) |
Creates a new instance of a 1D Image. More... | |
static Image | New2D (int width, int height, MipMapCount mipMapCount, PixelFormat format, int arraySize, IntPtr dataPointer, int rowStride=0) |
Creates a new instance of a 2D Image. More... | |
static Image | NewCube (int width, MipMapCount mipMapCount, PixelFormat format, IntPtr dataPointer) |
Creates a new instance of a Cube Image. More... | |
static Image | New3D (int width, int height, int depth, MipMapCount mipMapCount, PixelFormat format, IntPtr dataPointer) |
Creates a new instance of a 3D Image. More... | |
static Image | Load (DataPointer dataBuffer, bool makeACopy=false) |
Loads an image from an unmanaged memory pointer. More... | |
static Image | Load (IntPtr dataPointer, int dataSize, bool makeACopy=false) |
Loads an image from an unmanaged memory pointer. More... | |
static unsafe Image | Load (byte[] buffer) |
Loads an image from a managed buffer. More... | |
static Image | Load (Stream imageStream) |
Loads the specified image from a stream. More... | |
static int | CalculateMipLevels (int width, MipMapCount mipLevels) |
Calculates the number of miplevels for a Texture 1D. More... | |
static int | CalculateMipLevels (int width, int height, MipMapCount mipLevels) |
Calculates the number of miplevels for a Texture 2D. More... | |
static int | CalculateMipLevels (int width, int height, int depth, MipMapCount mipLevels) |
Calculates the number of miplevels for a Texture 2D. More... | |
static int | CalculateMipSize (int width, int mipLevel) |
static int | CountMips (int width) |
static int | CountMips (int width, int height) |
static int | CountMips (int width, int height, int depth) |
Public Attributes | |
ImageDescription | Description |
Description of this image. More... | |
Properties | |
IntPtr | DataPointer [get] |
Gets a pointer to the image buffer in memory. More... | |
PixelBufferArray | PixelBuffer [get] |
Provides access to all pixel buffers. More... | |
int | TotalSizeInBytes [get] |
Gets the total number of bytes occupied by this image in memory. More... | |
Provides method to instantiate an image 1D/2D/3D supporting TextureArray and mipmaps on the CPU or to load/save an image from the disk.
|
static |
Calculates the number of miplevels for a Texture 1D.
width | The width of the texture. |
mipLevels | A MipMapCount, set to true to calculates all mipmaps, to false to calculate only 1 miplevel, or > 1 to calculate a specific amount of levels. |
|
static |
Calculates the number of miplevels for a Texture 2D.
width | The width of the texture. |
height | The height of the texture. |
mipLevels | A MipMapCount, set to true to calculates all mipmaps, to false to calculate only 1 miplevel, or > 1 to calculate a specific amount of levels. |
|
static |
Calculates the number of miplevels for a Texture 2D.
width | The width of the texture. |
height | The height of the texture. |
depth | The depth of the texture. |
mipLevels | A MipMapCount, set to true to calculates all mipmaps, to false to calculate only 1 miplevel, or > 1 to calculate a specific amount of levels. |
|
static |
|
static |
|
static |
|
static |
MipMapDescription SiliconStudio.Paradox.Graphics.Image.GetMipMapDescription | ( | int | mipmap | ) |
PixelBuffer SiliconStudio.Paradox.Graphics.Image.GetPixelBuffer | ( | int | arrayOrZSliceIndex, |
int | mipmap | ||
) |
Gets the pixel buffer for the specified array/z slice and mipmap level.
arrayOrZSliceIndex | For 3D image, the parameter is the Z slice, otherwise it is an index into the texture array. |
mipmap | The mipmap. |
System.ArgumentException | If arrayOrZSliceIndex or mipmap are out of range. |
PixelBuffer SiliconStudio.Paradox.Graphics.Image.GetPixelBuffer | ( | int | arrayIndex, |
int | zIndex, | ||
int | mipmap | ||
) |
Gets the pixel buffer for the specified array/z slice and mipmap level.
arrayIndex | Index into the texture array. Must be set to 0 for 3D images. |
zIndex | Z index for 3D image. Must be set to 0 for all 1D/2D images. |
mipmap | The mipmap. |
System.ArgumentException | If arrayIndex, zIndex or mipmap are out of range. |
delegate Image SiliconStudio.Paradox.Graphics.Image.ImageLoadDelegate | ( | IntPtr | dataPointer, |
int | dataSize, | ||
bool | makeACopy, | ||
GCHandle? | handle | ||
) |
delegate void SiliconStudio.Paradox.Graphics.Image.ImageSaveDelegate | ( | PixelBuffer[] | pixelBuffers, |
int | count, | ||
ImageDescription | description, | ||
Stream | imageStream | ||
) |
|
static |
Loads an image from an unmanaged memory pointer.
dataBuffer | Pointer to an unmanaged memory. If makeACopy is false, this buffer must be allocated with Utilities.AllocateMemory. |
makeACopy | True to copy the content of the buffer to a new allocated buffer, false otherwhise. |
If makeACopy is set to false, the returned image is now the holder of the unmanaged pointer and will release it on Dispose.
Definition at line 477 of file Image.cs.
References SiliconStudio.Paradox.Graphics.DataPointer.Pointer, and SiliconStudio.Paradox.Graphics.DataPointer.Size.
|
static |
Loads an image from an unmanaged memory pointer.
dataPointer | Pointer to an unmanaged memory. If makeACopy is false, this buffer must be allocated with Utilities.AllocateMemory. |
dataSize | Size of the unmanaged buffer. |
makeACopy | True to copy the content of the buffer to a new allocated buffer, false otherwise. |
If makeACopy is set to false, the returned image is now the holder of the unmanaged pointer and will release it on Dispose.
|
static |
Loads an image from a managed buffer.
buffer | Reference to a managed buffer. |
This method support the following format: dds, bmp, jpg, png, gif, tiff, wmp, tga
.
Definition at line 501 of file Image.cs.
References DirectX.size.
Loads the specified image from a stream.
imageStream | The image stream. |
This method support the following format: dds, bmp, jpg, png, gif, tiff, wmp, tga
.
Definition at line 527 of file Image.cs.
References SiliconStudio.Core.Utilities.ReadStream().
|
static |
|
static |
|
static |
Initializes a new instance of the Image class.
description | The image description. |
dataPointer | The pointer to the data buffer. |
offset | The offset from the beginning of the data buffer. |
handle | The handle (optionnal). |
bufferIsDisposable | if set to true [buffer is disposable]. |
System.InvalidOperationException | If the format is invalid, or width/height/depth/arraysize is invalid with respect to the dimension. |
|
static |
|
static |
|
static |
|
static |
Creates a new instance of a 2D Image.
width | The width. |
height | The height. |
mipMapCount | The mip map count. |
format | The format. |
arraySize | Size of the array. |
dataPointer | Pointer to an existing buffer. |
rowStride | Specify a specific rowStride, only valid when mipMapCount == 1 and pixel format is not compressed. |
|
static |
|
static |
|
static |
|
static |
|
static |
Registers a loader/saver for a specified image file type.
type | The file type (use integer and explicit casting to ImageFileType to register other fileformat. |
loader | The loader delegate (can be null). |
saver | The saver delegate (can be null). |
System.ArgumentException |
void SiliconStudio.Paradox.Graphics.Image.Save | ( | Stream | imageStream, |
ImageFileType | fileType | ||
) |
DataBox [] SiliconStudio.Paradox.Graphics.Image.ToDataBox | ( | ) |
Gets the databox from this image.
Definition at line 295 of file Image.cs.
Referenced by SiliconStudio.Paradox.Graphics.Texture1D.New(), SiliconStudio.Paradox.Graphics.Texture3D.New(), SiliconStudio.Paradox.Graphics.Texture2D.New(), and SiliconStudio.Paradox.Graphics.TextureCube.New().
ImageDescription SiliconStudio.Paradox.Graphics.Image.Description |
Description of this image.
Definition at line 137 of file Image.cs.
Referenced by SiliconStudio.Paradox.Graphics.Texture1D.New(), SiliconStudio.Paradox.Graphics.Texture3D.New(), SiliconStudio.Paradox.Graphics.Texture2D.New(), SiliconStudio.Paradox.Graphics.TextureCube.New(), and SiliconStudio.Paradox.Graphics.Texture.New().
|
get |
|
get |
Provides access to all pixel buffers.
For Texture3D, each z slice of the Texture3D has a pixelBufferArray * by the number of mipmaps. For other textures, there is Description.MipLevels * Description.ArraySize pixel buffers.
Definition at line 279 of file Image.cs.
Referenced by SiliconStudio.Paradox.Graphics.Regression.TestResultImage.Write().
|
get |