当前位置: 首页>>代码示例>>Java>>正文


Java TextureAtlasData类代码示例

本文整理汇总了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;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:25,代码来源:TextureAtlasLoader.java

示例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);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:30,代码来源:TextureUnpacker.java

示例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);
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:11,代码来源:TextureAtlasLoader.java

示例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());
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:17,代码来源:ImageUtils.java

示例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());
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:7,代码来源:ImageUtils.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:77,代码来源:AtlasRegionAssetTransactionGenerator.java

示例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);
	}
}
 
开发者ID:lycying,项目名称:c2d-engine,代码行数:46,代码来源:CrackTextureAtlasTool.java

示例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));
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:6,代码来源:c.java

示例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);
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:6,代码来源:c.java

示例10: f

import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData; //导入依赖的package包/类
f(TextureAtlas.TextureAtlasData paramTextureAtlasData, o paramo, String paramString)
{
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:4,代码来源:f.java


注:本文中的com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。