- Timestamp:
- 2017-03-08T16:47:38+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r11689 r11700 12 12 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 13 13 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 14 import org.openstreetmap.josm.data.preferences.IntegerProperty; 14 15 import org.openstreetmap.josm.gui.mappaint.Cascade; 15 16 import org.openstreetmap.josm.gui.mappaint.Environment; … … 24 25 */ 25 26 public class AreaElement extends StyleElement { 27 28 /** 29 * The default opacity for the fill. For historical reasons in range 0.255. 30 */ 31 private static final IntegerProperty DEFAULT_FILL_ALPHA = new IntegerProperty("mappaint.fillalpha", 50); 26 32 27 33 /** … … 98 104 ); 99 105 100 fillImage.alpha = Math.min(255, Math.max(0, Main.pref.getInteger("mappaint.fill-image-alpha", 255)));106 fillImage.alpha = Utils.clamp(Main.pref.getInteger("mappaint.fill-image-alpha", 255), 0, 255); 101 107 Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class)); 102 108 if (pAlpha != null) { … … 106 112 color = c.get(FILL_COLOR, null, Color.class); 107 113 if (color != null) { 108 int alpha = color.getAlpha(); 109 if (alpha == 255) { 110 // Assume alpha value has not been specified by the user if 111 // is set to fully opaque. Use default value in this case. 112 // It is not an ideal solution, but a little tricky to get this 113 // right, especially as named map colors can be changed in 114 // the preference GUI and written to the preferences file. 115 alpha = Math.min(255, Math.max(0, Main.pref.getInteger("mappaint.fillalpha", 50))); 116 } 117 Integer pAlpha = Utils.colorFloat2int(c.get(FILL_OPACITY, null, float.class)); 118 if (pAlpha != null) { 119 alpha = pAlpha; 120 } 121 color = new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); 114 float defaultOpacity = Utils.colorInt2float(DEFAULT_FILL_ALPHA.get()); 115 float opacity = c.get(FILL_OPACITY, defaultOpacity, Float.class); 116 color = Utils.alphaMultiply(color, opacity); 122 117 } 123 118 }
Note:
See TracChangeset
for help on using the changeset viewer.