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