- Dokumentacja
- Funkcje klienta
- dxGetTexturePixels
Funkcja
dxGetTexturePixels
Odczytuje piksele tekstury, render targetu albo źródła ekranu w formacie plain, png albo jpeg, w całości albo z wycinka (x, y, szerokość, wysokość). Na przykład do zrzutu ekranu.
Składnia
string dxGetTexturePixels(element texture [, int surfaceIndex, string pixelsFormat = "plain", int x, y, width, height])Argumenty
surfaceIndexint, opcjonalny- Indeks powierzchni (zgodność ze starszymi skryptami).
textureelement- Tekstura.
pixelsFormatstring, opcjonalny = "plain""plain","png","jpeg".x, y, width, heightint, opcjonalny- Wycinek.W MTA:SA inny typ: string textureFormat = "unknown"
Różnice względem MTA:SA
- Argumenty zaznaczone innym kolorem różnią się od MTA:SA.
- Tych argumentów z MTA:SA tu nie ma:
int width = 0,int height = 0
W MTA:SA
dxGetTexturePixels(int surfaceIndex = 0, texture texture, string pixelsFormat = "plain", string textureFormat = "unknown", bool mipmaps, int x = 0, int y = 0, int width = 0, int height = 0)Zwraca
Piksele albo false.
Przykład
local screen = dxCreateScreenSource(1280, 720)
bindKey("F12", "down", function()
dxUpdateScreenSource(screen)
setTimer(function()
local png = dxGetTexturePixels(screen, "png")
if png then
local f = fileCreate("zrzut.png")
fileWrite(f, png)
fileClose(f)
end
end, 100, 1)
end)