Java 类com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData 实例源码

项目:ingress-indonesia-dev    文件:TextureAtlasLoader.java   
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;
}
项目:gdx-texture-packer-gui    文件:TextureUnpacker.java   
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);
}
项目:libgdxcn    文件:TextureUnpacker.java   
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);
}
项目:ingress-indonesia-dev    文件:TextureAtlasLoader.java   
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);
}
项目:bladecoder-adventure-engine    文件:ImageUtils.java   
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());
}
项目:bladecoder-adventure-engine    文件:ImageUtils.java   
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());
}
项目:vis-editor    文件:AtlasRegionAssetTransactionGenerator.java   
@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;
}
项目:c2d-engine    文件:CrackTextureAtlasTool.java   
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);
    }
}
项目:ingress-indonesia-dev    文件:c.java   
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));
}
项目:ingress-indonesia-dev    文件:c.java   
public static TextureAtlas.TextureAtlasData c(String paramString)
{
  FileHandle localFileHandle = (FileHandle)an.a(a(paramString));
  return new TextureAtlas.TextureAtlasData(localFileHandle, localFileHandle.parent(), false);
}
项目:ingress-indonesia-dev    文件:f.java   
f(TextureAtlas.TextureAtlasData paramTextureAtlasData, o paramo, String paramString)
{
}