dxGetPixelColor
Client
Reads the colour of one pixel of a plain image.
int, int, int, int|false dxGetPixelColor(string pixels, int x, y)
Parameters
| Name | Type | Description |
|---|---|---|
| pixels | string | The pixels in plain. |
| x, y | int | Position of the pixel, from 0. A vec2 also works. |
Returns
Red, green, blue and alpha (0 to 255), or false when the pixels are not plain or the point is outside the image.
Example
local target = dxCreateRenderTarget(64, 64)
dxGetTexturePixels(target, function(pixels)
if not pixels then return end
local r, g, b, a = dxGetPixelColor(pixels, 32, 32)
print(r, g, b, a)
end)