Incorporating FIX to Image copy on subimage + method to reset alpha.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
leriomaggio
2021-09-15 19:36:38 +01:00
parent c732289690
commit ac2c085324

View File

@@ -91,7 +91,7 @@ public final class CardPicturePanel extends JPanel implements ImageFetcher.Callb
if (displayed instanceof PaperCard) { if (displayed instanceof PaperCard) {
ColorModel cm = image.getColorModel(); ColorModel cm = image.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied(); 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) final BufferedImage displayedimage = new BufferedImage(cm, raster, isAlphaPremultiplied, null)
.getSubimage(0, 0, image.getWidth(), image.getHeight()); .getSubimage(0, 0, image.getWidth(), image.getHeight());
this.currentImage = displayedimage; this.currentImage = displayedimage;
@@ -150,4 +150,8 @@ public final class CardPicturePanel extends JPanel implements ImageFetcher.Callb
public void showAsDisabled(){ public void showAsDisabled(){
this.panel.setAlpha(0.5f); this.panel.setAlpha(0.5f);
} }
public void showAsEnabled(){
this.panel.setAlpha(0.0f);
}
} }