Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.TextureConverter.TextureTool Class Reference

Provides method to load images or textures, to modify them and to convert them with different texture compression format. Input supported format : gif, png, jpe, pds (Every FreeImage supported format...), dds, pvr, ktx. Output format : gif, png, jpe, pds (Every FreeImage supported format...), dds, pvr, ktx. Compression format : DXT1-5, ATC, PVRTC1-2, ETC1-2, uncompressed formats (BGRA8888, RGBA8888) Image processing : resize, flip, gamma correction Texture utilities : Mipmap generation, normal map generation More...

Inheritance diagram for SiliconStudio.TextureConverter.TextureTool:

Public Member Functions

 TextureTool ()
 Initializes a new instance of the TextureTool class. More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources for each texture porcessing libraries. More...
 
TexAtlas CreateAtlas (List< TexImage > textureList, bool forceSquaredAtlas=false)
 Creates an atlas with the given TexImage. More...
 
TexAtlas RetrieveAtlas (TexImage texture, string layoutFile)
 Retrieves the atlas from a TexImage and its corresponding layout file. More...
 
TexImage CreateTextureArray (List< TexImage > textureList)
 Creates a texture array with the given TexImage. More...
 
TexImage CreateTextureCube (List< TexImage > textureList)
 Creates a texture cube with the given TexImage. More...
 
TexAtlas LoadAtlas (TexAtlas.TexLayout layout, string file)
 Loads the Atlas corresponding to the specified layout and file. More...
 
TexAtlas LoadAtlas (string file, string layoutFile="")
 Loads the Atlas corresponding to the specified texture file and layout file. More...
 
TexImage Load (string file)
 Loads the specified file. More...
 
TexImage Load (SiliconStudio.Paradox.Graphics.Image image)
 Loads the specified image of the class SiliconStudio.Paradox.Graphics.Image. More...
 
void Decompress (TexImage image)
 Decompresses the specified TexImage. More...
 
void Save (TexImage image, String fileName, int minimumMipMapSize=1)
 Saves the specified TexImage into a file. More...
 
void Save (TexImage image, String fileName, SiliconStudio.Paradox.Graphics.PixelFormat format, int minimumMipMapSize=1)
 Saves the specified TexImage into a file with the specified format. More...
 
void SwitchChannel (TexImage image)
 Switches the channel R and B. More...
 
void Compress (TexImage image, SiliconStudio.Paradox.Graphics.PixelFormat format, TextureQuality quality=TextureQuality.Fast)
 Compresses the specified image into the specified format. More...
 
void ColorKey (TexImage image, Color colorKey)
 Apply a color key on the image by replacing the color passed by to this method by a white transparent color (Alpha is 0). More...
 
void GenerateMipMaps (TexImage image, Filter.MipMapGeneration filter)
 Generates the mip maps. More...
 
void Resize (TexImage image, int width, int height, Filter.Rescaling filter)
 Resizes the specified image to a fixed image size. More...
 
void Rescale (TexImage image, float widthFactor, float heightFactor, Filter.Rescaling filter)
 Rescales the specified image with the specified factors. More...
 
TexImage GenerateNormalMap (TexImage heightMap, float amplitude)
 Generates the normal map. More...
 
void PreMultiplyAlpha (TexImage image)
 Premultiplies the alpha. More...
 
unsafe TexImage CreateImageFromAlphaComponent (TexImage texImage)
 Create a new image from the alpha component of a reference image. More...
 
unsafe Image CreateImageFromRegion (TexImage texImage, Rectangle region)
 Create a new image from region. More...
 
SiliconStudio.Paradox.Graphics.Image ConvertToParadoxImage (TexImage image)
 Converts to paradox image. More...
 
void CorrectGamma (TexImage image, double gamma)
 Corrects the gamma. More...
 
void Flip (TexImage image, Orientation orientation)
 Flips the specified image horizontally or vertically. More...
 
void FlipSub (TexImage image, int index, Orientation orientation)
 Flips the specified image horizontally or vertically. More...
 
void Swap (TexImage image, int firstIndex, int secondIndex)
 Swaps two slices of a texture array. More...
 
TexImage Extract (TexAtlas atlas, string name, int minimumMipmapSize=1)
 Extracts the TexImage corresponding to the specified name in the given atlas. More...
 
TexImage Extract (TexImage array, int indice, int minimumMipmapSize=1)
 Extracts the TexImage corresponding to the specified indice in the given texture array. More...
 
List< TexImageExtractAll (TexAtlas atlas, int minimumMipmapSize=1)
 Extracts every TexImage included in the atlas. More...
 
List< TexImageExtractAll (TexImage array, int minimumMipmapSize=1)
 Extracts every TexImage included in the array. More...
 
void Update (TexAtlas atlas, TexImage texture, string name="")
 Updates a specific texture in the atlas with the given TexImage. More...
 
void Update (TexImage array, TexImage texture, int indice)
 Updates a specific texture in the texture array with the given TexImage. More...
 
void Insert (TexImage array, TexImage texture, int indice)
 Inserts a texture into a texture array at a specified position. More...
 
void Remove (TexImage array, int indice)
 Removes the texture at a specified position from a texture array. More...
 

Detailed Description

Provides method to load images or textures, to modify them and to convert them with different texture compression format. Input supported format : gif, png, jpe, pds (Every FreeImage supported format...), dds, pvr, ktx. Output format : gif, png, jpe, pds (Every FreeImage supported format...), dds, pvr, ktx. Compression format : DXT1-5, ATC, PVRTC1-2, ETC1-2, uncompressed formats (BGRA8888, RGBA8888) Image processing : resize, flip, gamma correction Texture utilities : Mipmap generation, normal map generation

Definition at line 24 of file TextureTool.cs.

Constructor & Destructor Documentation

SiliconStudio.TextureConverter.TextureTool.TextureTool ( )

Initializes a new instance of the TextureTool class.

Creating instance of each texture processing libraries. For a multithreaded use, one instance of TextureTool should be created per thread.

Definition at line 40 of file TextureTool.cs.

Member Function Documentation

void SiliconStudio.TextureConverter.TextureTool.ColorKey ( TexImage  image,
Color  colorKey 
)

Apply a color key on the image by replacing the color passed by to this method by a white transparent color (Alpha is 0).

Parameters
imageThe image.
colorKeyThe color key.

Definition at line 503 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Compress ( TexImage  image,
SiliconStudio.Paradox.Graphics.PixelFormat  format,
TextureQuality  quality = TextureQuality.Fast 
)

Compresses the specified image into the specified format.

If the image is in a compressed format, it will be first decompressed. If the compressing library doesn't support BGRA order and the current image format is in this order, the channels R and B will be switched.

Parameters
imageThe image.
formatThe format.

Definition at line 483 of file TextureTool.cs.

References DirectX.Decompress(), SiliconStudio.TextureConverter.TexImage.Format, and DirectX.format.

SiliconStudio.Paradox.Graphics.Image SiliconStudio.TextureConverter.TextureTool.ConvertToParadoxImage ( TexImage  image)

Converts to paradox image.

Parameters
imageThe image.
Returns
The converted Paradox SiliconStudio.Paradox.Graphics.Image.

The user is the owner of the returned image, and has to dispose it after he finishes using it

Definition at line 740 of file TextureTool.cs.

void SiliconStudio.TextureConverter.TextureTool.CorrectGamma ( TexImage  image,
double  gamma 
)

Corrects the gamma.

Parameters
imageThe image.
gammaThe gamma.

Definition at line 755 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

TexAtlas SiliconStudio.TextureConverter.TextureTool.CreateAtlas ( List< TexImage textureList,
bool  forceSquaredAtlas = false 
)

Creates an atlas with the given TexImage.

Parameters
textureListThe texture list.
forceSquaredAtlasboolean to decide wheter the atlas will be squared (default is false).
Returns
An instance of TexAtlas.
Exceptions
TextureToolsExceptionNo available library could create the atlas.

Definition at line 74 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.Format.

unsafe TexImage SiliconStudio.TextureConverter.TextureTool.CreateImageFromAlphaComponent ( TexImage  texImage)

Create a new image from the alpha component of a reference image.

Parameters
texImageThe image from which to take the alpha
Returns
The TexImage containing the alpha component as rgb color. Note: it is the user responsibility to dispose the returned image.

Definition at line 658 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.Clone().

unsafe Image SiliconStudio.TextureConverter.TextureTool.CreateImageFromRegion ( TexImage  texImage,
Rectangle  region 
)

Create a new image from region.

Parameters
texImageThe original image from which to extract the region
regionThe region from the original image to extract.
Returns
The extracted region TexImage. Note: it is the user responsibility to dispose the returned image.

Definition at line 686 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize, SiliconStudio.TextureConverter.TexImage.Dimension, and SiliconStudio.TextureConverter.TexImage.Format.

TexImage SiliconStudio.TextureConverter.TextureTool.CreateTextureArray ( List< TexImage textureList)

Creates a texture array with the given TexImage.

Parameters
textureListThe texture list.
Returns
An instance of TexImage corresponding containing the texture array.
Exceptions
TextureToolsExceptionNo available library could create the array. or The textures must all have the same size and format to be in a texture array.

Definition at line 132 of file TextureTool.cs.

TexImage SiliconStudio.TextureConverter.TextureTool.CreateTextureCube ( List< TexImage textureList)

Creates a texture cube with the given TexImage.

Parameters
textureListThe texture list.
Returns
An instance of TexImage containing the texture cube.
Exceptions
TextureToolsExceptionNo available library could create the cube. or The number of texture in the texture list must be a multiple of 6. or The textures must all have the same size and format to be in a texture cube.

Definition at line 177 of file TextureTool.cs.

void SiliconStudio.TextureConverter.TextureTool.Decompress ( TexImage  image)

Decompresses the specified TexImage.

Parameters
imageThe TexImage.

Definition at line 374 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources for each texture porcessing libraries.

Definition at line 58 of file TextureTool.cs.

TexImage SiliconStudio.TextureConverter.TextureTool.Extract ( TexAtlas  atlas,
string  name,
int  minimumMipmapSize = 1 
)

Extracts the TexImage corresponding to the specified name in the given atlas.

Parameters
atlasThe atlas.
nameThe texture name.
minimumMipmapSizeThe minimum size of the smallest mipmap.
Returns
The TexImage texture corresponding to the specified name
Exceptions
TextureToolsExceptionYou must enter a texture name to extract. or The minimup Mipmap size can't be negative. Put 0 or 1 for a complete Mipmap chain.

Definition at line 859 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

TexImage SiliconStudio.TextureConverter.TextureTool.Extract ( TexImage  array,
int  indice,
int  minimumMipmapSize = 1 
)

Extracts the TexImage corresponding to the specified indice in the given texture array.

Parameters
arrayThe array.
indiceThe indice.
minimumMipmapSizeThe minimum size of the smallest mipmap.
Returns
The TexImage texture corresponding to the specified indice
Exceptions
TextureToolsExceptionThe indice you entered is not valid. or The minimup Mipmap size can't be negative. Put 0 or 1 for a complete Mipmap chain.

Definition at line 898 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize.

List<TexImage> SiliconStudio.TextureConverter.TextureTool.ExtractAll ( TexAtlas  atlas,
int  minimumMipmapSize = 1 
)

Extracts every TexImage included in the atlas.

Parameters
atlasThe atlas.
minimumMipmapSizeThe minimum size of the smallest mipmap.
Returns
The list of TexImage corresponding to each texture composing the atlas.
Exceptions
TextureToolsExceptionThe minimup Mipmap size can't be negative. Put 0 or 1 for a complete Mipmap chain.

Definition at line 927 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

List<TexImage> SiliconStudio.TextureConverter.TextureTool.ExtractAll ( TexImage  array,
int  minimumMipmapSize = 1 
)

Extracts every TexImage included in the array.

Parameters
arrayThe array.
minimumMipmapSizeThe minimum size of the smallest mipmap.
Returns
The list of TexImage corresponding to each element of the texture array.
Exceptions
TextureToolsExceptionThe minimup Mipmap size can't be negative. Put 0 or 1 for a complete Mipmap chain.

Definition at line 956 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Flip ( TexImage  image,
Orientation  orientation 
)

Flips the specified image horizontally or vertically.

Parameters
imageThe image.
orientationThe orientation Orientation.Flip.

Definition at line 780 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.FlipSub ( TexImage  image,
int  index,
Orientation  orientation 
)

Flips the specified image horizontally or vertically.

Parameters
imageThe image.
indexThe index of the sub-image.
orientationThe orientation Orientation.Flip.

Definition at line 799 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.GenerateMipMaps ( TexImage  image,
Filter.MipMapGeneration  filter 
)

Generates the mip maps.

If the image is in a compressed format, it will be first decompressed.

Parameters
imageThe image.
filterThe filter.

Definition at line 529 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

TexImage SiliconStudio.TextureConverter.TextureTool.GenerateNormalMap ( TexImage  heightMap,
float  amplitude 
)

Generates the normal map.

Parameters
heightMapThe height map.
amplitudeThe amplitude.
Returns
An instance of TexImage containig the normal map.

Definition at line 616 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Insert ( TexImage  array,
TexImage  texture,
int  indice 
)

Inserts a texture into a texture array at a specified position.

Parameters
arrayThe array.
textureThe texture to be added.
indiceThe indice.
Exceptions
TextureToolsExceptionThe given indice must be between 0 and the array size

Definition at line 1052 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize.

TexImage SiliconStudio.TextureConverter.TextureTool.Load ( string  file)

Loads the specified file.

The file can be an image or a texture.

Parameters
fileThe file.
Returns
An instance of TexImage.
Exceptions
TextureToolsExceptionThe file doesn't exist. Please check the file path.

Definition at line 319 of file TextureTool.cs.

TexImage SiliconStudio.TextureConverter.TextureTool.Load ( SiliconStudio.Paradox.Graphics.Image  image)

Loads the specified image of the class SiliconStudio.Paradox.Graphics.Image.

Parameters
imageThe image.

The ownership of the provided image is not taken by the tex tool. The user has to dispose it him-self

Returns
An instance of the class TexImage containing your loaded image

Definition at line 337 of file TextureTool.cs.

TexAtlas SiliconStudio.TextureConverter.TextureTool.LoadAtlas ( TexAtlas.TexLayout  layout,
string  file 
)

Loads the Atlas corresponding to the specified layout and file.

Parameters
layoutThe layout.
fileThe file.
Returns
An isntance of TexAtlas.
Exceptions
TextureToolsExceptionThe file doesn't exist. Please check the file path. or The layout doesn't match the given atlas file.

Definition at line 227 of file TextureTool.cs.

TexAtlas SiliconStudio.TextureConverter.TextureTool.LoadAtlas ( string  file,
string  layoutFile = "" 
)

Loads the Atlas corresponding to the specified texture file and layout file.

Parameters
layoutThe layout.
fileThe file.
Returns
An instance of TexAtlas.
Exceptions
TextureToolsExceptionThe file doesn't exist. Please check the file path. or The layout doesn't match the given atlas file.

Definition at line 254 of file TextureTool.cs.

void SiliconStudio.TextureConverter.TextureTool.PreMultiplyAlpha ( TexImage  image)

Premultiplies the alpha.

Parameters
imageThe image.

Definition at line 642 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Remove ( TexImage  array,
int  indice 
)

Removes the texture at a specified position from a texture array.

Parameters
arrayThe array.
indiceThe indice.
Exceptions
TextureToolsExceptionThe array size must be > 1. or The given indice must be between 0 and + array.ArraySize

Definition at line 1078 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize.

void SiliconStudio.TextureConverter.TextureTool.Rescale ( TexImage  image,
float  widthFactor,
float  heightFactor,
Filter.Rescaling  filter 
)

Rescales the specified image with the specified factors.

The new size will be : width = width * widthFactor and height = height * heightFactor If the image is in a compressed format, it will be first decompressed.

Parameters
imageThe image.
widthFactorThe width factor.
heightFactorThe height factor.
filterThe filter.

Definition at line 586 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Resize ( TexImage  image,
int  width,
int  height,
Filter.Rescaling  filter 
)

Resizes the specified image to a fixed image size.

If the image is in a compressed format, it will be first decompressed.

Parameters
imageThe image.
widthThe width.
heightThe height.
filterThe filter.

Definition at line 551 of file TextureTool.cs.

References DirectX.Decompress(), SiliconStudio.TextureConverter.TexImage.Format, SiliconStudio.TextureConverter.TexImage.Height, and SiliconStudio.TextureConverter.TexImage.Width.

TexAtlas SiliconStudio.TextureConverter.TextureTool.RetrieveAtlas ( TexImage  texture,
string  layoutFile 
)

Retrieves the atlas from a TexImage and its corresponding layout file.

Parameters
textureThe texture.
layoutFileThe layout file.
Returns
An instance of TexAtlas.
Exceptions
TextureToolsExceptionThe layout file doesn't exist. Please check the file path.

Definition at line 110 of file TextureTool.cs.

void SiliconStudio.TextureConverter.TextureTool.Save ( TexImage  image,
String  fileName,
int  minimumMipMapSize = 1 
)

Saves the specified TexImage into a file.

Parameters
imageThe image.
fileNameName of the file.
minimumMipMapSizeMinimum size of the mip map.

Definition at line 391 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Save ( TexImage  image,
String  fileName,
SiliconStudio.Paradox.Graphics.PixelFormat  format,
int  minimumMipMapSize = 1 
)

Saves the specified TexImage into a file with the specified format.

Parameters
imageThe image.
fileNameName of the file.
formatThe new format.
minimumMipMapSizeMinimum size of the mip map.

Definition at line 418 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.Clone(), DirectX.Compress(), DirectX.Decompress(), SiliconStudio.TextureConverter.TexImage.Format, and DirectX.format.

void SiliconStudio.TextureConverter.TextureTool.Swap ( TexImage  image,
int  firstIndex,
int  secondIndex 
)

Swaps two slices of a texture array.

Parameters
imageThe image.
firstIndexThe index of the first sub-image.
secondIndexThe index of the second sub-image

Definition at line 819 of file TextureTool.cs.

void SiliconStudio.TextureConverter.TextureTool.SwitchChannel ( TexImage  image)

Switches the channel R and B.

PVR texture and ATC library can't handle BGRA order, channels B and R must be switched to get the new order RGBA. (This switch is made automatically) If the image is in a compressed format, it will be first decompressed.

Parameters
imageThe image.

Definition at line 462 of file TextureTool.cs.

References DirectX.Decompress(), and SiliconStudio.TextureConverter.TexImage.Format.

void SiliconStudio.TextureConverter.TextureTool.Update ( TexAtlas  atlas,
TexImage  texture,
string  name = "" 
)

Updates a specific texture in the atlas with the given TexImage.

Parameters
atlasThe atlas.
textureThe texture.
nameThe name of the texture to update (takes the TexImage's name if none given).
Exceptions
TextureToolsExceptionYou must either set the Name attribute of the TexImage, or you must give the name of the texture to update in the atlas. or The new texture can't be a texture array.

Definition at line 988 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize, and SiliconStudio.TextureConverter.TexImage.Name.

void SiliconStudio.TextureConverter.TextureTool.Update ( TexImage  array,
TexImage  texture,
int  indice 
)

Updates a specific texture in the texture array with the given TexImage.

Parameters
arrayThe array.
textureThe texture.
indiceThe indice.
Exceptions
TextureToolsExceptionThe first given texture must be an array texture. or The given indice is out of range in the array texture.

Definition at line 1023 of file TextureTool.cs.

References SiliconStudio.TextureConverter.TexImage.ArraySize.


The documentation for this class was generated from the following file: