mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Patch to CardPicturePanel to work on cropped Card Images
BufferedImage (deep) copy procedure applied in CardPicturePanel may not always work when the input image has been originally cropped. The issue is caused by `image.copyData(null)` which may sometimes work on the original (uncropped) underlying raster. This patch fixes this issue! Source: https://stackoverflow.com/a/26894825/2969461
This commit is contained in:
@@ -84,7 +84,7 @@ public final class CardPicturePanel extends JPanel implements ImageFetcher.Callb
|
||||
if (displayed instanceof PaperCard) {
|
||||
ColorModel cm = image.getColorModel();
|
||||
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
|
||||
WritableRaster raster = image.copyData(null);
|
||||
WritableRaster raster = image.copyData(image.getRaster().createCompatibleWritableRaster());
|
||||
final BufferedImage displayedimage = new BufferedImage(cm, raster, isAlphaPremultiplied, null)
|
||||
.getSubimage(0, 0, image.getWidth(), image.getHeight());
|
||||
this.currentImage = displayedimage;
|
||||
|
||||
Reference in New Issue
Block a user