Sharing Code

ImageTank allows you to easily write your own plug-ins, referred to as External Actions or External Tasks. This is done by creating an Xcode project and then referencing that from the ImageTank file. The Xcode project is stored separately from the ImageTank file and can be called from any file. The link is to the name of the project, so if you send your ImageTank file to someone and they have the same project it will use that, even if it is stored in a different location.

The natural question is how you share the code with someone. If the project is complicated, the best way is to use a repository such as github. But for simple external programs, where the code is small enough to fit in a single file ImageTank has a simpler method.

When you create a new Xcode project from ImageTank, it creates many of the source files automatically, and one of them is computation.cpp. Typically you write your program or at least use it as the top level driver.

For cases where you only use this file and don’t add any other source files ImageTank has a method that makes it very easy to share. In fact every time you use an external program the computation.cpp file is saved with the ImageTank file. When you open this file on another machine and click on the Xcode button you are asked to create the Xcode project. When you create that instead of creating the standard blank computation.cpp file it uses the content that was saved.

Example

Download the file Share Code.itank and open it in ImageTank. Click on the Xcode project file icon. Select a folder. If you don’t have a folder there yet, click on the “Add folder” button to add a folder to the search path.

Then compile the program in Xcode. Once that is done, click on the Reload button in ImageTank. That will rerun the program.