<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/DgsCustomRendererSetFunction?action=history&amp;feed=atom</id>
	<title>DgsCustomRendererSetFunction - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/DgsCustomRendererSetFunction?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsCustomRendererSetFunction&amp;action=history"/>
	<updated>2026-05-12T05:21:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsCustomRendererSetFunction&amp;diff=66245&amp;oldid=prev</id>
		<title>Thisdp at 15:55, 28 April 2020</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsCustomRendererSetFunction&amp;diff=66245&amp;oldid=prev"/>
		<updated>2020-04-28T15:55:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:55, 28 April 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l37&quot;&gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local tex = dxCreateTexture(&amp;quot;exampleTexture.png&amp;quot;) --Create a texture&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local tex = dxCreateTexture(&amp;quot;exampleTexture.png&amp;quot;) --Create a texture&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local image = DGS:dgsCreateImage(300,300,200,200,customRenderer,false) --Apply the custom renderer&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local image = DGS:dgsCreateImage(300,300,200,200,customRenderer,false) --Apply the custom renderer&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DGS:dgsSetProperty(customRenderer,&quot;customTexture&quot;,tex) --Make a reference for the texture that can be used in the render function.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DGS:dgsAttachToAutoDestroy(tex,image) --The texture will be destroyed when the image destroys&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DGS:dgsAttachToAutoDestroy(tex,image) --The texture will be destroyed when the image destroys&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DGS:dgsAttachToAutoDestroy(customRenderer,image) --The custom renderer will be destroyed when the image destroys&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DGS:dgsAttachToAutoDestroy(customRenderer,image) --The custom renderer will be destroyed when the image destroys&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-66242:rev-66245 --&gt;
&lt;/table&gt;</summary>
		<author><name>Thisdp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsCustomRendererSetFunction&amp;diff=66242&amp;oldid=prev</id>
		<title>Thisdp: Created page with &quot;__NOTOC__ {{Client function}} This function sets the render function of a dgs custom renderer.  ==Syntax==  &lt;syntaxhighlight lang=&quot;lua&quot;&gt; bool dgsCustomRendererSetFunction( ele...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsCustomRendererSetFunction&amp;diff=66242&amp;oldid=prev"/>
		<updated>2020-04-28T15:42:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{Client function}} This function sets the render function of a dgs custom renderer.  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsCustomRendererSetFunction( ele...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function sets the render function of a dgs custom renderer.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dgsCustomRendererSetFunction( element customRenderer, string renderFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''customRenderer:''' A dgs custom renderer you want to set.&lt;br /&gt;
*'''renderFunction:''' A string of lua code which will be the new renderer of the custom renderer.&lt;br /&gt;
**'''Predefined Variable of renderFunction:''' For detail, see [[dxDrawImage]]&lt;br /&gt;
***'''posX:''' Absolute X position of the renderer's bounding box.&lt;br /&gt;
***'''posY:''' Absolute Y position of the renderer's bounding box.&lt;br /&gt;
***'''width:''' Absolute width of the renderer's bounding box.&lt;br /&gt;
***'''height:''' Absolute height of the renderer's bounding box.&lt;br /&gt;
***'''self:''' The custom renderer itself.&lt;br /&gt;
***'''rotation:''' The rotation of renderer's bounding box.&lt;br /&gt;
***'''rotationCenterOffsetX:''' The rotation center offset x of renderer's bounding box.&lt;br /&gt;
***'''rotationCenterOffsetY:''' The rotation center offset x of renderer's bounding box.&lt;br /&gt;
***'''color:''' The color to be applied.&lt;br /&gt;
***'''postGUI:''' Whether the dx draw is require postGUI&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successfully, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
DGS = exports.dgs&lt;br /&gt;
local customRenderer = DGS:dgsCreateCustomRenderer() --Create an empty custom renderer&lt;br /&gt;
DGS:dgsCustomRendererSetFunction(customRenderer,[[&lt;br /&gt;
	local texture = dgsGetProperty(self,&amp;quot;customTexture&amp;quot;)&lt;br /&gt;
	dxDrawImage(posX,posY,width,height,texture,rotation,rotationCenterOffsetX,rotationCenterOffsetY,color,postGUI)&lt;br /&gt;
	dxDrawImage(posX-width,posY-height,width,height,texture,rotation,rotationCenterOffsetX,rotationCenterOffsetY,color,postGUI)&lt;br /&gt;
]] ) -- We can set the function here&lt;br /&gt;
local tex = dxCreateTexture(&amp;quot;exampleTexture.png&amp;quot;) --Create a texture&lt;br /&gt;
local image = DGS:dgsCreateImage(300,300,200,200,customRenderer,false) --Apply the custom renderer&lt;br /&gt;
DGS:dgsAttachToAutoDestroy(tex,image) --The texture will be destroyed when the image destroys&lt;br /&gt;
DGS:dgsAttachToAutoDestroy(customRenderer,image) --The custom renderer will be destroyed when the image destroys&lt;br /&gt;
&lt;br /&gt;
setTimer(function()&lt;br /&gt;
	destroyElement(image)&lt;br /&gt;
end,10000,1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGSFUNCTIONS}}&lt;/div&gt;</summary>
		<author><name>Thisdp</name></author>
	</entry>
</feed>