mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 13:10:46 +00:00
#481 Image exporting fixed (DefineBitsJPEG2/3 erroneous header)
This commit is contained in:
@@ -171,7 +171,7 @@ public class SWFInputStream extends InputStream {
|
||||
*
|
||||
* @param pos Number of bytes
|
||||
*/
|
||||
public void seek(int pos) throws IOException {
|
||||
public void seek(long pos) throws IOException {
|
||||
if (is instanceof SeekableInputStream) {
|
||||
SeekableInputStream sis = (SeekableInputStream) is;
|
||||
sis.seek(pos);
|
||||
|
||||
@@ -48,6 +48,9 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag {
|
||||
@Override
|
||||
public BufferedImage getImage(List<Tag> tags) {
|
||||
try {
|
||||
if (SWF.hasErrorHeader(imageData)) {
|
||||
return ImageIO.read(new ByteArrayInputStream(imageData, 4, imageData.length - 4));
|
||||
}
|
||||
return ImageIO.read(new ByteArrayInputStream(imageData));
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
@@ -69,7 +69,12 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag {
|
||||
@Override
|
||||
public BufferedImage getImage(List<Tag> tags) {
|
||||
try {
|
||||
BufferedImage img = ImageIO.read(new ByteArrayInputStream(imageData));
|
||||
BufferedImage img;
|
||||
if (SWF.hasErrorHeader(imageData)) {
|
||||
img = ImageIO.read(new ByteArrayInputStream(imageData, 4, imageData.length - 4));
|
||||
} else {
|
||||
img = ImageIO.read(new ByteArrayInputStream(imageData));
|
||||
}
|
||||
if (bitmapAlphaData.length == 0) {
|
||||
return img;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,9 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
btrans.preConcatenate(AffineTransform.getTranslateInstance(startX / DESCALE, startY / DESCALE));
|
||||
g.setTransform(btrans);
|
||||
BufferedImage img = image.getImage(tags);
|
||||
g.setPaint(new TexturePaint(img, new Rectangle(img.getWidth(), img.getHeight())));
|
||||
if (img != null) {
|
||||
g.setPaint(new TexturePaint(img, new Rectangle(img.getWidth(), img.getHeight())));
|
||||
}
|
||||
g.fill(new Rectangle(-16384 * maxRepeat, -16384 * maxRepeat, 16384 * 2 * maxRepeat, 16384 * 2 * maxRepeat));
|
||||
g.setTransform(oldAf);
|
||||
g.setClip(null);
|
||||
|
||||
Reference in New Issue
Block a user