diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java index 2b2323bb2..9a24574f0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG3Tag.java @@ -135,6 +135,10 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag { setModified(true); } + public byte[] getImageAlpha() throws IOException { + return SWFInputStream.uncompressByteArray(bitmapAlphaData.getRangeData()); + } + public void setImageAlpha(byte[] data) throws IOException { ImageFormat fmt = ImageTag.getImageFormat(imageData); if (fmt != ImageFormat.JPEG) { @@ -194,7 +198,7 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag { return img; } - byte[] alphaData = SWFInputStream.uncompressByteArray(bitmapAlphaData.getRangeData()); + byte[] alphaData = getImageAlpha(); int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); for (int i = 0; i < pixels.length; i++) { int a = alphaData[i] & 0xff; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java index 38e7a6baf..b7532ca92 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG4Tag.java @@ -140,6 +140,10 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag { setModified(true); } + public byte[] getImageAlpha() throws IOException { + return SWFInputStream.uncompressByteArray(bitmapAlphaData.getRangeData()); + } + public void setImageAlpha(byte[] data) throws IOException { ImageFormat fmt = ImageTag.getImageFormat(imageData); if (fmt != ImageFormat.JPEG) { @@ -195,7 +199,7 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag { return img; } - byte[] alphaData = SWFInputStream.uncompressByteArray(bitmapAlphaData.getRangeData()); + byte[] alphaData = getImageAlpha(); int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); for (int i = 0; i < pixels.length; i++) { int a = alphaData[i] & 0xff; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 7b29e337d..caeaa7c4d 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2611,7 +2611,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se SWF swf = it.getSwf(); swf.clearImageCache(); } catch (IOException ex) { - logger.log(Level.SEVERE, "Invalid image", ex); + logger.log(Level.SEVERE, "Invalid alpha channel data", ex); View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 8ad471245..1d71f84a6 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -625,3 +625,4 @@ import.script.result = %count% scripts imported. import.script.as12warning = Import script can import only AS1/2 scripts. error.constantPoolTooBig = Constant pool is too big. index=%index%, size=%size% +error.image.alpha.invalid = Invalid alpha channel data. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 228452542..040d889ba 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -624,3 +624,4 @@ import.script.result = %count% szkript import\u00e1lva. import.script.as12warning = A szkript import\u00e1l\u00e1s csak AS1/2 szkriptekre m\u0171k\u00f6dik. error.constantPoolTooBig = Karakter l\u00e1nc t\u00e1rol\u00f3 t\u00fal nagy. index=%index%, m\u00e9ret=%size% +error.image.alpha.invalid = \u00c9rv\u00e9nytelen alfa csatorna adat.