Skip to content

Commit

Permalink
Fixed texture regions get written with wrong padding.
Browse files Browse the repository at this point in the history
LibGDX fixes for texture unpacker.
Version changed to 4.8.1
  • Loading branch information
metaphore committed Nov 11, 2018
1 parent 7aa6f4c commit d88727a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[LATEST]
[4.8.1]
- Fixed texture regions get written with wrong padding.
- Fixed texture unpacker extracts regions with wrong sizes occasionally.

[4.8.0]
- Atlases can be saved as indexed-mode PNG8 image (compression type). Optionally dithering colors that don't match exactly.
- Asynchronous (non blocking) page preview loading.
- Multiple of four page size option added.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allprojects {

ext {
appName = "gdx-texturepacker"
version = '4.8.0'
version = '4.8.1'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private void writePackFile (File outputDir, String scaledPackFileName, Array<Pag
private void writeRect (Writer writer, Page page, Rect rect, String name) throws IOException {
writer.write(Rect.getAtlasName(name, settings.flattenPaths) + "\n");
writer.write(" rotate: " + rect.rotated + "\n");
writer.write(" xy: " + (page.x + rect.x) + ", " + (page.y + page.height - rect.y - (rect.height - settings.paddingY)) + "\n");
writer.write(" xy: " + (page.x + rect.x) + ", " + (page.y + page.height - rect.height - rect.y) + "\n");

writer.write(" size: " + rect.regionWidth + ", " + rect.regionHeight + "\n");
if (rect.splits != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public void splitAtlas (TextureAtlasData atlas, String outputDir) {
// check if the region is a ninepatch or a normal image and delegate accordingly
if (region.splits == null) {
splitImage = extractImage(img, region, outputDirFile, 0);
if (region.width != region.originalWidth || region.height != region.originalHeight) {
BufferedImage originalImg = new BufferedImage(region.originalWidth, region.originalHeight, img.getType());
Graphics2D g2 = originalImg.createGraphics();
g2.drawImage(splitImage, (int) region.offsetX, (int) (region.originalHeight - region.height - region.offsetY), null);
g2.dispose();
splitImage = originalImg;
}
extension = OUTPUT_TYPE;
} else {
splitImage = extractNinePatch(img, region, outputDirFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Locale;

public class AppConstants {
public static final Version version = new Version("4.8.0");
public static final Version version = new Version("4.8.1");
public static final String APP_TITLE = "GDX Texture Packer";
public static final String EXTERNAL_DIR = ".gdxtexturepackergui";
public static final String MODULES_DIR = EXTERNAL_DIR + File.separator + "modules";
Expand Down

0 comments on commit d88727a

Please sign in to comment.