Class Texture2DExtensions
A collection of helper functions for Texture2D
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public static class Texture2DExtensions
Methods
CaptureScreenRegion(Int32, Int32, Int32, Int32)
Captures a region of the screen and returns it as a texture.
Declaration
public static Texture2D CaptureScreenRegion(int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | x position of the screen to capture from (bottom-left) |
Int32 | y | y position of the screen to capture from (bottom-left) |
Int32 | width | width of the screen area to capture |
Int32 | height | height of the screen area to capture |
Returns
Type | Description |
---|---|
Texture2D | A Texture2D containing pixels from the region of the screen specified |
Remarks
You should call this in OnPostRender.
CaptureScreenRegion(Int32, Int32, Int32, Int32)
Captures a region of the screen and returns it as a texture.
Declaration
public static Texture2D CaptureScreenRegion(int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | x position of the screen to capture from (bottom-left) |
Int32 | y | y position of the screen to capture from (bottom-left) |
Int32 | width | width of the screen area to capture |
Int32 | height | height of the screen area to capture |
Returns
Type | Description |
---|---|
Texture2D | A Texture2D containing pixels from the region of the screen specified |
Remarks
You should call this in OnPostRender.
CreateTextureFromRegion(Texture2D, Int32, Int32, Int32, Int32)
Creates a texture from a defined region.
Declaration
public static Texture2D CreateTextureFromRegion(this Texture2D texture2D, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Int32 | x | x position of this texture to get the texture from |
Int32 | y | y position of this texture to get the texture from |
Int32 | width | width of the region to capture |
Int32 | height | height of the region to capture |
Returns
Type | Description |
---|---|
Texture2D |
CreateTextureFromRegion(Texture2D, Int32, Int32, Int32, Int32)
Creates a texture from a defined region.
Declaration
public static Texture2D CreateTextureFromRegion(this Texture2D texture2D, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Int32 | x | x position of this texture to get the texture from |
Int32 | y | y position of this texture to get the texture from |
Int32 | width | width of the region to capture |
Int32 | height | height of the region to capture |
Returns
Type | Description |
---|---|
Texture2D |
FillPixels(Texture2D, Color)
Fills the texture with a single color.
Declaration
public static void FillPixels(this Texture2D texture2D, Color fillColor)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Color | fillColor | Color of the fill. |
FillPixels(Texture2D, Color)
Fills the texture with a single color.
Declaration
public static void FillPixels(this Texture2D texture2D, Color fillColor)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Color | fillColor | Color of the fill. |
FillPixels(Texture2D, Int32, Int32, Int32, Int32, Color)
Fills the pixels. You will need to call Apply on the texture in order for changes to take place.
Declaration
public static void FillPixels(this Texture2D texture2D, int row, int col, int width, int height, Color fillColor)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Int32 | row | The row to start filling at. |
Int32 | col | The column to start filling at. |
Int32 | width | The width to fill. |
Int32 | height | The height to fill. |
Color | fillColor | Color of the fill. |
Remarks
This function considers row 0 to be left and col 0 to be top.
FillPixels(Texture2D, Int32, Int32, Int32, Int32, Color)
Fills the pixels. You will need to call Apply on the texture in order for changes to take place.
Declaration
public static void FillPixels(this Texture2D texture2D, int row, int col, int width, int height, Color fillColor)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture2D | The Texture2D. |
Int32 | row | The row to start filling at. |
Int32 | col | The column to start filling at. |
Int32 | width | The width to fill. |
Int32 | height | The height to fill. |
Color | fillColor | Color of the fill. |
Remarks
This function considers row 0 to be left and col 0 to be top.