Click or drag to resize
AB4D logo

DXDeviceReadSinglePixelColor Method

Reads the color of a single pixel from the specified texture at the given coordinates.

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.2.9484.2048 (1.0.0.0)
Syntax
C#
public uint ReadSinglePixelColor(
	Texture2D sourceTexture,
	int x,
	int y,
	Format sourceTextureFormat = Format.B8G8R8A8_UNorm
)

Parameters

sourceTexture  Texture2D
The source Texture2D from which to copy the pixel color. Must not be null.
x  Int32
The zero-based x-coordinate of the pixel to copy.
y  Int32
The zero-based y-coordinate of the pixel to copy.
sourceTextureFormat  Format  (Optional)
format of the sourceTexture (by default set to Format.B8G8R8A8_UNorm that is required for the texture to be shader by the WPF)

Return Value

UInt32
Pixel color as uint representing the color in the texture's format.
Remarks
The 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