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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 6803db71ce Put a pattern in background of images for making easier to 
see where the data is defined.
6803db71ce is described below

commit 6803db71cef4ec512c147274162aeb081968ce2f
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Mon Dec 1 17:27:39 2025 +0100

    Put a pattern in background of images for making easier to see where the 
data is defined.
---
 .../org/apache/sis/gui/coverage/Background.png     | Bin 0 -> 95 bytes
 .../apache/sis/gui/coverage/CoverageCanvas.java    |  29 ++++++++++++++-------
 .../apache/sis/gui/coverage/CoverageControls.java  |   2 --
 .../org/apache/sis/gui/coverage/GridError.java     |   3 +--
 .../org/apache/sis/gui/dataset/ExpandableList.java |   4 +--
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/Background.png
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/Background.png
new file mode 100644
index 0000000000..ebc31fdb77
Binary files /dev/null and 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/Background.png
 differ
diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
index a890b276b9..2183559c49 100644
--- 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -23,6 +23,7 @@ import java.util.Locale;
 import java.util.concurrent.Future;
 import java.util.logging.LogRecord;
 import java.io.IOException;
+import java.io.InputStream;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
@@ -32,16 +33,16 @@ import java.awt.image.RenderedImage;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.NoninvertibleTransformException;
 import java.awt.geom.Rectangle2D;
-import javafx.scene.paint.Color;
 import javafx.scene.layout.Region;
 import javafx.scene.layout.Background;
-import javafx.scene.layout.BackgroundFill;
 import javafx.beans.DefaultProperty;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
 import javafx.application.Platform;
 import javafx.concurrent.Task;
 import javafx.geometry.Insets;
+import javafx.scene.image.Image;
+import javafx.scene.layout.BackgroundImage;
 import javax.measure.Quantity;
 import javax.measure.quantity.Length;
 import org.opengis.geometry.Envelope;
@@ -99,6 +100,22 @@ import static org.apache.sis.gui.internal.LogHandler.LOGGER;
  */
 @DefaultProperty("coverage")
 public class CoverageCanvas extends MapCanvasAWT {
+    /**
+     * The default background for this canvas.
+     */
+    private static final Background BACKGROUND;
+    static {
+        Background background = null;
+        try (InputStream in = 
CoverageCanvas.class.getResourceAsStream("Background.png")) {
+            if (in != null) {
+                background = new Background(new BackgroundImage(new Image(in), 
null, null, null, null));
+            }
+        } catch (IOException e) {
+            Logging.unexpectedException(LOGGER, CoverageCanvas.class, 
"BACKGROUND", e);
+        }
+        BACKGROUND = background;
+    }
+
     /**
      * An arbitrary safety margin (in number of pixels) for avoiding integer 
overflow situation.
      * This margin shall be larger than any reasonable widget width or height, 
and much smaller
@@ -278,6 +295,7 @@ public class CoverageCanvas extends MapCanvasAWT {
         coverageProperty     .addListener((p,o,n) -> onPropertySpecified(null, 
n, resourceProperty, null));
         sliceExtentProperty  .addListener((p,o,n) -> 
onPropertySpecified(getResource(), getCoverage(), null, null));
         interpolationProperty.addListener((p,o,n) -> 
onInterpolationSpecified(n));
+        fixedPane.setBackground(BACKGROUND);
     }
 
     /**
@@ -460,13 +478,6 @@ public class CoverageCanvas extends MapCanvasAWT {
         requestRepaint();
     }
 
-    /**
-     * Sets the background, as a color for now but more patterns may be 
allowed in a future version.
-     */
-    final void setBackground(final Color color) {
-        fixedPane.setBackground(new Background(new BackgroundFill(color, null, 
null)));
-    }
-
     /**
      * Sets the Coordinate Reference System in which the coverage is resampled 
before displaying.
      * The new CRS must be compatible with the previous CRS, i.e. a coordinate 
operation between
diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageControls.java
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageControls.java
index f5ea4e2206..fce775001d 100644
--- 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageControls.java
+++ 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageControls.java
@@ -28,7 +28,6 @@ import javafx.scene.layout.Region;
 import javafx.scene.layout.VBox;
 import javafx.scene.layout.Priority;
 import javafx.collections.ObservableList;
-import javafx.scene.paint.Color;
 import org.apache.sis.coverage.Category;
 import org.apache.sis.coverage.grid.GridCoverage;
 import org.apache.sis.storage.GridCoverageResource;
@@ -96,7 +95,6 @@ final class CoverageControls extends ViewAndControls {
         final Vocabulary vocabulary = Vocabulary.forLocale(locale);
 
         view = new CoverageCanvas(this, locale);
-        view.setBackground(Color.BLACK);
         status.track(view);
         final MapMenu menu = new MapMenu(view);
         menu.addReferenceSystems(owner.referenceSystems);
diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/GridError.java
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/GridError.java
index 5bdc4fa079..0f951b9d57 100644
--- 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/GridError.java
+++ 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/GridError.java
@@ -22,7 +22,6 @@ import javafx.geometry.Insets;
 import javafx.scene.control.Button;
 import javafx.scene.control.Label;
 import javafx.scene.layout.Background;
-import javafx.scene.layout.BackgroundFill;
 import javafx.scene.layout.TilePane;
 import javafx.scene.layout.VBox;
 import javafx.scene.paint.Color;
@@ -43,7 +42,7 @@ final class GridError extends VBox {
     /**
      * The background for error boxes.
      */
-    private static final Background BACKGROUND = new Background(new 
BackgroundFill(Color.FLORALWHITE, null, null));
+    private static final Background BACKGROUND = 
Background.fill(Color.FLORALWHITE);
 
     /**
      * The tile in error.
diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ExpandableList.java
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ExpandableList.java
index 80861ca665..d14f8567aa 100644
--- 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ExpandableList.java
+++ 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ExpandableList.java
@@ -30,7 +30,6 @@ import javafx.scene.text.TextAlignment;
 import javafx.collections.ListChangeListener;
 import javafx.collections.transformation.TransformationList;
 import javafx.scene.layout.Background;
-import javafx.scene.layout.BackgroundFill;
 import org.apache.sis.util.internal.shared.UnmodifiableArrayList;
 import org.apache.sis.gui.internal.Styles;
 
@@ -54,8 +53,7 @@ final class ExpandableList extends 
TransformationList<Feature,Feature>
     /**
      * The background of {@linkplain #expansion} rows header.
      */
-    private static final Background EXPANSION_HEADER =
-            new Background(new BackgroundFill(Styles.EXPANDED_ROW, null, 
null));
+    private static final Background EXPANSION_HEADER = 
Background.fill(Styles.EXPANDED_ROW);
 
     /**
      * The icon for rows that can be expanded.

Reply via email to