Fix bug reencoding 9patch pngs

Fixes issue 1180.
https://github.com/iBotPeaches/Apktool/issues/1180
This commit is contained in:
Matt Sarett 2016-03-03 18:17:11 -05:00
parent 5c7702396d
commit ae6f8083f1

View File

@ -39,10 +39,9 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
BufferedImage im = ImageIO.read(new ByteArrayInputStream(data)); BufferedImage im = ImageIO.read(new ByteArrayInputStream(data));
int w = im.getWidth(), h = im.getHeight(); int w = im.getWidth(), h = im.getHeight();
ImageTypeSpecifier its = ImageTypeSpecifier.createFromRenderedImage( im ); BufferedImage im2 = new BufferedImage( w+2, h+2, BufferedImage.TYPE_INT_ARGB );
BufferedImage im2 = its.createBufferedImage( w+2, h+2 ); im2.createGraphics().drawImage( im, 1, 1, w, h, null );
im2.getRaster().setRect(1, 1, im.getRaster());
NinePatch np = getNinePatch(data); NinePatch np = getNinePatch(data);
drawHLine(im2, h + 1, np.padLeft + 1, w - np.padRight); drawHLine(im2, h + 1, np.padLeft + 1, w - np.padRight);
drawVLine(im2, w + 1, np.padTop + 1, h - np.padBottom); drawVLine(im2, w + 1, np.padTop + 1, h - np.padBottom);