mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-04 23:35:10 +00:00
Fixed: Copying to clipboard does not support transparency
This commit is contained in:
@@ -171,6 +171,14 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor() {
|
||||
if (swf != null && swf.getBackgroundColor() != null) {
|
||||
return swf.getBackgroundColor().backgroundColor.toColor();
|
||||
}
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
private class IconPanel extends JPanel {
|
||||
|
||||
private SerializableImage _img;
|
||||
|
||||
@@ -323,4 +323,9 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
loopCount--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor() {
|
||||
return Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis
|
||||
|
||||
private float frameRate;
|
||||
|
||||
private Color bgColor;
|
||||
|
||||
@Override
|
||||
public boolean loopAvailable() {
|
||||
return false;
|
||||
@@ -435,4 +437,12 @@ public final class FlashPlayerPanel extends Panel implements Closeable, MediaDis
|
||||
public void removeEventListener(MediaDisplayListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor() {
|
||||
if (bgColor == null) {
|
||||
return Color.white;
|
||||
}
|
||||
return bgColor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,4 +67,6 @@ public interface MediaDisplay extends Closeable {
|
||||
public void addEventListener(MediaDisplayListener listener);
|
||||
|
||||
public void removeEventListener(MediaDisplayListener listener);
|
||||
|
||||
public Color getBackgroundColor();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Toolkit;
|
||||
@@ -585,7 +586,16 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
if (img == null) {
|
||||
return;
|
||||
}
|
||||
TransferableImage trans = new TransferableImage(img);
|
||||
|
||||
//Copy to clipboard does not support transparency
|
||||
BufferedImage newImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g = newImage.createGraphics();
|
||||
g.setColor(display.getBackgroundColor());
|
||||
g.fillRect(0, 0, img.getWidth(), img.getHeight());
|
||||
g.drawImage(img, 0, 0, null);
|
||||
g.dispose();
|
||||
|
||||
TransferableImage trans = new TransferableImage(newImage);
|
||||
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
c.setContents(trans, new ClipboardOwner() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user