sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/03: Fix image transparency.
Date Wed, 17 Jun 2020 17:39:28 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit f2c4c2308f30e4b07b6698c73329c9e6162c8f60
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Jun 17 16:13:20 2020 +0200

    Fix image transparency.
---
 .../src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java          | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
index 57cd3c9..6816258 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
@@ -18,6 +18,7 @@ package org.apache.sis.gui.map;
 
 import java.util.Locale;
 import java.nio.IntBuffer;
+import java.awt.AlphaComposite;
 import java.awt.Graphics2D;
 import java.awt.GraphicsEnvironment;
 import java.awt.GraphicsConfiguration;
@@ -388,13 +389,13 @@ public abstract class MapCanvasAWT extends MapCanvas {
             VolatileImage drawTo = previousBuffer;
             previousBuffer = null;                      // For letting GC do its work.
             if (drawTo == null) {
-                drawTo = configuration.createCompatibleVolatileImage(width, height);
+                drawTo = configuration.createCompatibleVolatileImage(width, height, VolatileImage.TRANSLUCENT);
             }
             boolean invalid = true;
             try {
                 do {
                     if (drawTo.validate(configuration) == VolatileImage.IMAGE_INCOMPATIBLE)
{
-                        drawTo = configuration.createCompatibleVolatileImage(width, height);
+                        drawTo = configuration.createCompatibleVolatileImage(width, height,
VolatileImage.TRANSLUCENT);
                     }
                     final Graphics2D gr = drawTo.createGraphics();
                     try {
@@ -422,6 +423,7 @@ public abstract class MapCanvasAWT extends MapCanvas {
             final VolatileImage drawTo = doubleBuffer;
             final Graphics2D gr = buffer.createGraphics();
             try {
+                gr.setComposite(AlphaComposite.Src);        // Copy source (previous destination
is discarded).
                 gr.drawImage(drawTo, 0, 0, null);
                 contentsLost = drawTo.contentsLost();
             } finally {


Mime
View raw message