MaterialInterface
Class
Read time 27 minutesLast updated 8 months ago
Inheritance
Inherited Members
Namespace: UnityEngine.Pixyz.Material
public class MaterialInterface : Interface
Methods
GetLastError
public static string GetLastError()
Returns
Type | Description |
|---|---|
| string |
AddUniformProperty
Add a shader uniform parameter to the given custom pattern.
[HandleProcessCorruptedStateExceptions]public void AddUniformProperty(uint pattern, string name, ShaderUniformType type)
Parameters
Type | Name | Description |
|---|---|---|
| uint | pattern | The custom pattern to edit. |
| string | name | Name of the new property. |
| ShaderUniformType | type | Type of the new uniform. |
AreOpaques
Check if some materials are opaques. Function will return 'False' for each material if:
- The 'Opacity' Coeff is not 1.0
- The 'Opacity' property is a Texture
- The 'Albedo' property is a Texture and at least one pixel of the texture has an alpha value.
[HandleProcessCorruptedStateExceptions]public BoolList AreOpaques(MaterialList materials)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialList | materials | Materials to check opacity. |
Returns
Type | Description |
|---|---|
| BoolList |
ClearAllMaterials
Remove and delete all the materials.
[HandleProcessCorruptedStateExceptions]public void ClearAllMaterials()
ConfigureFunctionLogger
[HandleProcessCorruptedStateExceptions]public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
Parameters
ConvertHeightMapToNormalMap
Convert a height map to a normal map.
[HandleProcessCorruptedStateExceptions]public uint ConvertHeightMapToNormalMap(uint hmap, double height = 0.5)
Parameters
Returns
Type | Description |
|---|---|
| uint |
ConvertNormalMapToHeightMap
[HandleProcessCorruptedStateExceptions]public uint ConvertNormalMapToHeightMap(uint nmap, double height = 0.5)
Parameters
Returns
Type | Description |
|---|---|
| uint |
CopyMaterial
Copies a material.
[HandleProcessCorruptedStateExceptions]public uint CopyMaterial(uint toCopy, bool addToMaterialLibrary)
Parameters
Returns
Type | Description |
|---|---|
| uint |
CreateCustomMaterialPattern
Create a new custom material pattern.
[HandleProcessCorruptedStateExceptions]public uint CreateCustomMaterialPattern(string name)
Parameters
Type | Name | Description |
|---|---|---|
| string | name | Name of the pattern. |
Returns
Type | Description |
|---|---|
| uint |
CreateMaterial
Create a new material from pattern.
[HandleProcessCorruptedStateExceptions]public uint CreateMaterial(string name, string pattern, bool addToMaterialLibrary = true)
Parameters
Type | Name | Description |
|---|---|---|
| string | name | Name of the material. |
| string | pattern | Name of the pattern. |
| bool | addToMaterialLibrary | Name of the pattern. |
Returns
Type | Description |
|---|---|
| uint |
CreateMaterialFromDefinition
Create PBR material from a material definition.
[HandleProcessCorruptedStateExceptions]public uint CreateMaterialFromDefinition(MaterialDefinition materialDefinition)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialDefinition | materialDefinition | The structure containing all the PBR material information. |
Returns
Type | Description |
|---|---|
| uint |
CreateMaterialsFromDefinitions
Create PBR materials from material definitions.
[HandleProcessCorruptedStateExceptions]public MaterialList CreateMaterialsFromDefinitions(MaterialDefinitionList materialDefinitions)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialDefinitionList | materialDefinitions | Material definitions containing properties for each given material. |
Returns
Type | Description |
|---|---|
| MaterialList |
CreateMaterialsFromMaps
Automatically creates PBR materials when importing PBR texture maps from a folder.
[HandleProcessCorruptedStateExceptions]public MaterialFromMapsReturn CreateMaterialsFromMaps(string directory)
Parameters
Type | Name | Description |
|---|---|---|
| string | directory | Directory path. |
Returns
Type | Description |
|---|---|
| MaterialFromMapsReturn |
FilterAO
Filter an AO map using ATrous method.
[HandleProcessCorruptedStateExceptions]public ImageList FilterAO(ImageList aoMaps, ImageList normalMaps, double sigmaPos = 2, double sigmaValue = 0.2, double sigmaNormal = 0.2, int levelCount = 4, bool filterLowValues = true, double lowValueThreshold = 0.01)
Parameters
Type | Name | Description |
|---|---|---|
| ImageList | aoMaps | Input AO Maps (the alpha component must be set to 0 for unused pixels). |
| ImageList | normalMaps | Input Normal Maps (preferable to use World space normal maps, but Object space normal maps can be used too). |
| double | sigmaPos | ATrous Sigma pos. |
| double | sigmaValue | ATrous Sigma value. |
| double | sigmaNormal | ATrous Sigma normal. |
| int | levelCount | Atrous #Levels. |
| bool | filterLowValues | Remove low values from the filtering (see: lowValuesThreshold parameter). |
| double | lowValueThreshold | Threshold used if filterLowValues is enabled. |
Returns
Type | Description |
|---|---|
| ImageList |
FindCustomMaterialPatternByName
Returns the material pattern which has the given name.
[HandleProcessCorruptedStateExceptions]public uint FindCustomMaterialPatternByName(string name)
Parameters
Type | Name | Description |
|---|---|---|
| string | name | The name of the material pattern. |
Returns
Type | Description |
|---|---|
| uint |
FindMaterialsByPattern
Returns all materials using the given pattern.
[HandleProcessCorruptedStateExceptions]public MaterialList FindMaterialsByPattern(string pattern)
Parameters
Type | Name | Description |
|---|---|---|
| string | pattern | A material pattern. |
Returns
Type | Description |
|---|---|
| MaterialList |
FindMaterialsByProperty
Returns all materials which match a given property value.
[HandleProcessCorruptedStateExceptions]public MaterialList FindMaterialsByProperty(string propertyName, string propertyValue, bool caseInsensitive = false)
Parameters
Type | Name | Description |
|---|---|---|
| string | propertyName | Name of the property to match. |
| string | propertyValue | Regular expression to match for the property value. |
| bool | caseInsensitive | If True, the regex will be insensitive to upper and lower cases. |
Returns
Type | Description |
|---|---|
| MaterialList |
GenerateColorFromIndex
Generate a unique color from an index (only 16M differents color can be generated, if index is greater than 16777216, the color is not guaranted to be unique).
[HandleProcessCorruptedStateExceptions]public Color GenerateColorFromIndex(int index)
Parameters
Type | Name | Description |
|---|---|---|
| int | index | Index. |
Returns
Type | Description |
|---|---|
| Color |
GenerateUniqueColors
Generate a set of unique colors (max 16M differents color can be generated, if count is greater than 16777216, the colors are not guaranted to be unique).
[HandleProcessCorruptedStateExceptions]public ColorList GenerateUniqueColors(int count)
Parameters
Type | Name | Description |
|---|---|---|
| int | count | Number of unique colors to generate. |
Returns
Type | Description |
|---|---|
| ColorList |
GetAllMaterialPatterns
Returns all the material patterns in the current session.
[HandleProcessCorruptedStateExceptions]public StringList GetAllMaterialPatterns()
Returns
Type | Description |
|---|---|
| StringList |
GetAllMaterials
Retrieve the list of all the materials in the material library.
[HandleProcessCorruptedStateExceptions]public MaterialList GetAllMaterials()
Returns
Type | Description |
|---|---|
| MaterialList |
GetColorMaterialInfos
Get color material properties.
[HandleProcessCorruptedStateExceptions]public ColorMaterialInfos GetColorMaterialInfos(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to get properties. |
Returns
Type | Description |
|---|---|
| ColorMaterialInfos |
GetCustomMaterialPattern
Returns the custom material pattern associated to the custom material.
[HandleProcessCorruptedStateExceptions]public uint GetCustomMaterialPattern(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | Custom material to get the pattern from. |
Returns
Type | Description |
|---|---|
| uint |
GetImpostorMaterialInfos
Get impostor texture material properties.
[HandleProcessCorruptedStateExceptions]public ImpostorMaterialInfos GetImpostorMaterialInfos(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to get properties. |
Returns
Type | Description |
|---|---|
| ImpostorMaterialInfos |
GetMaterialDefinition
Returns the properties of a PBR Material.
[HandleProcessCorruptedStateExceptions]public MaterialDefinition GetMaterialDefinition(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The PBR Material. |
Returns
Type | Description |
|---|---|
| MaterialDefinition |
GetMaterialDefinitions
Returns the properties of a set of PBR Materials.
[HandleProcessCorruptedStateExceptions]public MaterialDefinitionList GetMaterialDefinitions(MaterialList materials)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialList | materials | The PBR Materials. |
Returns
Type | Description |
|---|---|
| MaterialDefinitionList |
GetMaterialMainColor
Get the main color on any material pattern type.
[HandleProcessCorruptedStateExceptions]public ColorAlpha GetMaterialMainColor(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material. |
Returns
Type | Description |
|---|---|
| ColorAlpha |
GetMaterialPattern
Gets the MaterialPattern name of the material.
[HandleProcessCorruptedStateExceptions]public string GetMaterialPattern(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to find the pattern. |
Returns
Type | Description |
|---|---|
| string |
GetMaterialPatternType
Returns the MaterialPatternType name of the material.
[HandleProcessCorruptedStateExceptions]public MaterialPatternType GetMaterialPatternType(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to find the pattern. |
Returns
Type | Description |
|---|---|
| MaterialPatternType |
GetPBRMaterialInfos
Get PBR material properties.
[HandleProcessCorruptedStateExceptions]public PBRMaterialInfos GetPBRMaterialInfos(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to get properties. |
Returns
Type | Description |
|---|---|
| PBRMaterialInfos |
GetPointsAndMaterialFromText
Returns a list of 3D Points and a material from a string and a fontname.
[HandleProcessCorruptedStateExceptions]public GetPointsAndMaterialFromTextReturn GetPointsAndMaterialFromText(string text, string fontName, int fontSize, Matrix4 matrix, Color colorInput, double offset = 0, double height3D = 0)
Parameters
Type | Name | Description |
|---|---|---|
| string | text | Input text. |
| string | fontName | Fontname. |
| int | fontSize | FontSize. |
| Matrix4 | matrix | Input matrix for the text. |
| Color | colorInput | Color of the font needed. |
| double | offset | Input offset for the text. |
| double | height3D | Input height in 3D which will be a ratio from the textSize. |
Returns
Type | Description |
|---|---|
| GetPointsAndMaterialFromTextReturn |
GetStandardMaterialInfos
Get standard material properties.
[HandleProcessCorruptedStateExceptions]public StandardMaterialInfos GetStandardMaterialInfos(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to get properties. |
Returns
Type | Description |
|---|---|
| StandardMaterialInfos |
GetUniformPropertyType
Get a shader uniform shader property type.
[HandleProcessCorruptedStateExceptions]public ShaderUniformType GetUniformPropertyType(uint pattern, string name)
Parameters
Type | Name | Description |
|---|---|---|
| uint | pattern | The custom pattern. |
| string | name | Name of the property to get the type from. |
Returns
Type | Description |
|---|---|
| ShaderUniformType |
GetUnlitTextureMaterialInfos
Get unlit texture material properties.
[HandleProcessCorruptedStateExceptions]public UnlitTextureMaterialInfos GetUnlitTextureMaterialInfos(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to get properties. |
Returns
Type | Description |
|---|---|
| UnlitTextureMaterialInfos |
IsOpaque
Check if material is opaque. Function will return 'False' if:
- The 'Opacity' Coeff is not 1.0
- The 'Opacity' property is a Texture
- The 'Albedo' property is a Texture and at least one pixel of the texture has an alpha value.
[HandleProcessCorruptedStateExceptions]public bool IsOpaque(uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | Material to check opacity. |
Returns
Type | Description |
|---|---|
| bool |
MakeMaterialNamesUnique
Rename materials to have a unique name for each one.
[HandleProcessCorruptedStateExceptions]public void MakeMaterialNamesUnique(MaterialList materials = null)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialList | materials | Materials to rename (rename all materials if empty). |
RemapIndexMap
Create remapped versions of index maps.
[HandleProcessCorruptedStateExceptions]public RemapIndexMapReturn RemapIndexMap(ImageList maps, int maxIndices)
Parameters
Returns
Type | Description |
|---|---|
| RemapIndexMapReturn |
SetCoeffOrTextureProperty
Set a CoeffOrTexture property.
[HandleProcessCorruptedStateExceptions]public void SetCoeffOrTextureProperty(uint material, string name, CoeffOrTexture coeffOrTexture)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to apply the color on. |
| string | name | The property to set. |
| CoeffOrTexture | coeffOrTexture | The CoeffOrTexture to apply. |
SetColorAlphaProperty
Set a ColorAlpha property.
[HandleProcessCorruptedStateExceptions]public void SetColorAlphaProperty(uint material, string name, ColorAlpha color)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to apply the color on. |
| string | name | The property to set. |
| ColorAlpha | color | The color to apply. |
SetColorOrTextureProperty
Set a ColorOrTexture property.
[HandleProcessCorruptedStateExceptions]public void SetColorOrTextureProperty(uint material, string name, ColorOrTexture colorOrTexture)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to apply the color on. |
| string | name | The property to set. |
| ColorOrTexture | colorOrTexture | The ColorOrTexture to apply. |
SetFragmentShader
Set the fragment shader of a custom pattern.
[HandleProcessCorruptedStateExceptions]public void SetFragmentShader(uint pattern, string code)
Parameters
Type | Name | Description |
|---|---|---|
| uint | pattern | The custom pattern to edit. |
| string | code | The GLSL code of the fragment shader. |
SetMaterialMainColor
Set the main color on any material pattern type.
[HandleProcessCorruptedStateExceptions]public void SetMaterialMainColor(uint material, ColorAlpha color)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to apply the color on. |
| ColorAlpha | color | The color to apply. |
SetMaterialPattern
Sets the MaterialPattern name of the material.
[HandleProcessCorruptedStateExceptions]public void SetMaterialPattern(uint material, string pattern)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to find the pattern. |
| string | pattern | The pattern of the material. |
SetPBRMaterialInfos
Set PBR material properties.
[HandleProcessCorruptedStateExceptions]public void SetPBRMaterialInfos(uint material, PBRMaterialInfos infos)
Parameters
Type | Name | Description |
|---|---|---|
| uint | material | The material to set properties. |
| PBRMaterialInfos | infos | The PBRMaterialInfos properties. |
SetVertexShader
Set the vertex shader of a custom pattern.
[HandleProcessCorruptedStateExceptions]public void SetVertexShader(uint pattern, string code)
Parameters
Type | Name | Description |
|---|---|---|
| uint | pattern | The custom pattern to edit. |
| string | code | The GLSL code of the vertex shader. |
AddImageChangedCallback
public uint AddImageChangedCallback(MaterialInterface.ImageChangedDelegate callback, IntPtr userData)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialInterface.ImageChangedDelegate | callback | |
| IntPtr | userData |
Returns
Type | Description |
|---|---|
| uint |
RemoveImageChangedCallback
public void RemoveImageChangedCallback(uint id)
Parameters
Type | Name | Description |
|---|---|---|
| uint | id |
AddMaterialChangedCallback
public uint AddMaterialChangedCallback(MaterialInterface.MaterialChangedDelegate callback, IntPtr userData)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialInterface.MaterialChangedDelegate | callback | |
| IntPtr | userData |
Returns
Type | Description |
|---|---|
| uint |
RemoveMaterialChangedCallback
public void RemoveMaterialChangedCallback(uint id)
Parameters
Type | Name | Description |
|---|---|---|
| uint | id |
ApplyFactorOnImage
Aplly a factor to an image.
[HandleProcessCorruptedStateExceptions]public void ApplyFactorOnImage(uint image, bool imageIsLinear, ColorAlpha factor)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to be modified. |
| bool | imageIsLinear | Image is linear or not. |
| ColorAlpha | factor | Factor to apply. |
BlurImage
Applies a blurring to the given image.
[HandleProcessCorruptedStateExceptions]public void BlurImage(uint image, int radius, BlurFilter blurType, EdgeFilter edgeFilter)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to blur. |
| int | radius | Radius in pixels of the Gaussian kernel. |
| BlurFilter | blurType | Kernel of the blur filter to apply. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
ClearImageRoI
Removes the region of interest from an image.
[HandleProcessCorruptedStateExceptions]public void ClearImageRoI(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
ConvertFloat32To8BitsImage
Returns a new image from the given converter from 32bits float to a 8Bits (e.g. depth render map).
[HandleProcessCorruptedStateExceptions]public uint ConvertFloat32To8BitsImage(uint image32F, double minValue = -1, double maxValue = 1, bool inPlace = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image32F | Image to convert. |
| double | minValue | Minimal value of the floats (will be 0 in 8bits). |
| double | maxValue | Minimal value of the floats (will be 255 in 8bits). |
| bool | inPlace | If true, the given image is modified instead of creating a new one. |
Returns
Type | Description |
|---|---|
| uint |
ConvertImage
Converts the given image to a new format.
[HandleProcessCorruptedStateExceptions]public uint ConvertImage(uint image, ImageLayout layout, ImageComponentType type, bool inPlace = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to convert. |
| ImageLayout | layout | Layout (components definition) of the new image format. Accepted values are combinations of the following: 'R' (red), 'G' (green), 'B' (blue), 'A' (alpha), 'L' (luminance), 'S' (stencil index) and 'D' (depth component). |
| ImageComponentType | type | Component data type of the new image format. |
| bool | inPlace | If true, the given image is modified instead of creating a new one. |
Returns
Type | Description |
|---|---|
| uint |
ConvertImageToDefinition
Returns an image definition which contains data corresponding to the given image converted to a new format.
[HandleProcessCorruptedStateExceptions]public ImageDefinition ConvertImageToDefinition(uint image, ImageLayout layout, ImageComponentType type)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to convert. |
| ImageLayout | layout | Layout (components definition) of the new image format. Accepted values are combinations of the following: 'R' (red), 'G' (green), 'B' (blue), 'A' (alpha), 'L' (luminance), 'S' (stencil index) and 'D' (depth component). |
| ImageComponentType | type | Component data type of the new image format. |
Returns
Type | Description |
|---|---|
| ImageDefinition |
CreateCheckerboardImage
Create an image consisting in a black and white checkerboard.
[HandleProcessCorruptedStateExceptions]public uint CreateCheckerboardImage(int width, int height, int cellSize, ColorAlpha? color1 = null, ColorAlpha? color2 = null, ImageLayout layout = ImageLayout.RGB, ImageComponentType type = ImageComponentType.UInt8_Norm)
Parameters
Type | Name | Description |
|---|---|---|
| int | width | Width desired for the created image. |
| int | height | Height desired for the created image. |
| int | cellSize | Size of checkerboard cells (in pixels). |
| ColorAlpha | color1 | First checkerboard color. |
| ColorAlpha | color2 | Second checkerboard color. |
| ImageLayout | layout | Desired image layout. |
| ImageComponentType | type | Desired image component type. |
Returns
Type | Description |
|---|---|
| uint |
CreateImageFromData
Import an Image from only its data.
[HandleProcessCorruptedStateExceptions]public uint CreateImageFromData(ByteList data, string name = "img")
Parameters
Returns
Type | Description |
|---|---|
| uint |
CreateImageFromDefinition
Import an image from its raw data.
[HandleProcessCorruptedStateExceptions]public uint CreateImageFromDefinition(ImageDefinition imageDefinition)
Parameters
Type | Name | Description |
|---|---|---|
| ImageDefinition | imageDefinition | The image definition. |
Returns
Type | Description |
|---|---|
| uint |
CreateImagesFromDefinitions
Import images from their raw data.
[HandleProcessCorruptedStateExceptions]public ImageList CreateImagesFromDefinitions(ImageDefinitionList imageDefinitions)
Parameters
Type | Name | Description |
|---|---|---|
| ImageDefinitionList | imageDefinitions | The image definitions. |
Returns
Type | Description |
|---|---|
| ImageList |
ExportImage
Export an image.
[HandleProcessCorruptedStateExceptions]public void ExportImage(uint image, string filename)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Identifier of the image to export. |
| string | filename | Filename of the file to export. |
ExtractImageChannels
Creates new images from individual channels of the given image.
[HandleProcessCorruptedStateExceptions]public ImageList ExtractImageChannels(uint image, int channel = -1)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to convert. |
| int | channel | Number of the channel to extract. -1 extracts all channels. |
Returns
Type | Description |
|---|---|
| ImageList |
ExtractImageComponents
Creates new images from individual components of the given image.
[HandleProcessCorruptedStateExceptions]public ImageList ExtractImageComponents(uint image, ImageLayout components)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to convert. |
| ImageLayout | components | Name of the components to extract. Accepted values: 'R' (red), 'G' (green), 'B' (blue), 'A' (alpha), 'L' (luminance). |
Returns
Type | Description |
|---|---|
| ImageList |
FillImageWithColor
Fills an image (or a sub-part of it) with the provided color.
[HandleProcessCorruptedStateExceptions]public void FillImageWithColor(uint image, ColorAlpha color, int x = 0, int y = 0, int w = -1, int h = -1)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image from which type has to be fetched. |
| ColorAlpha | color | Filling color. |
| int | x | Image X coordinate of the sub-image to fill. |
| int | y | Image Y coordinate of the sub-image to fill. |
| int | w | Width of the sub-image to fill (-1 means infinite width). |
| int | h | Height of the sub-image to fill (-1 means infinite height). |
FillUnusedPixels
Fill unused pixels by propagating and averaging used pixels.
[HandleProcessCorruptedStateExceptions]public uint FillUnusedPixels(uint image, ColorAlpha? unusedColor = null, int size = -1, uint validityMask = 0, bool inPlace = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| ColorAlpha | unusedColor | Color used to identify unused pixels. |
| int | size | Dilation size in pixels. |
| uint | validityMask | Image describing which texels are valid (color set to white) and which ones need to be filled (color set to black). If zero, unusedColor is used instead. |
| bool | inPlace | If True, the source image is modified. Otherwise, a new one is created. |
Returns
Type | Description |
|---|---|
| uint |
FlipImageY
Applies a vertical flip to an image.
[HandleProcessCorruptedStateExceptions]public void FlipImageY(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to flip. |
GetAllImages
Returns all the images loaded in the current session or from a list of materials.
[HandleProcessCorruptedStateExceptions]public ImageList GetAllImages(MaterialList materials = null)
Parameters
Type | Name | Description |
|---|---|---|
| MaterialList | materials | Materials to retrieve the images from (returns all images loaded in the current session if empty). |
Returns
Type | Description |
|---|---|
| ImageList |
GetExportImageFormats
Returns image format names and extensions which can be exported in Pixyz.
[HandleProcessCorruptedStateExceptions]public FormatList GetExportImageFormats()
Returns
Type | Description |
|---|---|
| FormatList |
GetImageColorBilinear
Returns the color at a specific image point, in real coordinates, using bi-linear interpolation.
[HandleProcessCorruptedStateExceptions]public ColorAlpha GetImageColorBilinear(uint image, double x, double y, EdgeFilter edgeFilter = EdgeFilter.Clamp)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | The image to get the color from. |
| double | x | Image X coordinate (real). |
| double | y | Image Y coordinate (real). |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
Returns
Type | Description |
|---|---|
| ColorAlpha |
GetImageColorRange
Gets the min and max bounds of each image color component.
[HandleProcessCorruptedStateExceptions]public ColorAlphaList GetImageColorRange(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Source image. |
Returns
Type | Description |
|---|---|
| ColorAlphaList |
GetImageComponentType
Gets the component data type of the given image.
[HandleProcessCorruptedStateExceptions]public ImageComponentType GetImageComponentType(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image from which type has to be fetched. |
Returns
Type | Description |
|---|---|
| ImageComponentType |
GetImageComponentTypeName
Gets the name of a given component data type ID.
[HandleProcessCorruptedStateExceptions]public string GetImageComponentTypeName(ImageComponentType type)
Parameters
Type | Name | Description |
|---|---|---|
| ImageComponentType | type |
Returns
Type | Description |
|---|---|
| string |
GetImageDefinition
Returns the raw data of an image.
[HandleProcessCorruptedStateExceptions]public ImageDefinition GetImageDefinition(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Source image. |
Returns
Type | Description |
|---|---|
| ImageDefinition |
GetImageDefinitions
Returns the raw data of a set of images.
[HandleProcessCorruptedStateExceptions]public ImageDefinitionList GetImageDefinitions(ImageList images)
Parameters
Type | Name | Description |
|---|---|---|
| ImageList | images | The images. |
Returns
Type | Description |
|---|---|
| ImageDefinitionList |
GetImageFormatName
Gets a comprenhensive name from an image format.
[HandleProcessCorruptedStateExceptions]public string GetImageFormatName(ImageLayout layout, ImageComponentType type)
Parameters
Type | Name | Description |
|---|---|---|
| ImageLayout | layout | |
| ImageComponentType | type |
Returns
Type | Description |
|---|---|
| string |
GetImageLayout
Gets the layout (component definitions) of the given image.
[HandleProcessCorruptedStateExceptions]public ImageLayout GetImageLayout(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image from which layout has to be fetched. |
Returns
Type | Description |
|---|---|
| ImageLayout |
GetImagePixelColor
Returns the color of a given pixel in an image.
[HandleProcessCorruptedStateExceptions]public ColorAlpha GetImagePixelColor(uint image, int x, int y)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | The image to get the pixel from. |
| int | x | The X pixel coordinate. |
| int | y | The Y pixel coordinate. |
Returns
Type | Description |
|---|---|
| ColorAlpha |
GetImagePixelInfo
Returns info about the image pixel format.
[HandleProcessCorruptedStateExceptions]public PixelInfo GetImagePixelInfo(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Source image. |
Returns
Type | Description |
|---|---|
| PixelInfo |
GetImagePixelInfoFromDefinition
Returns info about the image pixel format.
[HandleProcessCorruptedStateExceptions]public PixelInfo GetImagePixelInfoFromDefinition(ImageDefinition imageDefinition)
Parameters
Type | Name | Description |
|---|---|---|
| ImageDefinition | imageDefinition | Source image. |
Returns
Type | Description |
|---|---|
| PixelInfo |
GetImagePixelInfoFromLayoutAndType
Returns info about the image pixel format for a given combination of image layout and component type.
[HandleProcessCorruptedStateExceptions]public PixelInfo GetImagePixelInfoFromLayoutAndType(ImageLayout layout, ImageComponentType type)
Parameters
Type | Name | Description |
|---|---|---|
| ImageLayout | layout | Image layout (components definition). |
| ImageComponentType | type | Image component data type. |
Returns
Type | Description |
|---|---|
| PixelInfo |
GetImageRoI
Returns the region of interest of an image.
[HandleProcessCorruptedStateExceptions]public RoI GetImageRoI(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
Returns
Type | Description |
|---|---|
| RoI |
GetImageSize
Returns the size of an image.
[HandleProcessCorruptedStateExceptions]public GetImageSizeReturn GetImageSize(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | The image to get the size from. |
Returns
Type | Description |
|---|---|
| GetImageSizeReturn |
GetImagesSizes
Returns the sizes of multiple images.
[HandleProcessCorruptedStateExceptions]public GetImagesSizesReturn GetImagesSizes(ImageList images)
Parameters
Type | Name | Description |
|---|---|---|
| ImageList | images | The image to get the size from. |
Returns
Type | Description |
|---|---|
| GetImagesSizesReturn |
GetImportImageFormats
Returns the image format names and extensions which can be imported in Pixyz.
[HandleProcessCorruptedStateExceptions]public FormatList GetImportImageFormats()
Returns
Type | Description |
|---|---|
| FormatList |
GetSubImage
Extracts a sub-part of the given image.
[HandleProcessCorruptedStateExceptions]public uint GetSubImage(uint image, int x, int y, int w, int h)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Source image. |
| int | x | Image X coordinate of the sub-image to extract. |
| int | y | Image Y coordinate of the sub-image to extract. |
| int | w | Width of the sub-image to extract. |
| int | h | Height of the sub-image to extract. |
Returns
Type | Description |
|---|---|
| uint |
ImportImage
Import an image.
[HandleProcessCorruptedStateExceptions]public uint ImportImage(string filename)
Parameters
Type | Name | Description |
|---|---|---|
| string | filename | Filename of the image to import. |
Returns
Type | Description |
|---|---|
| uint |
InvertImageColor
Inverts the color of all image pixels.
[HandleProcessCorruptedStateExceptions]public void InvertImageColor(uint image)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to invert. |
OverrideImageFormat
Changes the way image channels are interpreted by assigning a new format without modifying the data. Note that the new format must be compatible with the previous one, which means that they have to have the same number of bytes per pixel.
[HandleProcessCorruptedStateExceptions]public bool OverrideImageFormat(uint image, ImageLayout layout = ImageLayout.Undefined, ImageComponentType type = ImageComponentType.Undefined)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image for format must be overridden. |
| ImageLayout | layout | New layout (keep the original one if set to Undefined). |
| ImageComponentType | type | New component type (keep the original one if set to Undefined). |
Returns
Type | Description |
|---|---|
| bool |
ResizeImage
Resize an image.
[HandleProcessCorruptedStateExceptions]public void ResizeImage(uint image, int width, int height, ResizeFilterMethod filteringMethod = ResizeFilterMethod.DEFAULT)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to be resize. |
| int | width | New image width. |
| int | height | New image height. |
| ResizeFilterMethod | filteringMethod | Filtering method for image resizing. |
RotateImage
Applies a rotation to (the sub-part of) an image.
[HandleProcessCorruptedStateExceptions]public void RotateImage(uint image, double angle, double cx, double cy, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| double | angle | Rotation angle (in degrees). |
| double | cx | X coordinate of the transformation center. |
| double | cy | Y coordinate of the transformation center. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
| bool | adjustSize | Adjust the dimensions of the image to fit the transformation. |
SetImageRoI
Defines the region of interest of an image.
[HandleProcessCorruptedStateExceptions]public void SetImageRoI(uint image, int x, int y, int w, int h)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| int | x | X coordinate of the RoI origin. |
| int | y | Y coordinate of the RoI origin. |
| int | w | Width of the RoI. |
| int | h | Height of the RoI. |
SetSubImage
Replaces a part of a given image by another one.
[HandleProcessCorruptedStateExceptions]public void SetSubImage(uint destination, uint subImage, int x, int y, EdgeFilter edgeFilter = EdgeFilter.Clamp)
Parameters
Type | Name | Description |
|---|---|---|
| uint | destination | Destination image. |
| uint | subImage | Source image. |
| int | x | X coordinate where to copy sub-image. |
| int | y | Y coordinate where to copy sub-image. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
StretchImage
Applies a non-uniform scale to (the sub-part of) an image.
[HandleProcessCorruptedStateExceptions]public void StretchImage(uint image, double sx, double sy, double cx, double cy, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| double | sx | Scale factor along X axis. |
| double | sy | Scale factor along Y axis. |
| double | cx | X coordinate of the transformation center. |
| double | cy | Y coordinate of the transformation center. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
| bool | adjustSize | Adjust the dimensions of the image to fit the transformation. |
TransformImage
Applies a transformation matrix to (the sub-part of) an image.
[HandleProcessCorruptedStateExceptions]public void TransformImage(uint image, Matrix3 matrix, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| Matrix3 | matrix | Transformation matrix. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
| bool | adjustSize | Adjust the dimensions of the image to fit the transformation. |
TranslateImage
Applies a translation to (the sub-part of) an image.
[HandleProcessCorruptedStateExceptions]public void TranslateImage(uint image, double tx, double ty, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | Image to process. |
| double | tx | X translation. |
| double | ty | Y translation. |
| EdgeFilter | edgeFilter | Method to use for the management of boundary pixels. |
| bool | adjustSize | Adjust the dimensions of the image to fit the transformation. |
UpdateImageFromDefinition
Update an image from its raw data.
[HandleProcessCorruptedStateExceptions]public void UpdateImageFromDefinition(uint image, ImageDefinition imageDefinition)
Parameters
Type | Name | Description |
|---|---|---|
| uint | image | The image to update. |
| ImageDefinition | imageDefinition | The new data to apply. |
UpdateImagesFromDefinitions
Update images from their raw data.
[HandleProcessCorruptedStateExceptions]public void UpdateImagesFromDefinitions(ImageList image, ImageDefinitionList imageDefinitions)
Parameters
Type | Name | Description |
|---|---|---|
| ImageList | image | The image to update. |
| ImageDefinitionList | imageDefinitions | The new data to apply. |
GetMaterialUserData
Set or replace a userdata stored on an material.
[HandleProcessCorruptedStateExceptions]public IntPtr GetMaterialUserData(uint userDataId, uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| uint | material | Material that store the user data. |
Returns
Type | Description |
|---|---|
| IntPtr |
GetMultipleMaterialUserData
Batch version of getMaterialUserData.
[HandleProcessCorruptedStateExceptions]public PtrList GetMultipleMaterialUserData(uint userDataId, MaterialList materials)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| MaterialList | materials | Materials that store the user data. |
Returns
Type | Description |
|---|---|
| PtrList |
HasMaterialUserData
Set or replace a userdata stored on an material.
[HandleProcessCorruptedStateExceptions]public bool HasMaterialUserData(uint userDataId, uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| uint | material | Material that potentially store the user data. |
Returns
Type | Description |
|---|---|
| bool |
HasMultipleMaterialUserData
Batch version of hasMaterialUserData.
[HandleProcessCorruptedStateExceptions]public BoolList HasMultipleMaterialUserData(uint userDataId, MaterialList materials)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| MaterialList | materials | Materials that potentially store the user data. |
Returns
Type | Description |
|---|---|
| BoolList |
SetMaterialUserData
Set or replace a userdata stored on an material.
[HandleProcessCorruptedStateExceptions]public void SetMaterialUserData(uint userDataId, uint material, IntPtr userData)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| uint | material | Material that will store the user data. |
| IntPtr | userData | User data to store in the given material. |
SetMultipleMaterialUserData
Batch version of setMaterialUserData.
[HandleProcessCorruptedStateExceptions]public void SetMultipleMaterialUserData(uint userDataId, MaterialList materials, PtrList userDataList)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| MaterialList | materials | Materials that will store the user data. |
| PtrList | userDataList | User data to store on each material. |
SubscribeToMaterialUserData
Subscribe to material user data. multiple different userdata can be stored on the same materials if subscribeToMaterialUserData is called multiple times.
[HandleProcessCorruptedStateExceptions]public uint SubscribeToMaterialUserData()
Returns
Type | Description |
|---|---|
| uint |
UnsetMaterialUserData
Unset the userdata stored on an material.
[HandleProcessCorruptedStateExceptions]public void UnsetMaterialUserData(uint userDataId, uint material)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| uint | material | Material that will store the user data. |
UnsetMultipleMaterialUserData
Batch version of unsetMaterialUserData.
[HandleProcessCorruptedStateExceptions]public void UnsetMultipleMaterialUserData(uint userDataId, MaterialList materials)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| MaterialList | materials | Materials that will store the user data. |
UnsubscribeFromMaterialUserData
[HandleProcessCorruptedStateExceptions]public void UnsubscribeFromMaterialUserData(uint userDataId)
Parameters
Type | Name | Description |
|---|---|---|
| uint | userDataId | UserData identifier to unsubscribe. |