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

项目: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;
}
项目:libgdxcn    文件:TextureAtlas.java   
public Page (FileHandle handle, float width, float height, boolean useMipMaps, Format format, TextureFilter minFilter,
    TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap) {
    this.width = width;
    this.height = height;
    this.textureFile = handle;
    this.useMipMaps = useMipMaps;
    this.format = format;
    this.minFilter = minFilter;
    this.magFilter = magFilter;
    this.uWrap = uWrap;
    this.vWrap = vWrap;
}
项目:libgdxcn    文件:TextureAtlas.java   
private void load (TextureAtlasData data) {
    ObjectMap<Page, Texture> pageToTexture = new ObjectMap<Page, Texture>();
    for (Page page : data.pages) {
        Texture texture = null;
        if (page.texture == null) {
            texture = new Texture(page.textureFile, page.format, page.useMipMaps);
            texture.setFilter(page.minFilter, page.magFilter);
            texture.setWrap(page.uWrap, page.vWrap);
        } else {
            texture = page.texture;
            texture.setFilter(page.minFilter, page.magFilter);
            texture.setWrap(page.uWrap, page.vWrap);
        }
        textures.add(texture);
        pageToTexture.put(page, texture);
    }

    for (Region region : data.regions) {
        int width = region.width;
        int height = region.height;
        AtlasRegion atlasRegion = new AtlasRegion(pageToTexture.get(region.page), region.left, region.top,
            region.rotate ? height : width, region.rotate ? width : height);
        atlasRegion.index = region.index;
        atlasRegion.name = region.name;
        atlasRegion.offsetX = region.offsetX;
        atlasRegion.offsetY = region.offsetY;
        atlasRegion.originalHeight = region.originalHeight;
        atlasRegion.originalWidth = region.originalWidth;
        atlasRegion.rotate = region.rotate;
        atlasRegion.splits = region.splits;
        atlasRegion.pads = region.pads;
        if (region.flip) atlasRegion.flip(false, true);
        regions.add(atlasRegion);
    }
}
项目:libgdxcn    文件:TextureAtlasLoader.java   
@Override
public TextureAtlas load (AssetManager assetManager, String fileName, FileHandle file, TextureAtlasParameter parameter) {
    for (Page page : data.getPages()) {
        Texture texture = assetManager.get(page.textureFile.path().replaceAll("\\\\", "/"), Texture.class);
        page.texture = texture;
    }

    return new TextureAtlas(data);
}
项目: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);
}
项目:libgdxcn    文件:TextureAtlas.java   
public Array<Page> getPages () {
    return pages;
}
项目: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;
}