<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to instance_image</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>Recent changes to instance_image</description><atom:link href="https://sourceforge.net/p/arcanfe/wiki/instance_image/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 21 Jun 2012 23:23:29 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/arcanfe/wiki/instance_image/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v6
+++ v7
@@ -12,6 +12,7 @@
 
 ~~~~
 ::lua
+function test()
 parent = fill_surface(32, 32, 255, 0, 0);
 child = instance_image(parent);
 show_image(parent);
@@ -27,6 +28,7 @@
 move_image(child, -64, -64, 25);
 
 expire_image(parent, 100);
+end
 ~~~~
 
 **caveats:**
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 23:23:29 -0000</pubDate><guid>https://sourceforge.net978ba6b2003aec7a9c8fac6310d4c989114e7dda</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v5
+++ v6
@@ -10,8 +10,8 @@
 
 This will create a red block in the middle of the screen, and a smaller red block as an instance that will move around it's parent in an outer square formation. Both will disappear when the parent expires.
 
+~~~~
 ::lua
-~~~~
 parent = fill_surface(32, 32, 255, 0, 0);
 child = instance_image(parent);
 show_image(parent);
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 23:23:06 -0000</pubDate><guid>https://sourceforge.net0080d212dcaaf8f3cab44cf6a3a0b05f82e2fca3</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -10,6 +10,7 @@
 
 This will create a red block in the middle of the screen, and a smaller red block as an instance that will move around it's parent in an outer square formation. Both will disappear when the parent expires.
 
+::lua
 ~~~~
 parent = fill_surface(32, 32, 255, 0, 0);
 child = instance_image(parent);
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 23:22:54 -0000</pubDate><guid>https://sourceforge.netd04e145846a3098906444b46d2d9e76673926e8f</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -37,4 +37,5 @@
 Any dangling references when the parent have been destroyed are likely sources of errors. [check_vid] can be used to as a means to hunt these down.
 
 **related functions:**
+
 [link_image] [image_parent] [image_children]
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 21:44:47 -0000</pubDate><guid>https://sourceforge.net95df47950ca38df14c8839e1d5e622d40819527e</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -7,6 +7,7 @@
 Creates a linked clone of *source_vid*. Clones are automatically destroyed when the parent is removed and its parent property cannot be changed. Like with any other function that creates a vid, it starts out hidden, with its coordinate system linked to the parent.
 
 **example use:**
+
 This will create a red block in the middle of the screen, and a smaller red block as an instance that will move around it's parent in an outer square formation. Both will disappear when the parent expires.
 
 ~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 21:44:21 -0000</pubDate><guid>https://sourceforge.netaf87f453c51f4d4a70ead88e7fcd62718746fe52</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -36,4 +36,4 @@
 Any dangling references when the parent have been destroyed are likely sources of errors. [check_vid] can be used to as a means to hunt these down.
 
 **related functions:**
-[load_image_async]
+[link_image] [image_parent] [image_children]
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 21:44:02 -0000</pubDate><guid>https://sourceforge.net495e3d373a99665daa11b62a61c66067afe4042a</guid></item><item><title>WikiPage instance_image modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/instance_image/</link><description>**declaration:**

~~~~
instance_vid(source_vid) =&gt; VID or BADID
~~~~

Creates a linked clone of *source_vid*. Clones are automatically destroyed when the parent is removed and its parent property cannot be changed. Like with any other function that creates a vid, it starts out hidden, with its coordinate system linked to the parent.

**example use:**
This will create a red block in the middle of the screen, and a smaller red block as an instance that will move around it's parent in an outer square formation. Both will disappear when the parent expires.

~~~~
parent = fill_surface(32, 32, 255, 0, 0);
child = instance_image(parent);
show_image(parent);
show_image(child);

move_image(parent, VRESW * 0.5, VRESH * 0.5);
scale_image(child, 0.5, 0.5);

move_image(child, -64, -64, 0);
move_image(child, 64, -64, 25);
move_image(child, 64, 64, 25);
move_image(child, -64, 64, 25);
move_image(child, -64, -64, 25);

expire_image(parent, 100);
~~~~

**caveats:**

This function is particularly useful for particle systems, and as a way of reducing memory usage with multiple objects using the same video source. 

The vids resulting from instancing should be tracked carefully. A lot of operations that are valid on normal objects would fail on a cloned one (manipulating frameset for instance.)

Any dangling references when the parent have been destroyed are likely sources of errors. [check_vid] can be used to as a means to hunt these down.

**related functions:**
[load_image_async]
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Thu, 21 Jun 2012 21:43:12 -0000</pubDate><guid>https://sourceforge.neta6267a52f7cd3546aff30ff3618ea9eb9b3269e5</guid></item></channel></rss>