/** A utility method to write the given array of pixmaps to the given output directory, with the specified file name. If the
* pages array is of length 1, then the resulting file ref will look like: "fileName.png".
*
* If the pages array is greater than length 1, the resulting file refs will be appended with "_N", such as "fileName_0.png",
* "fileName_1.png", "fileName_2.png" etc.
*
* The returned string array can then be passed to the <tt>writeFont</tt> method.
*
* Note: None of the pixmaps will be disposed.
*
* @param pages the pages of pixmap data to write
* @param outputDir the output directory
* @param fileName the file names for the output images
* @return the array of string references to be used with <tt>writeFont</tt> */
public static String[] writePixmaps (Pixmap[] pages, FileHandle outputDir, String fileName) {
if (pages==null || pages.length==0)
throw new IllegalArgumentException("no pixmaps supplied to BitmapFontWriter.write");
String[] pageRefs = new String[pages.length];
for (int i=0; i<pages.length; i++) {
String ref = pages.length==1 ? (fileName+".png") : (fileName+"_"+i+".png");
//the ref for this image
pageRefs[i] = ref;
//write the PNG in that directory
PixmapIO.writePNG(outputDir.child(ref), pages[i]);
}
return pageRefs;
}
BitmapFontWriter.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:enklave
作者:
评论列表
文章目录