![]() |
Paradox Game Engine
v1.0.0 beta06
|
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...
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< TexImage > | ExtractAll (TexAtlas atlas, int minimumMipmapSize=1) |
| Extracts every TexImage included in the atlas. More... | |
| List< TexImage > | ExtractAll (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... | |
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.
| 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.
Apply a color key on the image by replacing the color passed by to this method by a white transparent color (Alpha is 0).
| image | The image. |
| colorKey | The 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.
| image | The image. |
| format | The 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.
| image | The 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.
| image | The image. |
| gamma | The 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.
| textureList | The texture list. |
| forceSquaredAtlas | boolean to decide wheter the atlas will be squared (default is false). |
| TextureToolsException | No 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.
| texImage | The image from which to take the alpha |
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.
| texImage | The original image from which to extract the region |
| region | The region from the original image to extract. |
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.
| textureList | The texture list. |
| TextureToolsException | No 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.
| textureList | The texture list. |
| TextureToolsException | No 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.
| image | The 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.
| atlas | The atlas. |
| name | The texture name. |
| minimumMipmapSize | The minimum size of the smallest mipmap. |
| TextureToolsException | You 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.
| array | The array. |
| indice | The indice. |
| minimumMipmapSize | The minimum size of the smallest mipmap. |
| TextureToolsException | The 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.
| atlas | The atlas. |
| minimumMipmapSize | The minimum size of the smallest mipmap. |
| TextureToolsException | The 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.
| array | The array. |
| minimumMipmapSize | The minimum size of the smallest mipmap. |
| TextureToolsException | The 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.
| image | The image. |
| orientation | The 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.
| image | The image. |
| index | The index of the sub-image. |
| orientation | The 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.
| image | The image. |
| filter | The 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.
| heightMap | The height map. |
| amplitude | The amplitude. |
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.
| array | The array. |
| texture | The texture to be added. |
| indice | The indice. |
| TextureToolsException | The 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.
| file | The file. |
| TextureToolsException | The 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.
| image | The image. |
The ownership of the provided image is not taken by the tex tool. The user has to dispose it him-self
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.
| layout | The layout. |
| file | The file. |
| TextureToolsException | The 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.
| layout | The layout. |
| file | The file. |
| TextureToolsException | The 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.
| image | The 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.
| array | The array. |
| indice | The indice. |
| TextureToolsException | The 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.
| image | The image. |
| widthFactor | The width factor. |
| heightFactor | The height factor. |
| filter | The 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.
| image | The image. |
| width | The width. |
| height | The height. |
| filter | The 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.
| texture | The texture. |
| layoutFile | The layout file. |
| TextureToolsException | The 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.
| image | The image. |
| fileName | Name of the file. |
| minimumMipMapSize | Minimum 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.
| image | The image. |
| fileName | Name of the file. |
| format | The new format. |
| minimumMipMapSize | Minimum 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.
| image | The image. |
| firstIndex | The index of the first sub-image. |
| secondIndex | The 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.
| image | The 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.
| atlas | The atlas. |
| texture | The texture. |
| name | The name of the texture to update (takes the TexImage's name if none given). |
| TextureToolsException | You 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.
| array | The array. |
| texture | The texture. |
| indice | The indice. |
| TextureToolsException | The 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.