(XML properties)
| 1125 | |
| 1126 | |
| 1127 | protected void parseColors(XML properties) { |
| 1128 | if (properties.hasAttribute("opacity")) { |
| 1129 | String opacityText = properties.getString("opacity"); |
| 1130 | setOpacity(opacityText); |
| 1131 | } |
| 1132 | |
| 1133 | if (properties.hasAttribute("stroke")) { |
| 1134 | String strokeText = properties.getString("stroke"); |
| 1135 | setColor(strokeText, false); |
| 1136 | } |
| 1137 | |
| 1138 | if (properties.hasAttribute("stroke-opacity")) { |
| 1139 | String strokeOpacityText = properties.getString("stroke-opacity"); |
| 1140 | setStrokeOpacity(strokeOpacityText); |
| 1141 | } |
| 1142 | |
| 1143 | if (properties.hasAttribute("stroke-width")) { |
| 1144 | // if NaN (i.e. if it's 'inherit') then default back to the inherit setting |
| 1145 | String lineweight = properties.getString("stroke-width"); |
| 1146 | setStrokeWeight(lineweight); |
| 1147 | } |
| 1148 | |
| 1149 | if (properties.hasAttribute("stroke-linejoin")) { |
| 1150 | String linejoin = properties.getString("stroke-linejoin"); |
| 1151 | setStrokeJoin(linejoin); |
| 1152 | } |
| 1153 | |
| 1154 | if (properties.hasAttribute("stroke-linecap")) { |
| 1155 | String linecap = properties.getString("stroke-linecap"); |
| 1156 | setStrokeCap(linecap); |
| 1157 | } |
| 1158 | |
| 1159 | // fill defaults to black (though stroke defaults to "none") |
| 1160 | // http://www.w3.org/TR/SVG/painting.html#FillProperties |
| 1161 | if (properties.hasAttribute("fill")) { |
| 1162 | String fillText = properties.getString("fill"); |
| 1163 | setColor(fillText, true); |
| 1164 | } |
| 1165 | |
| 1166 | if (properties.hasAttribute("fill-opacity")) { |
| 1167 | String fillOpacityText = properties.getString("fill-opacity"); |
| 1168 | setFillOpacity(fillOpacityText); |
| 1169 | } |
| 1170 | |
| 1171 | if (properties.hasAttribute("style")) { |
| 1172 | String styleText = properties.getString("style"); |
| 1173 | String[] styleTokens = PApplet.splitTokens(styleText, ";"); |
| 1174 | |
| 1175 | //PApplet.println(styleTokens); |
| 1176 | for (int i = 0; i < styleTokens.length; i++) { |
| 1177 | String[] tokens = PApplet.splitTokens(styleTokens[i], ":"); |
| 1178 | //PApplet.println(tokens); |
| 1179 | |
| 1180 | tokens[0] = PApplet.trim(tokens[0]); |
| 1181 | |
| 1182 | if (tokens[0].equals("fill")) { |
| 1183 | setColor(tokens[1], true); |
| 1184 |
no test coverage detected