Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java	(revision 11699)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java	(revision 11700)
@@ -12,4 +12,5 @@
 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
+import org.openstreetmap.josm.data.preferences.IntegerProperty;
 import org.openstreetmap.josm.gui.mappaint.Cascade;
 import org.openstreetmap.josm.gui.mappaint.Environment;
@@ -24,4 +25,9 @@
  */
 public class AreaElement extends StyleElement {
+
+    /**
+     * The default opacity for the fill. For historical reasons in range 0.255.
+     */
+    private static final IntegerProperty DEFAULT_FILL_ALPHA = new IntegerProperty("mappaint.fillalpha", 50);
 
     /**
@@ -98,5 +104,5 @@
             );
 
-            fillImage.alpha = Math.min(255, Math.max(0, Main.pref.getInteger("mappaint.fill-image-alpha", 255)));
+            fillImage.alpha = Utils.clamp(Main.pref.getInteger("mappaint.fill-image-alpha", 255), 0, 255);
             Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class));
             if (pAlpha != null) {
@@ -106,18 +112,7 @@
             color = c.get(FILL_COLOR, null, Color.class);
             if (color != null) {
-                int alpha = color.getAlpha();
-                if (alpha == 255) {
-                    // Assume alpha value has not been specified by the user if
-                    // is set to fully opaque. Use default value in this case.
-                    // It is not an ideal solution, but a little tricky to get this
-                    // right, especially as named map colors can be changed in
-                    // the preference GUI and written to the preferences file.
-                    alpha = Math.min(255, Math.max(0, Main.pref.getInteger("mappaint.fillalpha", 50)));
-                }
-                Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class));
-                if (pAlpha != null) {
-                    alpha = pAlpha;
-                }
-                color = new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha);
+                float defaultOpacity = Utils.colorInt2float(DEFAULT_FILL_ALPHA.get());
+                float opacity = c.get(FILL_OPACITY, defaultOpacity, Float.class);
+                color = Utils.alphaMultiply(color, opacity);
             }
         }
