Usage  

  Home  |  Features  |  Download  |  Screenshots  |  Usage  |  Contact

Using the Editor

The easiest way to learn how the editor works is to open and inspect the example files that are included in the texture editor release.

Using the Run-Time library

The runtime library is called neotexture.jar. As the library is under development there is no official documentation yet but the interface is very small and easy to use.
Below is a fully functional example program that uses the library version 0.6.1 to load several graphs from the examples and displays all images in it. The output that is generated by the program is

screenshot

package com.mystictri.neotexturedemos;

import java.awt.FlowLayout;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import com.mystictri.neotexture.TextureGenerator;

public class Simple {
	public static void main(String[] args) {
		try {
			// enable the use of the cache to accelerate the texture creation
			TextureGenerator.setUseCache(true);
			// load some graphs
			TextureGenerator.loadGraph(new FileInputStream("example_Bricks.tgr"));
			TextureGenerator.loadGraph(new FileInputStream("example_Lava.tgr"));
			TextureGenerator.loadGraph(new FileInputStream("example_Brain.tgr"));

			JFrame f = new JFrame();
			f.setLayout(new FlowLayout());

			int res = 256;

			for (String n : TextureGenerator.getTextureNames()) {
				// create the texture into an int[]
				int[] data = TextureGenerator.generateTexture_ARGB(n, res, res);

				// create an image that we can display in the JFrame
				BufferedImage img = new BufferedImage(res, res, BufferedImage.TYPE_INT_ARGB);
				img.setRGB(0, 0, res, res, data, 0, res);
				f.add(new JLabel(new ImageIcon(img)));
			}

			TextureGenerator.clearCache();

			// display the loaded images
			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			f.pack();
			f.setVisible(true);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
}

 
NeoTextureEdit sourceforge Project Page  
© 2010 Holger Dammertz. All rights reserved