M MY Multiplayer: Wiki
Side
Kind

dxGetPixelColor

Client

Reads the colour of one pixel of a plain image.

int, int, int, int|false dxGetPixelColor(string pixels, int x, y)

Parameters

NameTypeDescription
pixelsstringThe pixels in plain.
x, yintPosition 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)

See also