 |
DXDeviceReadColors Method |
Reads the colors from the area specified with x, y, width and height parameters and returns a byte array with color data.
Note that the length of one row is specified in the returned rowPitch and may be different than 4 times the width.
Namespace: Ab3d.DirectXAssembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.2.9484.2048 (1.0.0.0)
Syntaxpublic byte[] ReadColors(
Texture2D sourceTexture,
int x,
int y,
int width,
int height,
Format sourceTextureFormat,
out int rowPitch
)
Parameters
- sourceTexture Texture2D
- The source Texture2D from which to copy the pixel color. Must not be null.
- x Int32
- x-coordinate of upper left corner of the region to read.
- y Int32
- y-coordinate of upper left corner of the region to read.
- width Int32
- width of the region to read
- height Int32
- height of the region to read
- sourceTextureFormat Format
- format of the sourceTexture (by default DXEngine uses Format.B8G8R8A8_UNorm that is required for the texture to be shader by the WPF)
- rowPitch Int32
- out int value that defines the row length in bytes (may be different than 4 times the width)
Return Value
ByteByte array Pixel color as uint representing the color in the texture's format.
RemarksThe returned color data format depends on the underlying texture format. Ensure that
the specified coordinates are within the bounds of the source texture to avoid undefined behavior.
See Also