MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / renderToLine

Method renderToLine

src/main/java/field/graphics/FLine.java:1053–1097  ·  view source on GitHub ↗
(MeshBuilder m, Curry.Function3<MeshAcceptor, Node, MoveTo, Node> moveTo, Curry.Function3<MeshAcceptor, Node, LineTo, Node> lineTo, Curry.Function3<MeshAcceptor,
            Node, CubicTo, Node> cubicTo)

Source from the content-addressed store, hash-verified

1051
1052 Log.log("drawing.trace", () -> "should skip ? " + mod);
1053
1054 return m.skipTo(c.start, c.end, mod, () -> {
1055
1056 flattenAuxProperties();
1057 m.open();
1058 try {
1059 MeshBuilder.Bookmark start = null;
1060 // todo: AUX!
1061
1062 Log.log("drawing.trace", () -> "ACTUALLY DRAWING");
1063
1064 Node a = null;
1065 for (int i = 0; i < nodes.size(); i++) {
1066 Node b = nodes.get(i);
1067
1068 if (b instanceof MoveTo) {
1069 if (start != null) m.line(start.at() + 1);
1070 a = moveTo.apply(m, a, (MoveTo) b);
1071 start = m.bookmark();
1072 } else {
1073 if (b instanceof LineTo) a = lineTo.apply(m, a, (LineTo) b);
1074 else if (b instanceof CubicTo) a = cubicTo.apply(m, a, (CubicTo) b);
1075 else throw new IllegalArgumentException(" unknown subclass ");
1076 if (start == null) start = m.bookmark();
1077
1078 }
1079 }
1080
1081 MeshBuilder.Bookmark end = m.bookmark();
1082
1083 if (start != null && start.at() != end.at()) {
1084 m.line(start.at() + 1);
1085 }
1086 } finally {
1087 m.close();
1088 }
1089 });
1090 }
1091
1092 @HiddenInAutocomplete
1093 public boolean renderToLine(MeshBuilder m, int fixedSizeForCubic) {
1094 Log.log("drawing.trace", () -> "renderToLine");
1095 return renderToLine(m, this::renderMoveTo, this::renderLineTo, renderCubicTo(fixedSizeForCubic));
1096 }
1097
1098 @HiddenInAutocomplete
1099 public boolean renderLineToMeshByStroking(MeshBuilder m, int fixedSizeForCubic, BasicStroke stroke) {
1100 BookmarkCache c = cache_thickening.computeIfAbsent(m, (k) -> new BookmarkCache(m));

Callers 1

dispatchLineMethod · 0.80

Calls 13

logMethod · 0.95
flattenAuxPropertiesMethod · 0.95
renderCubicToMethod · 0.95
computeIfAbsentMethod · 0.80
bookmarkMethod · 0.80
openMethod · 0.65
getMethod · 0.65
applyMethod · 0.65
closeMethod · 0.65
skipToMethod · 0.45
sizeMethod · 0.45
lineMethod · 0.45

Tested by

no test coverage detected