for (String name : page.addedRects) { PixmapPackerRectangle rect = page.rects.get(name); TextureAtlas.AtlasRegion region = new TextureAtlas.AtlasRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
for (String name : page.addedRects) { PixmapPackerRectangle rect = page.rects.get(name); TextureAtlas.AtlasRegion region = new TextureAtlas.AtlasRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
/** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method * uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */ public Array<AtlasRegion> findRegions (String name) { Array<AtlasRegion> matched = new Array(AtlasRegion.class); for (int i = 0, n = regions.size; i < n; i++) { AtlasRegion region = regions.get(i); if (region.name.equals(name)) matched.add(new AtlasRegion(region)); } return matched; }
TextureAtlas.AtlasRegion atlasRegion = textureAtlas.findRegion(getLocalizedString(imageModel.getFrame())); if (imageModel.isFlipX() || imageModel.isFlipY()) { atlasRegion = new TextureAtlas.AtlasRegion(atlasRegion); atlasRegion.flip(imageModel.isFlipX(), imageModel.isFlipY());
/** Updates the {@link TextureAtlas}, adding any new {@link Pixmap} instances packed since the last call to this method. This * can be used to insert Pixmap instances on a separate thread via {@link #pack(String, Pixmap)} and update the TextureAtlas on * the rendering thread. This method must be called on the rendering thread. After calling this method, disposing the packer * will no longer dispose the page pixmaps. */ public synchronized void updateTextureAtlas (TextureAtlas atlas, TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) { updatePageTextures(minFilter, magFilter, useMipMaps); for (Page page : pages) { if (page.addedRects.size > 0) { for (String name : page.addedRects) { PixmapPackerRectangle rect = page.rects.get(name); TextureAtlas.AtlasRegion region = new TextureAtlas.AtlasRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); if (rect.splits != null) { region.splits = rect.splits; region.pads = rect.pads; } region.name = name; region.index = -1; region.offsetX = rect.offsetX; region.offsetY = (int)(rect.originalHeight - rect.height - rect.offsetY); region.originalWidth = rect.originalWidth; region.originalHeight = rect.originalHeight; atlas.getRegions().add(region); } page.addedRects.clear(); atlas.getTextures().add(page.texture); } } }
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;
public AtlasSprite (AtlasRegion region) { this.region = new AtlasRegion(region); originalOffsetX = region.offsetX; originalOffsetY = region.offsetY; setRegion(region); setOrigin(region.originalWidth / 2f, region.originalHeight / 2f); int width = region.getRegionWidth(); int height = region.getRegionHeight(); if (region.rotate) { super.rotate90(true); super.setBounds(region.offsetX, region.offsetY, height, width); } else super.setBounds(region.offsetX, region.offsetY, width, height); setColor(1, 1, 1, 1); }
/** Adds a region to the atlas. The specified texture will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, Texture texture, int x, int y, int width, int height) { textures.add(texture); AtlasRegion region = new AtlasRegion(texture, x, y, width, height); region.name = name; region.originalWidth = width; region.originalHeight = height; region.index = -1; regions.add(region); return region; }
/** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method * uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */ public Array<AtlasRegion> findRegions (String name) { Array<AtlasRegion> matched = new Array(AtlasRegion.class); for (int i = 0, n = regions.size; i < n; i++) { AtlasRegion region = regions.get(i); if (region.name.equals(name)) matched.add(new AtlasRegion(region)); } return matched; }
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;
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;
public AtlasSprite (AtlasRegion region) { this.region = new AtlasRegion(region); originalOffsetX = region.offsetX; originalOffsetY = region.offsetY; setRegion(region); setOrigin(region.originalWidth / 2f, region.originalHeight / 2f); int width = region.getRegionWidth(); int height = region.getRegionHeight(); if (region.rotate) { super.rotate90(true); super.setBounds(region.offsetX, region.offsetY, height, width); } else super.setBounds(region.offsetX, region.offsetY, width, height); setColor(1, 1, 1, 1); }
public AtlasSprite (AtlasRegion region) { this.region = new AtlasRegion(region); originalOffsetX = region.offsetX; originalOffsetY = region.offsetY; setRegion(region); setOrigin(region.originalWidth / 2f, region.originalHeight / 2f); int width = region.getRegionWidth(); int height = region.getRegionHeight(); if (region.rotate) { super.rotate90(true); super.setBounds(region.offsetX, region.offsetY, height, width); } else super.setBounds(region.offsetX, region.offsetY, width, height); setColor(1, 1, 1, 1); }
/** Adds a region to the atlas. The specified texture will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, Texture texture, int x, int y, int width, int height) { textures.add(texture); AtlasRegion region = new AtlasRegion(texture, x, y, width, height); region.name = name; region.index = -1; regions.add(region); return region; }
/** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method * uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */ public Array<AtlasRegion> findRegions (String name) { Array<AtlasRegion> matched = new Array(AtlasRegion.class); for (int i = 0, n = regions.size; i < n; i++) { AtlasRegion region = regions.get(i); if (region.name.equals(name)) matched.add(new AtlasRegion(region)); } return matched; }
/** Adds a region to the atlas. The texture for the specified region will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, TextureRegion textureRegion) { textures.add(textureRegion.texture); AtlasRegion region = new AtlasRegion(textureRegion); region.name = name; region.index = -1; regions.add(region); return region; }
/** Adds a region to the atlas. The specified texture will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, Texture texture, int x, int y, int width, int height) { textures.add(texture); AtlasRegion region = new AtlasRegion(texture, x, y, width, height); region.name = name; region.index = -1; regions.add(region); return region; }
/** Adds a region to the atlas. The texture for the specified region will be disposed when the atlas is disposed. */ public AtlasRegion addRegion (String name, TextureRegion textureRegion) { textures.add(textureRegion.texture); AtlasRegion region = new AtlasRegion(textureRegion); region.name = name; region.index = -1; regions.add(region); return region; }