<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.joban.org/w/index.php?action=history&amp;feed=atom&amp;title=JCM%3AScripting%2FDynamic_Textures</id>
	<title>JCM:Scripting/Dynamic Textures - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.joban.org/w/index.php?action=history&amp;feed=atom&amp;title=JCM%3AScripting%2FDynamic_Textures"/>
	<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Dynamic_Textures&amp;action=history"/>
	<updated>2026-05-03T12:33:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://www.joban.org/w/index.php?title=JCM:Scripting/Dynamic_Textures&amp;diff=3286&amp;oldid=prev</id>
		<title>AmberFrost: LX86 moved page JCM:Scripting:Documentation:Dynamic Textures to JCM:Scripting/Dynamic Textures</title>
		<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Dynamic_Textures&amp;diff=3286&amp;oldid=prev"/>
		<updated>2025-02-23T15:29:11Z</updated>

		<summary type="html">&lt;p&gt;LX86 moved page &lt;a href=&quot;/wiki/JCM:Scripting:Documentation:Dynamic_Textures&quot; class=&quot;mw-redirect&quot; title=&quot;JCM:Scripting:Documentation:Dynamic Textures&quot;&gt;JCM:Scripting:Documentation:Dynamic Textures&lt;/a&gt; to &lt;a href=&quot;/wiki/JCM:Scripting/Dynamic_Textures&quot; title=&quot;JCM:Scripting/Dynamic Textures&quot;&gt;JCM:Scripting/Dynamic Textures&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:29, 23 February 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>AmberFrost</name></author>
	</entry>
	<entry>
		<id>https://www.joban.org/w/index.php?title=JCM:Scripting/Dynamic_Textures&amp;diff=3062&amp;oldid=prev</id>
		<title>AmberFrost: Created page with &quot;= Dynamic Textures = NTE provides a GraphicsTexture class to use JS-controlled textures with dynamic content on models for LCD displays, blinking indicators, scrolling text LED, and so on.  === GraphicsTexture === {| class=&quot;wikitable&quot; !Functions And Objects !Description |- |&lt;code&gt;new GraphicsTexture(width: int, height: int)&lt;/code&gt; |To create a dynamic texture, you need to specify the width and height.  If you plan to draw contents related to per-block/per-train, you shou...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.joban.org/w/index.php?title=JCM:Scripting/Dynamic_Textures&amp;diff=3062&amp;oldid=prev"/>
		<updated>2024-11-03T14:50:48Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Dynamic Textures = NTE provides a GraphicsTexture class to use JS-controlled textures with dynamic content on models for LCD displays, blinking indicators, scrolling text LED, and so on.  === GraphicsTexture === {| class=&amp;quot;wikitable&amp;quot; !Functions And Objects !Description |- |&amp;lt;code&amp;gt;new GraphicsTexture(width: int, height: int)&amp;lt;/code&amp;gt; |To create a dynamic texture, you need to specify the width and height.  If you plan to draw contents related to per-block/per-train, you shou...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Dynamic Textures =&lt;br /&gt;
NTE provides a GraphicsTexture class to use JS-controlled textures with dynamic content on models for LCD displays, blinking indicators, scrolling text LED, and so on.&lt;br /&gt;
&lt;br /&gt;
=== GraphicsTexture ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Functions And Objects&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;new GraphicsTexture(width: int, height: int)&amp;lt;/code&amp;gt;&lt;br /&gt;
|To create a dynamic texture, you need to specify the width and height. &lt;br /&gt;
If you plan to draw contents related to per-block/per-train, you should use this in the  &amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; function and store in &amp;lt;code&amp;gt;state&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;GraphicsTexture.close(): void&amp;lt;/code&amp;gt;&lt;br /&gt;
|Releases the memory used by this texture. It cannot be used after that.&lt;br /&gt;
If it was created in the &amp;lt;code&amp;gt;create&amp;lt;/code&amp;gt; train function, it must be deleted in the &amp;lt;code&amp;gt;dispose&amp;lt;/code&amp;gt; function, otherwise it will continue to occupy memory, thus creating a memory leak.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;GraphicsTexture.bufferedImage: BufferedImage&amp;lt;/code&amp;gt;&lt;br /&gt;
|Java AWT's BufferedImage for use as a temporary canvas.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;GraphicsTexture.graphics: Graphics2D&amp;lt;/code&amp;gt;&lt;br /&gt;
|This is the Java AWT's Graphics for this texture. You can call different functions to draw on the bufferedImage.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;GraphicsTexture.upload(): void&amp;lt;/code&amp;gt;&lt;br /&gt;
|Loads the contents of bufferedImage into video memory and immediately displays it on the model.&lt;br /&gt;
This operation can significantly reduce FPS. It is recommended to use it in combination with &amp;lt;code&amp;gt;RateLimit&amp;lt;/code&amp;gt; to reduce the frequency of texture updates.&lt;br /&gt;
&lt;br /&gt;
For example, the screen can be updated only 10 times per second, and it may not be updated at far distances, in some cases the information may not be updated at all.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;GraphicsTexture.identifier: Identifier&amp;lt;/code&amp;gt;&lt;br /&gt;
|The identifier of the virtual resource of this dynamic texture. You can use this to replace the model texture/draw a texture with this id.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== AWT-related classes ===&lt;br /&gt;
You can use the importPackage function from Rhino to satisfy the java.awt dependency when using AWT classes.&lt;br /&gt;
&lt;br /&gt;
You can find some AWT tutorials on the Internet or look at the JavaDoc to see what drawing capabilities are available in Graphics2D:&lt;br /&gt;
&lt;br /&gt;
* JavaDoc: [https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html Graphics] (is a parent class for Graphics2D, which means everything in it can be used in GraphicsTexture.graphics as well)&lt;br /&gt;
* JavaDoc: [https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html Graphics2D]&lt;br /&gt;
&lt;br /&gt;
The following functions can be used:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;static Color.decode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Color.WHITE…&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;new Color&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.setColor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.setFont&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.setStroke(new BasicStroke(…))&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.drawRect&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.fillRect&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.drawRoundRect&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.fillRoundRect&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.drawImage&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.drawString&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Font.deriveFont&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.setPaint(new GradientPaint(…))&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.fill(new Rectangle(…))&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.getTransform&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.transform&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.setTransform&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;AffineTransform.getTranslateInstance&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;AffineTransform.getRotateInstance&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.setClip&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Graphics.getComposite&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, …))&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Graphics.setComposite&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Source ===&lt;br /&gt;
&lt;br /&gt;
* https://wiki.minecrafttransitrailway.com/mtr_addon:nte:js:dynamic_texture&lt;/div&gt;</summary>
		<author><name>AmberFrost</name></author>
	</entry>
</feed>