# MaterialInterface

> Class

Inheritance

* [object](https://learn.microsoft.com/dotnet/api/system.object)
* [Interface](./api_interface)
* MaterialInterface

***

Inherited Members

* [Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\))

* [Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\))

* [GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

* [GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)

* [MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

* [ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

* [ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

***

Namespace: UnityEngine.Pixyz.Material

```csharp
public class MaterialInterface : Interface
```

## Methods

### GetLastError

```csharp
public static string GetLastError()
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### AddUniformProperty

Add a shader uniform parameter to the given custom pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public void AddUniformProperty(uint pattern, string name, ShaderUniformType type)
```

Parameters

| Type                                                           | Name    | Description                 |
| -------------------------------------------------------------- | ------- | --------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | pattern | The custom pattern to edit. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name    | Name of the new property.   |
| [ShaderUniformType](./material_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.

```csharp
[HandleProcessCorruptedStateExceptions]
public BoolList AreOpaques(MaterialList materials)
```

Parameters

| Type                                    | Name      | Description                 |
| --------------------------------------- | --------- | --------------------------- |
| [MaterialList](./material_materiallist) | materials | Materials to check opacity. |

Returns

| Type                        | Description |
| --------------------------- | ----------- |
| [BoolList](./core_boollist) |             |

### ClearAllMaterials

Remove and delete all the materials.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ClearAllMaterials()
```

### ConfigureFunctionLogger

```csharp
[HandleProcessCorruptedStateExceptions]
public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
```

Parameters

| Type                                                           | Name                | Description |
| -------------------------------------------------------------- | ------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | functionName        |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableFunction      |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableParameters    |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableExecutionTime |             |

### ConvertHeightMapToNormalMap

Convert a height map to a normal map.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ConvertHeightMapToNormalMap(uint hmap, double height = 0.5)
```

Parameters

| Type                                                           | Name   | Description           |
| -------------------------------------------------------------- | ------ | --------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | hmap   | Height map reference. |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | height | Maximum height.       |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CopyMaterial

Copies a material.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CopyMaterial(uint toCopy, bool addToMaterialLibrary)
```

Parameters

| Type                                                          | Name                 | Description              |
| ------------------------------------------------------------- | -------------------- | ------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | toCopy               | Material to copy.        |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | addToMaterialLibrary | Add to material library. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateCustomMaterialPattern

Create a new custom material pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateCustomMaterialPattern(string name)
```

Parameters

| Type                                                           | Name | Description          |
| -------------------------------------------------------------- | ---- | -------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name | Name of the pattern. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateMaterial

Create a new material from pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateMaterial(string name, string pattern, bool addToMaterialLibrary = true)
```

Parameters

| Type                                                           | Name                 | Description           |
| -------------------------------------------------------------- | -------------------- | --------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name                 | Name of the material. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | pattern              | Name of the pattern.  |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | addToMaterialLibrary | Name of the pattern.  |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateMaterialFromDefinition

Create PBR material from a material definition.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateMaterialFromDefinition(MaterialDefinition materialDefinition)
```

Parameters

| Type                                                | Name               | Description                                                |
| --------------------------------------------------- | ------------------ | ---------------------------------------------------------- |
| [MaterialDefinition](./material_materialdefinition) | materialDefinition | The structure containing all the PBR material information. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateMaterialsFromDefinitions

Create PBR materials from material definitions.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialList CreateMaterialsFromDefinitions(MaterialDefinitionList materialDefinitions)
```

Parameters

| Type                                                        | Name                | Description                                                         |
| ----------------------------------------------------------- | ------------------- | ------------------------------------------------------------------- |
| [MaterialDefinitionList](./material_materialdefinitionlist) | materialDefinitions | Material definitions containing properties for each given material. |

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [MaterialList](./material_materiallist) |             |

### CreateMaterialsFromMaps

Automatically creates PBR materials when importing PBR texture maps from a folder.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialFromMapsReturn CreateMaterialsFromMaps(string directory)
```

Parameters

| Type                                                           | Name      | Description     |
| -------------------------------------------------------------- | --------- | --------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | directory | Directory path. |

Returns

| Type                                                        | Description |
| ----------------------------------------------------------- | ----------- |
| [MaterialFromMapsReturn](./material_materialfrommapsreturn) |             |

### FilterAO

Filter an AO map using ATrous method.

```csharp
[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](./material_imagelist)                              | aoMaps            | Input AO Maps (the alpha component must be set to 0 for unused pixels).                                      |
| [ImageList](./material_imagelist)                              | normalMaps        | Input Normal Maps (preferable to use World space normal maps, but Object space normal maps can be used too). |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | sigmaPos          | ATrous Sigma pos.                                                                                            |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | sigmaValue        | ATrous Sigma value.                                                                                          |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | sigmaNormal       | ATrous Sigma normal.                                                                                         |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)     | levelCount        | Atrous #Levels.                                                                                              |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | filterLowValues   | Remove low values from the filtering (see: lowValuesThreshold parameter).                                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | lowValueThreshold | Threshold used if filterLowValues is enabled.                                                                |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [ImageList](./material_imagelist) |             |

### FindCustomMaterialPatternByName

Returns the material pattern which has the given name.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint FindCustomMaterialPatternByName(string name)
```

Parameters

| Type                                                           | Name | Description                       |
| -------------------------------------------------------------- | ---- | --------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name | The name of the material pattern. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### FindMaterialsByPattern

Returns all materials using the given pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialList FindMaterialsByPattern(string pattern)
```

Parameters

| Type                                                           | Name    | Description         |
| -------------------------------------------------------------- | ------- | ------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | pattern | A material pattern. |

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [MaterialList](./material_materiallist) |             |

### FindMaterialsByProperty

Returns all materials which match a given property value.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialList FindMaterialsByProperty(string propertyName, string propertyValue, bool caseInsensitive = false)
```

Parameters

| Type                                                           | Name            | Description                                                      |
| -------------------------------------------------------------- | --------------- | ---------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | propertyName    | Name of the property to match.                                   |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | propertyValue   | Regular expression to match for the property value.              |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | caseInsensitive | If True, the regex will be insensitive to upper and lower cases. |

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [MaterialList](./material_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).

```csharp
[HandleProcessCorruptedStateExceptions]
public Color GenerateColorFromIndex(int index)
```

Parameters

| Type                                                       | Name  | Description |
| ---------------------------------------------------------- | ----- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | index | Index.      |

Returns

| Type                  | Description |
| --------------------- | ----------- |
| [Color](./core_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).

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorList GenerateUniqueColors(int count)
```

Parameters

| Type                                                       | Name  | Description                          |
| ---------------------------------------------------------- | ----- | ------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | count | Number of unique colors to generate. |

Returns

| Type                          | Description |
| ----------------------------- | ----------- |
| [ColorList](./core_colorlist) |             |

### GetAllMaterialPatterns

Returns all the material patterns in the current session.

```csharp
[HandleProcessCorruptedStateExceptions]
public StringList GetAllMaterialPatterns()
```

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [StringList](./core_stringlist) |             |

### GetAllMaterials

Retrieve the list of all the materials in the material library.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialList GetAllMaterials()
```

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [MaterialList](./material_materiallist) |             |

### GetColorMaterialInfos

Get color material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorMaterialInfos GetColorMaterialInfos(uint material)
```

Parameters

| Type                                                         | Name     | Description                     |
| ------------------------------------------------------------ | -------- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to get properties. |

Returns

| Type                                                | Description |
| --------------------------------------------------- | ----------- |
| [ColorMaterialInfos](./material_colormaterialinfos) |             |

### GetCustomMaterialPattern

Returns the custom material pattern associated to the custom material.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint GetCustomMaterialPattern(uint material)
```

Parameters

| Type                                                         | Name     | Description                              |
| ------------------------------------------------------------ | -------- | ---------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | Custom material to get the pattern from. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### GetImageAverageColor

Get the average color of an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public GetImageAverageColorReturn GetImageAverageColor(uint image)
```

Parameters

| Type                                                         | Name  | Description |
| ------------------------------------------------------------ | ----- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | The image.  |

Returns

| Type                                                                | Description |
| ------------------------------------------------------------------- | ----------- |
| [GetImageAverageColorReturn](./material_getimageaveragecolorreturn) |             |

### GetImpostorMaterialInfos

Get impostor texture material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImpostorMaterialInfos GetImpostorMaterialInfos(uint material)
```

Parameters

| Type                                                         | Name     | Description                     |
| ------------------------------------------------------------ | -------- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to get properties. |

Returns

| Type                                                      | Description |
| --------------------------------------------------------- | ----------- |
| [ImpostorMaterialInfos](./material_impostormaterialinfos) |             |

### GetMaterialDefinition

Returns the properties of a PBR Material.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialDefinition GetMaterialDefinition(uint material)
```

Parameters

| Type                                                         | Name     | Description       |
| ------------------------------------------------------------ | -------- | ----------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The PBR Material. |

Returns

| Type                                                | Description |
| --------------------------------------------------- | ----------- |
| [MaterialDefinition](./material_materialdefinition) |             |

### GetMaterialDefinitions

Returns the properties of a set of PBR Materials.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialDefinitionList GetMaterialDefinitions(MaterialList materials)
```

Parameters

| Type                                    | Name      | Description        |
| --------------------------------------- | --------- | ------------------ |
| [MaterialList](./material_materiallist) | materials | The PBR Materials. |

Returns

| Type                                                        | Description |
| ----------------------------------------------------------- | ----------- |
| [MaterialDefinitionList](./material_materialdefinitionlist) |             |

### GetMaterialMainColor

Get the main color on any material pattern type.

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorAlpha GetMaterialMainColor(uint material)
```

Parameters

| Type                                                         | Name     | Description   |
| ------------------------------------------------------------ | -------- | ------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material. |

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [ColorAlpha](./core_coloralpha) |             |

### GetMaterialPattern

Gets the MaterialPattern name of the material.

```csharp
[HandleProcessCorruptedStateExceptions]
public string GetMaterialPattern(uint material)
```

Parameters

| Type                                                         | Name     | Description                       |
| ------------------------------------------------------------ | -------- | --------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to find the pattern. |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### GetMaterialPatternType

Returns the MaterialPatternType name of the material.

```csharp
[HandleProcessCorruptedStateExceptions]
public MaterialPatternType GetMaterialPatternType(uint material)
```

Parameters

| Type                                                         | Name     | Description                       |
| ------------------------------------------------------------ | -------- | --------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to find the pattern. |

Returns

| Type                                                  | Description |
| ----------------------------------------------------- | ----------- |
| [MaterialPatternType](./material_materialpatterntype) |             |

### GetPBRMaterialInfos

Get PBR  material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public PBRMaterialInfos GetPBRMaterialInfos(uint material)
```

Parameters

| Type                                                         | Name     | Description                     |
| ------------------------------------------------------------ | -------- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to get properties. |

Returns

| Type                                            | Description |
| ----------------------------------------------- | ----------- |
| [PBRMaterialInfos](./material_pbrmaterialinfos) |             |

### GetPointsAndMaterialFromText

Returns a list of 3D Points and a material from a string and a fontname.

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.string) | text       | Input text.                                                 |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | fontName   | Fontname.                                                   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)     | fontSize   | FontSize.                                                   |
| [Matrix4](./geom_matrix4)                                      | matrix     | Input matrix for the text.                                  |
| [Color](./core_color)                                          | colorInput | Color of the font needed.                                   |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | offset     | Input offset for the text.                                  |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | height3D   | Input height in 3D which will be a ratio from the textSize. |

Returns

| Type                                                                                | Description |
| ----------------------------------------------------------------------------------- | ----------- |
| [GetPointsAndMaterialFromTextReturn](./material_getpointsandmaterialfromtextreturn) |             |

### GetStandardMaterialInfos

Get standard material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public StandardMaterialInfos GetStandardMaterialInfos(uint material)
```

Parameters

| Type                                                         | Name     | Description                     |
| ------------------------------------------------------------ | -------- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to get properties. |

Returns

| Type                                                      | Description |
| --------------------------------------------------------- | ----------- |
| [StandardMaterialInfos](./material_standardmaterialinfos) |             |

### GetUniformPropertyType

Get a shader uniform shader property type.

```csharp
[HandleProcessCorruptedStateExceptions]
public ShaderUniformType GetUniformPropertyType(uint pattern, string name)
```

Parameters

| Type                                                           | Name    | Description                                |
| -------------------------------------------------------------- | ------- | ------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | pattern | The custom pattern.                        |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name    | Name of the property to get the type from. |

Returns

| Type                                              | Description |
| ------------------------------------------------- | ----------- |
| [ShaderUniformType](./material_shaderuniformtype) |             |

### GetUnlitTextureMaterialInfos

Get unlit texture material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public UnlitTextureMaterialInfos GetUnlitTextureMaterialInfos(uint material)
```

Parameters

| Type                                                         | Name     | Description                     |
| ------------------------------------------------------------ | -------- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to get properties. |

Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [UnlitTextureMaterialInfos](./material_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.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool IsOpaque(uint material)
```

Parameters

| Type                                                         | Name     | Description                |
| ------------------------------------------------------------ | -------- | -------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | Material to check opacity. |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### MakeMaterialNamesUnique

Rename materials to have a unique name for each one.

```csharp
[HandleProcessCorruptedStateExceptions]
public void MakeMaterialNamesUnique(MaterialList materials = null)
```

Parameters

| Type                                    | Name      | Description                                          |
| --------------------------------------- | --------- | ---------------------------------------------------- |
| [MaterialList](./material_materiallist) | materials | Materials to rename (rename all materials if empty). |

### RemapIndexMap

Create remapped versions of index maps.

```csharp
[HandleProcessCorruptedStateExceptions]
public RemapIndexMapReturn RemapIndexMap(ImageList maps, int maxIndices)
```

Parameters

| Type                                                       | Name       | Description                     |
| ---------------------------------------------------------- | ---------- | ------------------------------- |
| [ImageList](./material_imagelist)                          | maps       | Input Images.                   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | maxIndices | Number max of indices remapped. |

Returns

| Type                                                  | Description |
| ----------------------------------------------------- | ----------- |
| [RemapIndexMapReturn](./material_remapindexmapreturn) |             |

### SetCoeffOrTextureProperty

Set a CoeffOrTexture property.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetCoeffOrTextureProperty(uint material, string name, CoeffOrTexture coeffOrTexture)
```

Parameters

| Type                                                           | Name           | Description                         |
| -------------------------------------------------------------- | -------------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | material       | The material to apply the color on. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name           | The property to set.                |
| [CoeffOrTexture](./material_coeffortexture)                    | coeffOrTexture | The CoeffOrTexture to apply.        |

### SetColorAlphaProperty

Set a ColorAlpha property.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetColorAlphaProperty(uint material, string name, ColorAlpha color)
```

Parameters

| Type                                                           | Name     | Description                         |
| -------------------------------------------------------------- | -------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | material | The material to apply the color on. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name     | The property to set.                |
| [ColorAlpha](./core_coloralpha)                                | color    | The color to apply.                 |

### SetColorOrTextureProperty

Set a ColorOrTexture property.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetColorOrTextureProperty(uint material, string name, ColorOrTexture colorOrTexture)
```

Parameters

| Type                                                           | Name           | Description                         |
| -------------------------------------------------------------- | -------------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | material       | The material to apply the color on. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name           | The property to set.                |
| [ColorOrTexture](./material_colorortexture)                    | colorOrTexture | The ColorOrTexture to apply.        |

### SetFragmentShader

Set the fragment shader of a custom pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetFragmentShader(uint pattern, string code)
```

Parameters

| Type                                                           | Name    | Description                           |
| -------------------------------------------------------------- | ------- | ------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | pattern | The custom pattern to edit.           |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | code    | The GLSL code of the fragment shader. |

### SetMaterialMainColor

Set the main color on any material pattern type.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetMaterialMainColor(uint material, ColorAlpha color)
```

Parameters

| Type                                                         | Name     | Description                         |
| ------------------------------------------------------------ | -------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to apply the color on. |
| [ColorAlpha](./core_coloralpha)                              | color    | The color to apply.                 |

### SetMaterialPattern

Sets the MaterialPattern name of the material.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetMaterialPattern(uint material, string pattern)
```

Parameters

| Type                                                           | Name     | Description                       |
| -------------------------------------------------------------- | -------- | --------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | material | The material to find the pattern. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | pattern  | The pattern of the material.      |

### SetPBRMaterialInfos

Set PBR  material properties.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetPBRMaterialInfos(uint material, PBRMaterialInfos infos)
```

Parameters

| Type                                                         | Name     | Description                      |
| ------------------------------------------------------------ | -------- | -------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material | The material to set properties.  |
| [PBRMaterialInfos](./material_pbrmaterialinfos)              | infos    | The PBRMaterialInfos properties. |

### SetVertexShader

Set the vertex shader of a custom pattern.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetVertexShader(uint pattern, string code)
```

Parameters

| Type                                                           | Name    | Description                         |
| -------------------------------------------------------------- | ------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | pattern | The custom pattern to edit.         |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | code    | The GLSL code of the vertex shader. |

### AddImageChangedCallback

```csharp
public uint AddImageChangedCallback(MaterialInterface.ImageChangedDelegate callback, IntPtr userData)
```

Parameters

| Type                                                                               | Name     | Description |
| ---------------------------------------------------------------------------------- | -------- | ----------- |
| [MaterialInterface.ImageChangedDelegate](./materialinterface_imagechangeddelegate) | callback |             |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr)                     | userData |             |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### RemoveImageChangedCallback

```csharp
public void RemoveImageChangedCallback(uint id)
```

Parameters

| Type                                                         | Name | Description |
| ------------------------------------------------------------ | ---- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | id   |             |

### AddMaterialChangedCallback

```csharp
public uint AddMaterialChangedCallback(MaterialInterface.MaterialChangedDelegate callback, IntPtr userData)
```

Parameters

| Type                                                                                     | Name     | Description |
| ---------------------------------------------------------------------------------------- | -------- | ----------- |
| [MaterialInterface.MaterialChangedDelegate](./materialinterface_materialchangeddelegate) | callback |             |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr)                           | userData |             |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### RemoveMaterialChangedCallback

```csharp
public void RemoveMaterialChangedCallback(uint id)
```

Parameters

| Type                                                         | Name | Description |
| ------------------------------------------------------------ | ---- | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | id   |             |

### ApplyFactorOnImage

Aplly a factor to an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ApplyFactorOnImage(uint image, bool imageIsLinear, ColorAlpha factor)
```

Parameters

| Type                                                          | Name          | Description             |
| ------------------------------------------------------------- | ------------- | ----------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | image         | Image to be modified.   |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | imageIsLinear | Image is linear or not. |
| [ColorAlpha](./core_coloralpha)                               | factor        | Factor to apply.        |

### BlurImage

Applies a blurring to the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void BlurImage(uint image, int radius, BlurFilter blurType, EdgeFilter edgeFilter)
```

Parameters

| Type                                                         | Name       | Description                                          |
| ------------------------------------------------------------ | ---------- | ---------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image      | Image to blur.                                       |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | radius     | Radius in pixels of the Gaussian kernel.             |
| [BlurFilter](./material_blurfilter)                          | blurType   | Kernel of the blur filter to apply.                  |
| [EdgeFilter](./material_edgefilter)                          | edgeFilter | Method to use for the management of boundary pixels. |

### ClearImageRoI

Removes the region of interest from an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ClearImageRoI(uint image)
```

Parameters

| Type                                                         | Name  | Description       |
| ------------------------------------------------------------ | ----- | ----------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image to process. |

### ConvertFloat32To8BitsImage

Returns a new image from the given converter from 32bits float to a 8Bits (e.g. depth render map).

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ConvertFloat32To8BitsImage(uint image32F, double minValue = -1, double maxValue = 1, bool inPlace = false)
```

Parameters

| Type                                                           | Name     | Description                                                         |
| -------------------------------------------------------------- | -------- | ------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | image32F | Image to convert.                                                   |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | minValue | Minimal value of the floats (will be 0 in 8bits).                   |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | maxValue | Minimal value of the floats (will be 255 in 8bits).                 |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | inPlace  | If true, the given image is modified instead of creating a new one. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ConvertImage

Converts the given image to a new format.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ConvertImage(uint image, ImageLayout layout, ImageComponentType type, bool inPlace = false)
```

Parameters

| Type                                                          | Name    | Description                                                                                                                                                                                                                 |
| ------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | image   | Image to convert.                                                                                                                                                                                                           |
| [ImageLayout](./material_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](./material_imagecomponenttype)           | type    | Component data type of the new image format.                                                                                                                                                                                |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | inPlace | If true, the given image is modified instead of creating a new one.                                                                                                                                                         |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ConvertImageToDefinition

Returns an image definition which contains data corresponding to the given image converted to a new format.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageDefinition ConvertImageToDefinition(uint image, ImageLayout layout, ImageComponentType type)
```

Parameters

| Type                                                         | Name   | Description                                                                                                                                                                                                                 |
| ------------------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image  | Image to convert.                                                                                                                                                                                                           |
| [ImageLayout](./material_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](./material_imagecomponenttype)          | type   | Component data type of the new image format.                                                                                                                                                                                |

Returns

| Type                                          | Description |
| --------------------------------------------- | ----------- |
| [ImageDefinition](./material_imagedefinition) |             |

### CreateCheckerboardImage

Create an image consisting in a black and white checkerboard.

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.int32) | width    | Width desired for the created image.    |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | height   | Height desired for the created image.   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | cellSize | Size of checkerboard cells (in pixels). |
| [ColorAlpha](./core_coloralpha)                            | color1   | First checkerboard color.               |
| [ColorAlpha](./core_coloralpha)                            | color2   | Second checkerboard color.              |
| [ImageLayout](./material_imagelayout)                      | layout   | Desired image layout.                   |
| [ImageComponentType](./material_imagecomponenttype)        | type     | Desired image component type.           |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateImageFromData

Import an Image from only its data.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateImageFromData(ByteList data, string name = "img")
```

Parameters

| Type                                                           | Name | Description            |
| -------------------------------------------------------------- | ---- | ---------------------- |
| [ByteList](./core_bytelist)                                    | data | The raw data as input. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | name | If need of a name.     |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateImageFromDefinition

Import an image from its raw data.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint CreateImageFromDefinition(ImageDefinition imageDefinition)
```

Parameters

| Type                                          | Name            | Description           |
| --------------------------------------------- | --------------- | --------------------- |
| [ImageDefinition](./material_imagedefinition) | imageDefinition | The image definition. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### CreateImagesFromDefinitions

Import images from their raw data.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageList CreateImagesFromDefinitions(ImageDefinitionList imageDefinitions)
```

Parameters

| Type                                                  | Name             | Description            |
| ----------------------------------------------------- | ---------------- | ---------------------- |
| [ImageDefinitionList](./material_imagedefinitionlist) | imageDefinitions | The image definitions. |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [ImageList](./material_imagelist) |             |

### ExportImage

Export an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ExportImage(uint image, string filename)
```

Parameters

| Type                                                           | Name     | Description                        |
| -------------------------------------------------------------- | -------- | ---------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | image    | Identifier of the image to export. |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | filename | Filename of the file to export.    |

### ExtractImageChannels

Creates new images from individual channels of the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageList ExtractImageChannels(uint image, int channel = -1)
```

Parameters

| Type                                                         | Name    | Description                                                 |
| ------------------------------------------------------------ | ------- | ----------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image   | Image to convert.                                           |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | channel | Number of the channel to extract. -1 extracts all channels. |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [ImageList](./material_imagelist) |             |

### ExtractImageComponents

Creates new images from individual components of the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageList ExtractImageComponents(uint image, ImageLayout components)
```

Parameters

| Type                                                         | Name       | Description                                                                                                           |
| ------------------------------------------------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image      | Image to convert.                                                                                                     |
| [ImageLayout](./material_imagelayout)                        | components | Name of the components to extract. Accepted values: 'R' (red), 'G' (green), 'B' (blue), 'A' (alpha), 'L' (luminance). |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [ImageList](./material_imagelist) |             |

### FillImageWithColor

Fills an image (or a sub-part of it) with the provided color.

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image from which type has to be fetched.                    |
| [ColorAlpha](./core_coloralpha)                              | color | Filling color.                                              |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | x     | Image X coordinate of the sub-image to fill.                |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | y     | Image Y coordinate of the sub-image to fill.                |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | w     | Width of the sub-image to fill (-1 means infinite width).   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | h     | Height of the sub-image to fill (-1 means infinite height). |

### FillUnusedPixels

Fill unused pixels by propagating and averaging used pixels.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint FillUnusedPixels(uint image, ColorAlpha? unusedColor = null, int size = -1, uint validityMask = 0, bool inPlace = false)
```

Parameters

| Type                                                          | Name         | Description                                                                                                                                               |
| ------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | image        | Image to process.                                                                                                                                         |
| [ColorAlpha](./core_coloralpha)                               | unusedColor  | Color used to identify unused pixels.                                                                                                                     |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)    | size         | Dilation size in pixels.                                                                                                                                  |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | 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](https://learn.microsoft.com/dotnet/api/system.boolean) | inPlace      | If True, the source image is modified. Otherwise, a new one is created.                                                                                   |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### FlipImageY

Applies a vertical flip to an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void FlipImageY(uint image)
```

Parameters

| Type                                                         | Name  | Description    |
| ------------------------------------------------------------ | ----- | -------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image to flip. |

### GetAllImages

Returns all the images loaded in the current session or from a list of materials.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageList GetAllImages(MaterialList materials = null)
```

Parameters

| Type                                    | Name      | Description                                                                                        |
| --------------------------------------- | --------- | -------------------------------------------------------------------------------------------------- |
| [MaterialList](./material_materiallist) | materials | Materials to retrieve the images from (returns all images loaded in the current session if empty). |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [ImageList](./material_imagelist) |             |

### GetExportImageFormats

Returns image format names and extensions which can be exported in Pixyz.

```csharp
[HandleProcessCorruptedStateExceptions]
public FormatList GetExportImageFormats()
```

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [FormatList](./core_formatlist) |             |

### GetImageColorBilinear

Returns the color at a specific image point, in real coordinates, using bi-linear interpolation.

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorAlpha GetImageColorBilinear(uint image, double x, double y, EdgeFilter edgeFilter = EdgeFilter.Clamp)
```

Parameters

| Type                                                           | Name       | Description                                          |
| -------------------------------------------------------------- | ---------- | ---------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | image      | The image to get the color from.                     |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | x          | Image X coordinate (real).                           |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | y          | Image Y coordinate (real).                           |
| [EdgeFilter](./material_edgefilter)                            | edgeFilter | Method to use for the management of boundary pixels. |

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [ColorAlpha](./core_coloralpha) |             |

### GetImageColorRange

Gets the min and max bounds of each image color component.

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorAlphaList GetImageColorRange(uint image)
```

Parameters

| Type                                                         | Name  | Description   |
| ------------------------------------------------------------ | ----- | ------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Source image. |

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [ColorAlphaList](./core_coloralphalist) |             |

### GetImageComponentType

Gets the component data type of the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageComponentType GetImageComponentType(uint image)
```

Parameters

| Type                                                         | Name  | Description                              |
| ------------------------------------------------------------ | ----- | ---------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image from which type has to be fetched. |

Returns

| Type                                                | Description |
| --------------------------------------------------- | ----------- |
| [ImageComponentType](./material_imagecomponenttype) |             |

### GetImageComponentTypeName

Gets the name of a given component data type ID.

```csharp
[HandleProcessCorruptedStateExceptions]
public string GetImageComponentTypeName(ImageComponentType type)
```

Parameters

| Type                                                | Name | Description |
| --------------------------------------------------- | ---- | ----------- |
| [ImageComponentType](./material_imagecomponenttype) | type |             |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### GetImageDefinition

Returns the raw data of an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageDefinition GetImageDefinition(uint image)
```

Parameters

| Type                                                         | Name  | Description   |
| ------------------------------------------------------------ | ----- | ------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Source image. |

Returns

| Type                                          | Description |
| --------------------------------------------- | ----------- |
| [ImageDefinition](./material_imagedefinition) |             |

### GetImageDefinitions

Returns the raw data of a set of images.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageDefinitionList GetImageDefinitions(ImageList images)
```

Parameters

| Type                              | Name   | Description |
| --------------------------------- | ------ | ----------- |
| [ImageList](./material_imagelist) | images | The images. |

Returns

| Type                                                  | Description |
| ----------------------------------------------------- | ----------- |
| [ImageDefinitionList](./material_imagedefinitionlist) |             |

### GetImageFormatName

Gets a comprenhensive name from an image format.

```csharp
[HandleProcessCorruptedStateExceptions]
public string GetImageFormatName(ImageLayout layout, ImageComponentType type)
```

Parameters

| Type                                                | Name   | Description |
| --------------------------------------------------- | ------ | ----------- |
| [ImageLayout](./material_imagelayout)               | layout |             |
| [ImageComponentType](./material_imagecomponenttype) | type   |             |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### GetImageLayout

Gets the layout (component definitions) of the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ImageLayout GetImageLayout(uint image)
```

Parameters

| Type                                                         | Name  | Description                                |
| ------------------------------------------------------------ | ----- | ------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image from which layout has to be fetched. |

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [ImageLayout](./material_imagelayout) |             |

### GetImagePixelColor

Returns the color of a given pixel in an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public ColorAlpha GetImagePixelColor(uint image, int x, int y)
```

Parameters

| Type                                                         | Name  | Description                      |
| ------------------------------------------------------------ | ----- | -------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | The image to get the pixel from. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | x     | The X pixel coordinate.          |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | y     | The Y pixel coordinate.          |

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [ColorAlpha](./core_coloralpha) |             |

### GetImagePixelInfo

Returns info about the image pixel format.

```csharp
[HandleProcessCorruptedStateExceptions]
public PixelInfo GetImagePixelInfo(uint image)
```

Parameters

| Type                                                         | Name  | Description   |
| ------------------------------------------------------------ | ----- | ------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Source image. |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [PixelInfo](./material_pixelinfo) |             |

### GetImagePixelInfoFromDefinition

Returns info about the image pixel format.

```csharp
[HandleProcessCorruptedStateExceptions]
public PixelInfo GetImagePixelInfoFromDefinition(ImageDefinition imageDefinition)
```

Parameters

| Type                                          | Name            | Description   |
| --------------------------------------------- | --------------- | ------------- |
| [ImageDefinition](./material_imagedefinition) | imageDefinition | Source image. |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [PixelInfo](./material_pixelinfo) |             |

### GetImagePixelInfoFromLayoutAndType

Returns info about the image pixel format for a given combination of image layout and component type.

```csharp
[HandleProcessCorruptedStateExceptions]
public PixelInfo GetImagePixelInfoFromLayoutAndType(ImageLayout layout, ImageComponentType type)
```

Parameters

| Type                                                | Name   | Description                           |
| --------------------------------------------------- | ------ | ------------------------------------- |
| [ImageLayout](./material_imagelayout)               | layout | Image layout (components definition). |
| [ImageComponentType](./material_imagecomponenttype) | type   | Image component data type.            |

Returns

| Type                              | Description |
| --------------------------------- | ----------- |
| [PixelInfo](./material_pixelinfo) |             |

### GetImageRoI

Returns the region of interest of an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public RoI GetImageRoI(uint image)
```

Parameters

| Type                                                         | Name  | Description       |
| ------------------------------------------------------------ | ----- | ----------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image to process. |

Returns

| Type                  | Description |
| --------------------- | ----------- |
| [RoI](./material_roi) |             |

### GetImageSize

Returns the size of an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public GetImageSizeReturn GetImageSize(uint image)
```

Parameters

| Type                                                         | Name  | Description                     |
| ------------------------------------------------------------ | ----- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | The image to get the size from. |

Returns

| Type                                                | Description |
| --------------------------------------------------- | ----------- |
| [GetImageSizeReturn](./material_getimagesizereturn) |             |

### GetImagesSizes

Returns the sizes of multiple images.

```csharp
[HandleProcessCorruptedStateExceptions]
public GetImagesSizesReturn GetImagesSizes(ImageList images)
```

Parameters

| Type                              | Name   | Description                     |
| --------------------------------- | ------ | ------------------------------- |
| [ImageList](./material_imagelist) | images | The image to get the size from. |

Returns

| Type                                                    | Description |
| ------------------------------------------------------- | ----------- |
| [GetImagesSizesReturn](./material_getimagessizesreturn) |             |

### GetImportImageFormats

Returns the image format names and extensions which can be imported in Pixyz.

```csharp
[HandleProcessCorruptedStateExceptions]
public FormatList GetImportImageFormats()
```

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [FormatList](./core_formatlist) |             |

### GetSubImage

Extracts a sub-part of the given image.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint GetSubImage(uint image, int x, int y, int w, int h)
```

Parameters

| Type                                                         | Name  | Description                                     |
| ------------------------------------------------------------ | ----- | ----------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Source image.                                   |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | x     | Image X coordinate of the sub-image to extract. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | y     | Image Y coordinate of the sub-image to extract. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | w     | Width of the sub-image to extract.              |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | h     | Height of the sub-image to extract.             |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ImportImage

Import an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ImportImage(string filename)
```

Parameters

| Type                                                           | Name     | Description                      |
| -------------------------------------------------------------- | -------- | -------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | filename | Filename of the image to import. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### InvertImageColor

Inverts the color of all image pixels.

```csharp
[HandleProcessCorruptedStateExceptions]
public void InvertImageColor(uint image)
```

Parameters

| Type                                                         | Name  | Description      |
| ------------------------------------------------------------ | ----- | ---------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | 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.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool OverrideImageFormat(uint image, ImageLayout layout = ImageLayout.Undefined, ImageComponentType type = ImageComponentType.Undefined)
```

Parameters

| Type                                                         | Name   | Description                                                     |
| ------------------------------------------------------------ | ------ | --------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image  | Image for format must be overridden.                            |
| [ImageLayout](./material_imagelayout)                        | layout | New layout (keep the original one if set to Undefined).         |
| [ImageComponentType](./material_imagecomponenttype)          | type   | New component type (keep the original one if set to Undefined). |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### ResizeImage

Resize an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ResizeImage(uint image, int width, int height, ResizeFilterMethod filteringMethod = ResizeFilterMethod.DEFAULT)
```

Parameters

| Type                                                         | Name            | Description                          |
| ------------------------------------------------------------ | --------------- | ------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image           | Image to be resize.                  |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | width           | New image width.                     |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | height          | New image height.                    |
| [ResizeFilterMethod](./material_resizefiltermethod)          | filteringMethod | Filtering method for image resizing. |

### RotateImage

Applies a rotation to (the sub-part of) an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void RotateImage(uint image, double angle, double cx, double cy, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
```

Parameters

| Type                                                           | Name       | Description                                                   |
| -------------------------------------------------------------- | ---------- | ------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | image      | Image to process.                                             |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | angle      | Rotation angle (in degrees).                                  |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | cx         | X coordinate of the transformation center.                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | cy         | Y coordinate of the transformation center.                    |
| [EdgeFilter](./material_edgefilter)                            | edgeFilter | Method to use for the management of boundary pixels.          |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | adjustSize | Adjust the dimensions of the image to fit the transformation. |

### SetImageRoI

Defines the region of interest of an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetImageRoI(uint image, int x, int y, int w, int h)
```

Parameters

| Type                                                         | Name  | Description                     |
| ------------------------------------------------------------ | ----- | ------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image | Image to process.               |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | x     | X coordinate of the RoI origin. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | y     | Y coordinate of the RoI origin. |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | w     | Width of the RoI.               |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | h     | Height of the RoI.              |

### SetSubImage

Replaces a part of a given image by another one.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetSubImage(uint destination, uint subImage, int x, int y, EdgeFilter edgeFilter = EdgeFilter.Clamp)
```

Parameters

| Type                                                         | Name        | Description                                          |
| ------------------------------------------------------------ | ----------- | ---------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | destination | Destination image.                                   |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | subImage    | Source image.                                        |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | x           | X coordinate where to copy sub-image.                |
| [int](https://learn.microsoft.com/dotnet/api/system.int32)   | y           | Y coordinate where to copy sub-image.                |
| [EdgeFilter](./material_edgefilter)                          | edgeFilter  | Method to use for the management of boundary pixels. |

### StretchImage

Applies a non-uniform scale to (the sub-part of) an image.

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.uint32)   | image      | Image to process.                                             |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | sx         | Scale factor along X axis.                                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | sy         | Scale factor along Y axis.                                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | cx         | X coordinate of the transformation center.                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | cy         | Y coordinate of the transformation center.                    |
| [EdgeFilter](./material_edgefilter)                            | edgeFilter | Method to use for the management of boundary pixels.          |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | adjustSize | Adjust the dimensions of the image to fit the transformation. |

### TransformImage

Applies a transformation matrix to (the sub-part of) an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void TransformImage(uint image, Matrix3 matrix, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
```

Parameters

| Type                                                          | Name       | Description                                                   |
| ------------------------------------------------------------- | ---------- | ------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | image      | Image to process.                                             |
| [Matrix3](./geom_matrix3)                                     | matrix     | Transformation matrix.                                        |
| [EdgeFilter](./material_edgefilter)                           | edgeFilter | Method to use for the management of boundary pixels.          |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | adjustSize | Adjust the dimensions of the image to fit the transformation. |

### TranslateImage

Applies a translation to (the sub-part of) an image.

```csharp
[HandleProcessCorruptedStateExceptions]
public void TranslateImage(uint image, double tx, double ty, EdgeFilter edgeFilter = EdgeFilter.Clamp, bool adjustSize = false)
```

Parameters

| Type                                                           | Name       | Description                                                   |
| -------------------------------------------------------------- | ---------- | ------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | image      | Image to process.                                             |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | tx         | X translation.                                                |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | ty         | Y translation.                                                |
| [EdgeFilter](./material_edgefilter)                            | edgeFilter | Method to use for the management of boundary pixels.          |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | adjustSize | Adjust the dimensions of the image to fit the transformation. |

### UpdateImageFromDefinition

Update an image from its raw data.

```csharp
[HandleProcessCorruptedStateExceptions]
public void UpdateImageFromDefinition(uint image, ImageDefinition imageDefinition)
```

Parameters

| Type                                                         | Name            | Description            |
| ------------------------------------------------------------ | --------------- | ---------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | image           | The image to update.   |
| [ImageDefinition](./material_imagedefinition)                | imageDefinition | The new data to apply. |

### UpdateImagesFromDefinitions

Update images from their raw data.

```csharp
[HandleProcessCorruptedStateExceptions]
public void UpdateImagesFromDefinitions(ImageList image, ImageDefinitionList imageDefinitions)
```

Parameters

| Type                                                  | Name             | Description            |
| ----------------------------------------------------- | ---------------- | ---------------------- |
| [ImageList](./material_imagelist)                     | image            | The image to update.   |
| [ImageDefinitionList](./material_imagedefinitionlist) | imageDefinitions | The new data to apply. |

### GetMaterialUserData

Set or replace a userdata stored on an material.

```csharp
[HandleProcessCorruptedStateExceptions]
public IntPtr GetMaterialUserData(uint userDataId, uint material)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material   | Material that store the user data.                           |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) |             |

### GetMultipleMaterialUserData

Batch version of getMaterialUserData.

```csharp
[HandleProcessCorruptedStateExceptions]
public PtrList GetMultipleMaterialUserData(uint userDataId, MaterialList materials)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [MaterialList](./material_materiallist)                      | materials  | Materials that store the user data.                          |

Returns

| Type                      | Description |
| ------------------------- | ----------- |
| [PtrList](./core_ptrlist) |             |

### HasMaterialUserData

Set or replace a userdata stored on an material.

```csharp
[HandleProcessCorruptedStateExceptions]
public bool HasMaterialUserData(uint userDataId, uint material)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material   | Material that potentially store the user data.               |

Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### HasMultipleMaterialUserData

Batch version of hasMaterialUserData.

```csharp
[HandleProcessCorruptedStateExceptions]
public BoolList HasMultipleMaterialUserData(uint userDataId, MaterialList materials)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [MaterialList](./material_materiallist)                      | materials  | Materials that potentially store the user data.              |

Returns

| Type                        | Description |
| --------------------------- | ----------- |
| [BoolList](./core_boollist) |             |

### SetMaterialUserData

Set or replace a userdata stored on an material.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetMaterialUserData(uint userDataId, uint material, IntPtr userData)
```

Parameters

| Type                                                           | Name       | Description                                                  |
| -------------------------------------------------------------- | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | material   | Material that will store the user data.                      |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | userData   | User data to store in the given material.                    |

### SetMultipleMaterialUserData

Batch version of setMaterialUserData.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetMultipleMaterialUserData(uint userDataId, MaterialList materials, PtrList userDataList)
```

Parameters

| Type                                                         | Name         | Description                                                  |
| ------------------------------------------------------------ | ------------ | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId   | UserData identifier provided by subscribeToMaterialUserData. |
| [MaterialList](./material_materiallist)                      | materials    | Materials that will store the user data.                     |
| [PtrList](./core_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.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint SubscribeToMaterialUserData()
```

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### UnsetMaterialUserData

Unset the userdata stored on an material.

```csharp
[HandleProcessCorruptedStateExceptions]
public void UnsetMaterialUserData(uint userDataId, uint material)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | material   | Material that will store the user data.                      |

### UnsetMultipleMaterialUserData

Batch version of unsetMaterialUserData.

```csharp
[HandleProcessCorruptedStateExceptions]
public void UnsetMultipleMaterialUserData(uint userDataId, MaterialList materials)
```

Parameters

| Type                                                         | Name       | Description                                                  |
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier provided by subscribeToMaterialUserData. |
| [MaterialList](./material_materiallist)                      | materials  | Materials that will store the user data.                     |

### UnsubscribeFromMaterialUserData

```csharp
[HandleProcessCorruptedStateExceptions]
public void UnsubscribeFromMaterialUserData(uint userDataId)
```

Parameters

| Type                                                         | Name       | Description                         |
| ------------------------------------------------------------ | ---------- | ----------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | userDataId | UserData identifier to unsubscribe. |
