public ImageProcessor (File rootDir, Settings settings) {\r
this.settings = settings;\r
\r
- rootPath = rootDir.getAbsolutePath().replace('\\', '/');\r
- if (!rootPath.endsWith("/")) rootPath += "/";\r
+ if (rootDir != null) {\r
+ rootPath = rootDir.getAbsolutePath().replace('\\', '/');\r
+ if (!rootPath.endsWith("/")) rootPath += "/";\r
+ }\r
+ }\r
+\r
+ public ImageProcessor (Settings settings) {\r
+ this(null, settings);\r
}\r
\r
public void addImage (File file) {\r
int dotIndex = name.lastIndexOf('.');\r
if (dotIndex != -1) name = name.substring(0, dotIndex);\r
\r
+ addImage(image, name);\r
+ }\r
+\r
+ public void addImage (BufferedImage image, String name) {\r
Rect rect = null;\r
\r
// Strip ".9" from file name, read ninepatch split pixels, and strip ninepatch split pixels.\r
imageProcessor = new ImageProcessor(rootDir, settings);\r
}\r
\r
+ public TexturePacker2 (Settings settings) {\r
+ this(null, settings);\r
+ }\r
+\r
public void addImage (File file) {\r
imageProcessor.addImage(file);\r
}\r
\r
+ public void addImage (BufferedImage image, String name) {\r
+ imageProcessor.addImage(image, name);\r
+ }\r
+\r
public void pack (File outputDir, String packFileName) {\r
outputDir.mkdirs();\r
\r