本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData类的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlasData类的具体用法?Java TextureAtlasData怎么用?Java TextureAtlasData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureAtlasData类属于com.badlogic.gdx.graphics.g2d.TextureAtlas包,在下文中一共展示了TextureAtlasData类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDependencies
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public Array<AssetDescriptor> getDependencies(String paramString, TextureAtlasLoader.TextureAtlasParameter paramTextureAtlasParameter)
{
FileHandle localFileHandle1 = resolve(paramString);
FileHandle localFileHandle2 = localFileHandle1.parent();
if (paramTextureAtlasParameter != null);
Array localArray;
for (this.data = new TextureAtlas.TextureAtlasData(localFileHandle1, localFileHandle2, paramTextureAtlasParameter.flip); ; this.data = new TextureAtlas.TextureAtlasData(localFileHandle1, localFileHandle2, false))
{
localArray = new Array();
Iterator localIterator = this.data.getPages().iterator();
while (localIterator.hasNext())
{
TextureAtlas.TextureAtlasData.Page localPage = (TextureAtlas.TextureAtlasData.Page)localIterator.next();
FileHandle localFileHandle3 = resolve(localPage.textureFile.path());
TextureLoader.TextureParameter localTextureParameter = new TextureLoader.TextureParameter();
localTextureParameter.format = localPage.format;
localTextureParameter.genMipMaps = localPage.useMipMaps;
localTextureParameter.minFilter = localPage.minFilter;
localTextureParameter.magFilter = localPage.magFilter;
localArray.add(new AssetDescriptor(localFileHandle3.path().replaceAll("\\\\", "/"), Texture.class, localTextureParameter));
}
}
return localArray;
}
示例2: main
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static void main (String[] args) {
TextureUnpacker unpacker = new TextureUnpacker();
String atlasFile = null, imageDir = null, outputDir = null;
// parse the arguments and display the help text if there is a problem with the command line arguments
switch (unpacker.parseArguments(args)) {
case 0:
System.out.println(HELP);
return;
case 3:
outputDir = args[2];
case 2:
imageDir = args[1];
case 1:
atlasFile = args[0];
}
File atlasFileHandle = new File(atlasFile);
String atlasParentPath = atlasFileHandle.getParentFile().getAbsolutePath();
// Set the directory variables to a default when they weren't given in the variables
if (imageDir == null) imageDir = atlasParentPath;
if (outputDir == null) outputDir = (new File(atlasParentPath, DEFAULT_OUTPUT_PATH)).getAbsolutePath();
// Opens the atlas file from the specified filename
TextureAtlasData atlas = new TextureAtlasData(new FileHandle(atlasFile), new FileHandle(imageDir), false);
unpacker.splitAtlas(atlas, outputDir);
}
示例3: load
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public TextureAtlas load(AssetManager paramAssetManager, String paramString, TextureAtlasLoader.TextureAtlasParameter paramTextureAtlasParameter)
{
Iterator localIterator = this.data.getPages().iterator();
while (localIterator.hasNext())
{
TextureAtlas.TextureAtlasData.Page localPage = (TextureAtlas.TextureAtlasData.Page)localIterator.next();
localPage.texture = ((Texture)paramAssetManager.get(localPage.textureFile.path().replaceAll("\\\\", "/"), Texture.class));
}
return new TextureAtlas(this.data);
}
示例4: scaleAtlas
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static void scaleAtlas(File orgAtlas, File destDir, float scale) throws IOException {
File tmpDir = DesktopUtils.createTempDirectory();
EditorLogger.debug("SCALING: " + orgAtlas.getName());
unpackAtlas(orgAtlas, tmpDir);
String atlasParentPath = orgAtlas.getParentFile().getAbsolutePath();
TextureAtlasData atlasData = new TextureAtlasData(new FileHandle(orgAtlas), new FileHandle(atlasParentPath), false);
String outputFormat = atlasData.getPages().get(0).textureFile.extension();
createAtlas(tmpDir.getAbsolutePath(), destDir.getAbsolutePath(), orgAtlas.getName(), scale,
atlasData.getPages().get(0).minFilter, atlasData.getPages().get(0).magFilter, outputFormat);
DesktopUtils.removeDir(tmpDir.getAbsolutePath());
}
示例5: unpackAtlas
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static void unpackAtlas(File orgAtlas, File destDir) {
CustomTextureUnpacker unpacker = new CustomTextureUnpacker();
String atlasParentPath = orgAtlas.getParentFile().getAbsolutePath();
TextureAtlasData atlas = new TextureAtlasData(new FileHandle(orgAtlas), new FileHandle(atlasParentPath), false);
unpacker.splitAtlas(atlas, destDir.getAbsolutePath());
}
示例6: analyze
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
@Override
public AssetTransaction analyze (ModuleInjector injector, AssetProviderResult providerResult, FileHandle source, FileHandle target, String relativeTargetPath) {
Array<FileHandle> sourcePngs = new Array<>();
Array<FileHandle> targetPngs = new Array<>();
TextureAtlasData data = new TextureAtlasData(source, source.parent(), false);
for (int i = 0; i < data.getPages().size; i++) {
Page page = data.getPages().get(i);
sourcePngs.add(page.textureFile);
if (i == 0) {
targetPngs.add(target.parent().child(target.nameWithoutExtension() + ".png"));
} else {
targetPngs.add(target.parent().child(target.nameWithoutExtension() + i + ".png"));
}
}
AssetTransaction transaction = new AssetTransaction();
transaction.add(new CopyFileAction(source, target));
for (int i = 0; i < sourcePngs.size; i++) {
transaction.add(new CopyFileAction(sourcePngs.get(i), targetPngs.get(i)));
}
transaction.add(new UpdateReferencesAction(injector, providerResult, new AtlasRegionAsset(relativeTargetPath, null)));
transaction.add(new DeleteFileAction(source, transactionStorage));
transaction.add(new UndoableAction() { //update references in atlas file
boolean updatingRefs = true;
@Override
public void execute () {
try {
BufferedReader file = new BufferedReader(new FileReader(target.file()));
String line;
String output = "";
while ((line = file.readLine()) != null) {
if (updatingRefs && line.contains(":")) updatingRefs = false;
if (updatingRefs) {
for (int i = 0; i < sourcePngs.size; i++) {
if (line.equals(sourcePngs.get(i).name()))
line = targetPngs.get(i).name();
}
}
output += line + '\n';
}
file.close();
FileOutputStream fileOut = new FileOutputStream(target.file());
fileOut.write(output.getBytes());
fileOut.close();
} catch (IOException e) {
Log.exception(e);
}
}
@Override
public void undo () {
//do nothing, file will deleted when CopyFileAction will be undone
}
});
for (int i = 0; i < sourcePngs.size; i++) {
transaction.add(new DeleteFileAction(sourcePngs.get(i), transactionStorage));
}
transaction.finalizeGroup();
return transaction;
}
示例7: crack
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static void crack(String srcAtlas,String dstDir) throws Exception{
FileHandle fh = Gdx.files.absolute(srcAtlas);
TextureAtlasData data = new TextureAtlasData(fh, fh.parent(),false);
File dir = new File(dstDir);
if(!dir.exists()){
dir.mkdirs();
System.out.println("mkdirs:"+dstDir);
}
for(Region region:data.getRegions()){
File file = region.page.textureFile.file();
BufferedImage root = ImageIO.read(file);
String fileName = region.name ;
int sizeWidth = region.originalWidth;
int sizeHeight= region.originalHeight;
int width = region.width;
int height= region.height;
int x = region.left ;
int y = region.top ;
int offsetX = (int)region.offsetX;
int offsetY = (int)region.offsetY;
BufferedImage canvas = null;
if(region.rotate){
canvas = new BufferedImage(height, width, BufferedImage.TYPE_INT_ARGB);
canvas.getGraphics().drawImage(root, 0, 0, height, width, x, y, x+height, y+width, null);
}else{
canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
canvas.getGraphics().drawImage(root, 0, 0, width, height, x, y, x+width, y+height, null);
}
if(offsetX!=0 || offsetY!=0){
BufferedImage canvas2 = canvas;
canvas = new BufferedImage(sizeWidth, sizeHeight, BufferedImage.TYPE_INT_ARGB);
canvas.getGraphics().drawImage(canvas2, offsetX, offsetY, width, height, 0, 0, width, height, null);
}
if(region.rotate){
canvas = rotate(canvas, Math.toRadians(90));
}
ImageIO.write(canvas, "png", new File(dstDir+fileName+".png"));
System.out.println("Proccess to "+dstDir+fileName +".png" + " offsetX:"+region.offsetX+",offsetY:"+region.offsetY +" rotate:"+region.rotate);
}
}
示例8: a
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static void a(String paramString, TextureAtlas.TextureAtlasData paramTextureAtlasData, o<TextureAtlas> paramo)
{
if (paramTextureAtlasData != null)
com.nianticproject.ingress.common.x.i.a().a(new f(paramTextureAtlasData, paramo, paramString));
}
示例9: c
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
public static TextureAtlas.TextureAtlasData c(String paramString)
{
FileHandle localFileHandle = (FileHandle)an.a(a(paramString));
return new TextureAtlas.TextureAtlasData(localFileHandle, localFileHandle.parent(), false);
}
示例10: f
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
f(TextureAtlas.TextureAtlasData paramTextureAtlasData, o paramo, String paramString)
{
}