dxSetPixelColor
Client
Changes the colour of one pixel of a plain image, in the string itself.
bool dxSetPixelColor(string pixels, int x, y, int r, g, b [, int a = 255])
Parameters
| Name | Type | Description |
|---|---|---|
| pixels | string | The pixels in plain. |
| x, y | int | Position of the pixel, from 0. A vec2 also works. |
| r, g, b | int | Red, green and blue, from 0 to 255. |
| a | int | Alpha, from 0 to 255.default 255 |
Returns
true when the pixel changed, false when the pixels are not plain, the point is outside the image or the string is too short.
Example
local tex = engineCreateTexture(64, 64)
dxGetTexturePixels(tex, function(pixels)
if not pixels then return end
dxSetPixelColor(pixels, 10, 10, 255, 255, 0)
dxSetTexturePixels(tex, pixels)
end)NoteThe string is changed in place: every variable holding the same string sees the change. Strings of up to 40 bytes cannot be changed and log a warning.