You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>MTA refers to the raw information that a <ahref="/reference/texture/">texture</a> contains as <b>pixels</b>.</li>
23
+
<li>Pixels can be retrieved from any <ahref="/reference/texture/">texture</a> type including <ahref="/reference/dxCreateRenderTarget">render targets</a> and <ahref="/reference/dxCreateScreenSource">screen sources</a> by using the function <ahref="/reference/dxGetTexturePixels">dxGetTexturePixels</a>.</li>
24
+
<li>Pixels are just a <ahref="/reference/string">string</a> to Lua, so they can be saved to a file or even sent over the internet.</li>
25
+
</ul>
26
+
27
+
<h3>Pixels properties</h3>
28
+
<hr/>
29
+
<p>Pixels have two properties:</p>
30
+
31
+
<ul>
32
+
<li><b>dimensions</b>: (width and height) which is retrieved by using the function <ahref="/reference/dxGetPixelsSize">dxGetPixelsSize</a>.</li>
33
+
<li><b>format</b>: (plain,jpeg,png,dds) which is retrieved by using the function <ahref="/reference/dxGetPixelsFormat">dxGetPixelsFormat</a></li>
34
+
<ul>
35
+
<li><b>plain</b> - Fastest and simplest - It's default format of the pixels returned by <ahref="/reference/dxGetTexturePixels/">dxGetTexturePixels</a> and the only one that can be used with <ahref="/reference/dxSetTexturePixels">dxSetTexturePixels</a>, <ahref="/reference/dxGetPixelColor">dxGetPixelColor</a> and <ahref="/reference/dxSetPixelColor">dxSetPixelColor</a>. But it also uses a lot of bytes, so internet transfers will be longer. Also can't be read by Photoshop or browsers etc.</li>
36
+
<li><b>png</b> - A few less bytes, still quite big for net transfers. Can be saved to a file and read by Photoshop and browsers etc.</li>
37
+
<li><b>jpeg</b> - A lot less bytes, so best for net transfers. Can be saved to a file and read by Photoshop and browsers etc.</li>
38
+
<li><b>dds</b> - DirectDraw Surface. Game's native texture format with various compressed and uncompressed options. Used to store standard, cube or volume textures. Compressed pixels in this format can be loaded nearly instantly by <ahref="/reference/dxCreateTexture">dxCreateTexture</a>.</li>
39
+
</ul>
40
+
</ul>
41
+
42
+
<p>To convert between the 3 different formats, use the function <ahref="/reference/dxConvertPixels">dxConvertPixels</a>.</p>
43
+
44
+
<h3>Pixels performance</h3>
45
+
<hr/>
46
+
47
+
<p>Getting/setting pixels from textures is not quick and not something you want to be doing every frame (in <ahref="/reference/onClientRender">onClientRender</a> for example).
48
+
Setting pixels to a <ahref="/reference/dxCreateRenderTarget">render target</a> is <b>especially slow</b>. Pixels are ideal however for transferring composite images built on a render target into a normal texture for later use.
49
+
For example, making a custom radar map.</p>
50
+
51
+
<h3>Examples</h3>
52
+
<hr/>
53
+
54
+
<p>Pixels can also be loaded from any png/jpeg file just like this:</p>
0 commit comments