Ignore:
Timestamp:
2014-05-17T23:52:55+02:00 (10 years ago)
Author:
bastiK
Message:

mapcss: add support for alpha info in color property, e.g.
color: #aa0022ee; or color: rgba(1.0, 0.2, 0.8, 0.8);
*opacity properties still have higher priority, if specified
explicitly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r7099 r7136  
    216216        Stroke stroke = null;
    217217        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            }
    221223            stroke = new BasicStroke(strokeWidth);
    222224        }
     
    228230
    229231        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            }
    233237        }
    234238
Note: See TracChangeset for help on using the changeset viewer.