MCPcopy Index your code
hub / github.com/benfry/processing4 / setColor

Method setColor

core/src/processing/core/PShapeSVG.java:1277–1316  ·  view source on GitHub ↗
(String colorText, boolean isFill)

Source from the content-addressed store, hash-verified

1275
1276
1277 void setColor(String colorText, boolean isFill) {
1278 colorText = colorText.trim();
1279 int opacityMask = fillColor & 0xFF000000;
1280 boolean visible = true;
1281 int color = 0;
1282 String name = "";
1283// String lColorText = colorText.toLowerCase();
1284 Gradient gradient = null;
1285// Object paint = null;
1286 if (colorText.equals("none")) {
1287 visible = false;
1288 } else if (colorText.startsWith("url(#")) {
1289 name = colorText.substring(5, colorText.length() - 1);
1290 Object object = findChild(name);
1291 if (object instanceof Gradient) {
1292 gradient = (Gradient) object;
1293 // in 3.0a11, do this on first draw inside PShapeJava2D
1294// paint = calcGradientPaint(gradient); //, opacity);
1295 } else {
1296// visible = false;
1297 System.err.println("url " + name + " refers to unexpected data: " + object);
1298 }
1299 } else {
1300 // Prints errors itself.
1301 color = opacityMask | parseSimpleColor(colorText);
1302 }
1303 if (isFill) {
1304 fill = visible;
1305 fillColor = color;
1306 fillName = name;
1307 fillGradient = gradient;
1308// fillGradientPaint = paint;
1309 } else {
1310 stroke = visible;
1311 strokeColor = color;
1312 strokeName = name;
1313 strokeGradient = gradient;
1314// strokeGradientPaint = paint;
1315 }
1316 }
1317
1318
1319 /**

Callers 7

parseColorsMethod · 0.95
GlyphMethod · 0.45
fillShapeMethod · 0.45
strokeShapeMethod · 0.45
drawShapeMethod · 0.45
textLineImplMethod · 0.45
backgroundRectMethod · 0.45

Calls 5

parseSimpleColorMethod · 0.95
findChildMethod · 0.80
trimMethod · 0.45
equalsMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected