dxSetTexturePixels
Cliente
Escribe píxeles en una textura creada por script o en un render target.
bool dxSetTexturePixels(texture texture, string pixels [, int x, y = 0, 0, int width, height = 0, 0])
Parámetros
| Nombre | Tipo | Descripción |
|---|---|---|
| texture | texture | Una textura de engineCreateTexture o un render target. |
| pixels | string | Los píxeles en plain. |
| x, y | int | Esquina superior izquierda del área escrita, en píxeles. También acepta un vec2.por defecto 0, 0 |
| width, height | int | Tamaño del área escrita. Con alto 0, se escribe la imagen entera. También acepta un vec2.por defecto 0, 0 |
Retorno
true si la escritura se hizo o quedó programada, false si la imagen no guarda píxeles (screen source, dui, textura de txd) o los píxeles no están en plain.
Un número al principio (el índice de superficie de MTA) se acepta y se ignora. Si la imagen aún está cargando, la escritura ocurre cuando esté lista. Los píxeles plain son 4 bytes por píxel (azul, verde, rojo, alfa), fila por fila, seguidos del ancho y el alto en 2 bytes cada uno.
Ejemplo
local tex = engineCreateTexture(64, 64)
dxGetTexturePixels(tex, function(pixels)
if not pixels then return end
for x = 0, 63 do
dxSetPixelColor(pixels, x, 32, 255, 0, 0)
end
dxSetTexturePixels(tex, pixels)
end)