Changeset 7136 in josm
- Timestamp:
- 2014-05-17T23:52:55+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
r7083 r7136 55 55 color = c.get(FILL_COLOR, null, Color.class); 56 56 if (color != null) { 57 int alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50)))); 57 int alpha = color.getAlpha(); 58 if (alpha == 255) { 59 // Assume alpha value has not been specified by the user if 60 // is set to fully opaque. Use default value in this case. 61 // It is not an ideal solution, but a little tricky to get this 62 // right, especially as named map colors can be changed in 63 // the preference GUI and written to the preferences file. 64 alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50)))); 65 } 58 66 Integer pAlpha = Utils.color_float2int(c.get(FILL_OPACITY, null, float.class)); 59 67 if (pAlpha != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r7083 r7136 24 24 c.put(WIDTH, Keyword.DEFAULT); 25 25 c.put(COLOR, color != null ? color : PaintColors.UNTAGGED.get()); 26 c.put(OPACITY, 1f); 26 27 if (isAreaEdge) { 27 28 c.put(Z_INDEX, -3f); … … 169 170 } 170 171 172 int alpha = 255; 171 173 Color color = c.get(type.prefix + COLOR, null, Color.class); 174 if (color != null) { 175 alpha = color.getAlpha(); 176 } 172 177 if (type == LineType.NORMAL && color == null) { 173 178 color = c.get(FILL_COLOR, null, Color.class); … … 177 182 } 178 183 179 int alpha = 255;180 184 Integer pAlpha = Utils.color_float2int(c.get(type.prefix + OPACITY, null, Float.class)); 181 185 if (pAlpha != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r7099 r7136 216 216 Stroke stroke = null; 217 217 if (strokeColor != null) { 218 float strokeAlpha = c.get("symbol-stroke-opacity", 1f, Float.class); 219 strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(), 220 strokeColor.getBlue(), Utils.color_float2int(strokeAlpha)); 218 Integer strokeAlpha = Utils.color_float2int(c.get("symbol-stroke-opacity", null, Float.class)); 219 if (strokeAlpha != null) { 220 strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(), 221 strokeColor.getBlue(), strokeAlpha); 222 } 221 223 stroke = new BasicStroke(strokeWidth); 222 224 } … … 228 230 229 231 if (fillColor != null) { 230 float fillAlpha = c.get("symbol-fill-opacity", 1f, Float.class); 231 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), 232 fillColor.getBlue(), Utils.color_float2int(fillAlpha)); 232 Integer fillAlpha = Utils.color_float2int(c.get("symbol-fill-opacity", null, Float.class)); 233 if (fillAlpha != null) { 234 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), 235 fillColor.getBlue(), fillAlpha); 236 } 233 237 } 234 238 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r7103 r7136 202 202 */ 203 203 public static Color rgb(float r, float g, float b) { 204 Color c;205 204 try { 206 c =new Color(r, g, b);205 return new Color(r, g, b); 207 206 } catch (IllegalArgumentException e) { 208 207 return null; 209 208 } 210 return c; 209 } 210 211 public static Color rgba(float r, float g, float b, float alpha) { 212 try { 213 return new Color(r, g, b, alpha); 214 } catch (IllegalArgumentException e) { 215 return null; 216 } 211 217 } 212 218
Note:
See TracChangeset
for help on using the changeset viewer.