MCPcopy Index your code
hub / github.com/processing/processing / setColor

Method setColor

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

Source from the content-addressed store, hash-verified

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

Callers 7

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

Calls 6

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

Tested by

no test coverage detected