-
-
Save duangsuse/cae6440ad946a21febfc7a8027f14309 to your computer and use it in GitHub Desktop.
日常闲置重写(+3 files),花了三个小时,感觉击键/操作效率还是要提升,可是我懒得学了……
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.geom.Path2D; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
/** | |
* Draw simple single-colored absolute SVG path without transformation using Java. | |
* | |
* @author Yuuta | |
*/ | |
public class JDrawing { | |
public static void main(String... args) throws Throwable { | |
final JFrame window = new JFrame(); | |
window.setTitle(args[0]); | |
window.add(new DrawingPanel(g -> { | |
draw(args[0], g); | |
})); | |
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
window.setVisible(true); | |
} | |
private static void draw(String file, Graphics g) { | |
final Path2D path2D = new Path2D.Double(); | |
try { | |
try(BufferedReader reader = new BufferedReader(new FileReader(file))) { | |
while(true) { | |
final String line = reader.readLine(); | |
if(line == null) break; | |
final Double[] args = line.length() > 2 ? Arrays.stream(line.substring(2).split(",")) | |
.map(Double::parseDouble) | |
.collect(Collectors.toList()) | |
.toArray(new Double[]{}) : new Double[]{}; | |
switch (line.charAt(0)) { | |
case 'M': | |
path2D.moveTo(args[0], args[1]); | |
break; | |
case 'C': | |
path2D.curveTo(args[0], args[1], | |
args[2], args[3], | |
args[4], args[5]); | |
break; | |
case 'L': | |
path2D.lineTo(args[0], args[1]); | |
break; | |
case 'H': | |
path2D.lineTo(args[0], path2D.getCurrentPoint().getY()); | |
break; | |
case 'V': | |
path2D.lineTo(path2D.getCurrentPoint().getX(), args[0]); | |
break; | |
case 'Z': | |
path2D.closePath(); | |
break; | |
default: | |
throw new UnsupportedOperationException( | |
String.format("Unsupported command %s.\n", line.charAt(0))); | |
} | |
} | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
g.setColor(Color.BLACK); | |
((Graphics2D)g).fill(path2D); | |
} | |
private static class DrawingPanel extends JPanel { | |
private final OnDrawCallback callback; | |
public DrawingPanel(OnDrawCallback callback) { | |
this.callback = callback; | |
} | |
@Override | |
public void paint(Graphics g) { | |
super.paint(g); | |
callback.onDraw(g); | |
} | |
@FunctionalInterface | |
public interface OnDrawCallback { | |
void onDraw(Graphics g); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.geom.Path2D; // SVG rendering | |
import java.io.*; // FileReader, IOExcept, BufferedReader | |
import javax.swing.*; // JFrame, JPanel | |
import static java.util.Arrays.stream; | |
import static java.util.stream.Collectors.toList; | |
class JDrawing1 { | |
public static void main(String... args) throws IOException { | |
for (String fp : args) | |
try (BufferedReader ins = new BufferedReader(new FileReader(new File(fp)))) { | |
svgPathUI(fp, drawPath(ins)).setVisible(true);; | |
} | |
} | |
static JFrame svgPathUI(String title, Path2D path) { | |
JFrame win = new JFrame(); | |
win.setTitle(title); | |
win.setSize(fullSize(path.getBounds())); | |
win.add(new DrawPanel((g) -> { g.setColor(Color.BLACK); ((Graphics2D)g).fill(path); })); | |
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
return win; | |
} | |
static Dimension fullSize(Rectangle ra) { return new Dimension(ra.x+ra.width, ra.y+ra.height); } | |
static Path2D drawPath(BufferedReader ins) throws IOException { | |
Path2D path = new Path2D.Double(); | |
String sOperate = null; // no better Iterable for(:) wrapper, since hasNext() require a 1-item buffer | |
while ((sOperate = ins.readLine()) != null) { | |
char cmd = sOperate.charAt(0); | |
int iA = 1+1/*' '*/; | |
Double[] args = (sOperate.length()>iA)? stream(sOperate.substring(iA).split(",")).map(Double::parseDouble) | |
.collect(toList()).toArray(new Double[]{}) : new Double[]{}; | |
executeSVGCmd(path, cmd, args); | |
} | |
return path; | |
} | |
/** Handle MLZ,HV,C cmds */ | |
static void executeSVGCmd(Path2D p, char cmd, Double[] a) { | |
switch (cmd) { | |
case 'M': p.moveTo(a[0], a[1]); break; | |
case 'L': p.lineTo(a[0], a[1]); break; | |
case 'Z': p.closePath(); break; | |
case 'H': p.lineTo(a[0], p.getCurrentPoint().getY()); break; | |
case 'V': p.lineTo(p.getCurrentPoint().getX(), a[0]); break; | |
case 'C': p.curveTo(a[0], a[1], a[2], a[3], a[4], a[5]); break; | |
default: throw new UnsupportedOperationException("unknown svg op: "+cmd); | |
} | |
} | |
/** Exposing [paint] as [onPaint] */ | |
static class DrawPanel extends JPanel { | |
@FunctionalInterface interface PaintHandler { void onPaint(Graphics g); } | |
PaintHandler paintHandler; | |
public DrawPanel(PaintHandler paintHandler) { this.paintHandler = paintHandler; } | |
@Override public void paint(Graphics g) { super.paint(g); paintHandler.onPaint(g); } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.* | |
import java.awt.geom.Path2D | |
import java.awt.Color.* | |
import java.io.* // FileReader, BufferedReader | |
import javax.swing.* // JFrame, Timer | |
import java.util.stream.Stream | |
import java.util.stream.Collectors.toList | |
// 加了个有内味的闪光特效…… 主要是没法给 g 仅一次设置 color。见 http://www.fredosaurus.com/notes-java/other/10time/20timer.html | |
object JDrawing1_KtVer { | |
@JvmStatic fun main(vararg args: String) = args.forEach { fp -> | |
val ui = svgPathUI(fp, loadPath(BufferedReader(FileReader(fp)).lines()) ) | |
ui.setVisible(true) | |
Timer(300) { (ui.contentPane as JPanel).updateUI() }.apply { setRepeats(true) }.start() | |
} | |
fun svgPathUI(title: String, path: Path2D): JFrame { | |
val win = JFrame().apply { | |
setTitle(title); defaultCloseOperation = JFrame.EXIT_ON_CLOSE | |
setSize(path.bounds.run { Dimension(x+width, y+height) }) | |
} | |
win.contentPane = object: JPanel() { | |
override fun paint(g: Graphics) { super.paint(g); g.color = nextColor(); (g as Graphics2D).fill(path) } | |
var i = 0 | |
fun nextColor() = colors[i].also { i = (i+1) % colors.size } | |
} | |
return win | |
} | |
val colors = listOf(black, gray, lightGray, red, pink, orange, yellow, green, magenta, cyan, blue) | |
fun loadPath(lines: Stream<String>, len_cmd: Int = 2): Path2D { // 也可用 Scanner 实现的 | |
val path = Path2D.Double() | |
lines.forEach { sOperate -> | |
val cmd = sOperate[0] | |
val args: List<Double> = sOperate.run { if (length>len_cmd) substring(len_cmd).split(",").map(String::toDouble) else emptyList() } | |
executeSVGCmd(path, cmd, args.iterator()::next) | |
} | |
return path | |
} | |
fun executeSVGCmd(p: Path2D, cmd: Char, a: () -> Double) = when (cmd) { | |
'M' -> p.moveTo(a(), a()) | |
'L' -> p.lineTo(a(), a()) | |
'Z' -> p.closePath() | |
'H' -> p.lineTo(a(), p.getCurrentPoint().getY()) | |
'V' -> p.lineTo(p.getCurrentPoint().getX(), a()) | |
'C' -> p.curveTo(a(), a(), a(), a(), a(), a()) | |
else -> throw UnsupportedOperationException("unknown cmd $cmd") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.geom.Path2D; // SVG rendering | |
import java.io.*; // FileReader, IOExcept, BufferedReader | |
import javax.swing.*; // JFrame, JPanel | |
class JDrawing1_StreamVer { | |
public static void main(String... args) throws IOException { | |
for (String fp : args) | |
try (Reader ins = new BufferedReader(new FileReader(new File(fp)))) { | |
JDrawing1.svgPathUI(fp, drawPath(ins)).setVisible(true); | |
} | |
} | |
/** Handle MLZ,HV,C cmds */ | |
static Path2D drawPath(Reader ins) throws IOException { | |
Path2D path = new Path2D.Double(); | |
// op {\n op {(,|' ')a} }? | |
int lastCP; // 想叫 peek 后来觉得语义不太对 | |
String state = "init"; | |
DoubleProducer readD = () -> { | |
double v = 0.0, vr = 0.0; // 数位[左/右]移到这里面去 | |
int c = 0; do { c = justRead(ins); } while (c == ' '||c == ','); | |
boolean isExponent = false; | |
while (c > '0'&&c < '9'||c == '.') if (c=='.') isExponent = true; // 没检查 1..0 | |
else if (!isExponent) { | |
v = v*TEN + (double)(c-'0'); | |
} else { // 记得之前在一个流解析组合子上看过读 1.0E1 (==1*10) 这种的方法,不过这里没用 | |
vr = vr/TEN + (double)(c-'0'); | |
} | |
return v+vr; | |
}; | |
while ((lastCP = ins.read()) != -1) switch (state) { // 意思意思而已,没打算真运行 | |
case "init": | |
executeSVGCmd(path, lastCP, readD); | |
state = "loop"; | |
break; | |
case "loop": | |
notM1(dropTill('\n', ins)); // 注意这把 \n 本身也耗掉了 | |
lastCP = ins.read(); | |
executeSVGCmd(path, lastCP, readD); | |
break; | |
} | |
return path; | |
} | |
static private int justRead(Reader ins) { | |
try { return ins.read(); } | |
catch (IOException ex) { return -1; } // 现在 (Java SE 8 之后的发行版中可能不支持使用 '_' 作为标识符) 什么鬼…… | |
} | |
static private final double TEN = 10.0; | |
static private int dropTill(int cp, Reader ins) throws IOException { | |
int c = 0; | |
while (c != cp && c != -1) { c = ins.read(); } | |
return c; // -1 when EOF | |
} | |
static private int notM1(int cp) throws EOFException { if (cp == -1) throw new EOFException("unexpected end"); else return cp; } | |
@FunctionalInterface interface DoubleProducer { double get(); } | |
// 不知道 java.util.function 发什么呆,有 Consumer 没 Producer !是怕性能不好么? | |
// 懒得为 ins 变量可用、作用域受限 而创建 class 了,也不想引入局部 Path2D p; 或不加简写,就做成函数值参数。 | |
static void executeSVGCmd(Path2D p, int cmd, DoubleProducer a) { | |
switch (cmd) { | |
case 'M': p.moveTo(g(a), g(a)); break; | |
case 'L': p.lineTo(g(a), g(a)); break; | |
case 'Z': p.closePath(); break; | |
case 'H': p.lineTo(g(a), g(p).getY()); break; | |
case 'V': p.lineTo(g(p).getX(), g(a)); break; | |
case 'C': p.curveTo(g(a), g(a), g(a), g(a), g(a), g(a)); break; | |
default: throw new UnsupportedOperationException("unknown svg op: "+cmd); | |
} | |
} | |
static private double g(DoubleProducer a) { return a.get(); } // 你动苏傻了,是因为 Jawa 不支持局部函数,别学我 | |
static private java.awt.geom.Point2D g(Path2D p) { return p.getCurrentPoint(); } //^... 还有 operator fun | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M 730.6,5.2 | |
C 725.9,16,724.7,22.7,724.7,37.5 | |
C 724.8000000000001,57.6,728.6,73,738.2,91.7 | |
C 741.6,98.4,742.5,101.10000000000001,741.7,101.8 | |
C 739.4000000000001,103.5,732.4000000000001,106.7,727,108.5 | |
C 712.2,113.4,682.9,130.2,670,141.3 | |
C 646.8,161.20000000000002,631.4,178.10000000000002,622.8,193.60000000000002 | |
C 621.1999999999999,196.3,618.1999999999999,201.00000000000003,616.0999999999999,204.00000000000003 | |
C 610.5999999999999,211.60000000000002,604.3,231.70000000000002,601.4999999999999,250.50000000000003 | |
C 600.0999999999999,259.90000000000003,594.5999999999999,276.8,590.2999999999998,285.3 | |
C 588.9999999999999,288.1,585.9999999999999,292.6,583.7999999999998,295.40000000000003 | |
C 580.5999999999998,299.40000000000003,580.0999999999998,300.6,581.3999999999999,300.8 | |
C 583.6999999999998,301.3,589.3999999999999,297.5,593.4999999999999,292.8 | |
C 597.6999999999999,287.8,598.5999999999999,289,597.1999999999999,298.1 | |
C 596.4,303.6,596.4999999999999,304.3,598.0999999999999,304.70000000000005 | |
C 601.3,305.6,601.8999999999999,310.00000000000006,600.8,324.6 | |
C 599.6999999999999,339.70000000000005,600.1999999999999,345.90000000000003,602.4,344 | |
C 603.1999999999999,343.4,604.3,340.8,605,338.2 | |
L 606.2,333.5 | |
L 608,335.8 | |
C 609.1,337.1,610.2,339.8,610.5,341.8 | |
C 611.3,346.1,613.7,353,615.2,354.7 | |
C 617.3000000000001,357.3,618,355.8,617.4000000000001,349.7 | |
L 616.9000000000001,343.5 | |
L 618.9000000000001,347.5 | |
C 620.0000000000001,349.7,620.9000000000001,352.5,621.0000000000001,353.8 | |
C 621.0000000000001,355.2,622.7000000000002,357.6,625.3000000000001,360 | |
C 630.2,364.6,630.6,364.7,631.5000000000001,361.9 | |
C 632.1000000000001,360.09999999999997,632.4000000000001,360.29999999999995,634.8000000000001,363.9 | |
C 636.9000000000001,367.2,637.8000000000001,367.79999999999995,639.7,367.4 | |
C 642.5,366.7,644.5,368.2,646.8000000000001,372.59999999999997 | |
C 648.4000000000001,375.59999999999997,657.5000000000001,383.99999999999994,659.2,383.99999999999994 | |
C 660.3000000000001,383.99999999999994,660.2,378.59999999999997,659.2,377.49999999999994 | |
C 658.1,376.19999999999993,652.8000000000001,359.8999999999999,653.3000000000001,359.3999999999999 | |
C 654.0000000000001,358.5999999999999,656.6,362.49999999999994,658.4000000000001,366.99999999999994 | |
C 659.4000000000001,369.49999999999994,660.9000000000001,373.29999999999995,661.8000000000001,375.49999999999994 | |
C 662.7,377.69999999999993,664.2,380.49999999999994,665.1,381.79999999999995 | |
C 666.8000000000001,383.99999999999994,666.9,383.99999999999994,667.5,381.99999999999994 | |
C 667.8,380.8999999999999,667.9,379.19999999999993,667.6,378.19999999999993 | |
C 667.3000000000001,377.29999999999995,667.4,375.8999999999999,667.9,375.19999999999993 | |
C 668.5,374.19999999999993,669,374.29999999999995,670.1,375.5999999999999 | |
C 671.1,376.7999999999999,671.5,379.9999999999999,671.4,386.3999999999999 | |
C 671.4,397.8999999999999,668.9,403.5999999999999,659.1,414.8999999999999 | |
C 653.9,420.99999999999994,652.3000000000001,423.49999999999994,652.7,425.0999999999999 | |
C 653.7,428.69999999999993,659.4000000000001,433.4999999999999,667.2,437.3999999999999 | |
C 675.6,441.49999999999994,677.3000000000001,443.8999999999999,678.9000000000001,453.49999999999994 | |
C 680.2,460.8999999999999,684.3000000000001,465.29999999999995,690.8000000000001,466.3999999999999 | |
C 693.1,466.69999999999993,695.0000000000001,467.3999999999999,695.1,467.7999999999999 | |
C 695.2,468.1999999999999,695.3000000000001,470.2999999999999,695.4,472.3999999999999 | |
C 695.6,475.3999999999999,696.4,476.8999999999999,698.6,478.69999999999993 | |
C 705.5,484.29999999999995,708.1,487.49999999999994,713.5,497.0999999999999 | |
L 719.3,507.2999999999999 | |
L 718.5999999999999,520.6999999999999 | |
C 718.1999999999999,527.9999999999999,717.3,536.0999999999999,716.4999999999999,538.5999999999999 | |
L 715.1999999999999,543.0999999999999 | |
L 719.9999999999999,545.1999999999999 | |
C 724.3999999999999,547.0999999999999,724.8999999999999,547.5999999999999,725.3999999999999,551.4999999999999 | |
C 726.0999999999999,555.6999999999999,724.9999999999999,560.2999999999998,723.0999999999999,561.4999999999999 | |
C 720.9999999999999,562.6999999999999,721.8999999999999,566.9999999999999,724.3999999999999,567.9999999999999 | |
C 727.8999999999999,569.2999999999998,729.9999999999999,572.8999999999999,729.9999999999999,577.6999999999999 | |
C 729.9999999999999,579.9999999999999,730.4999999999999,584.0999999999999,730.9999999999999,586.6999999999999 | |
C 731.5999999999999,589.3,732.3999999999999,594.4,732.8999999999999,597.9999999999999 | |
C 733.3999999999999,601.5999999999999,734.6999999999998,608.6999999999999,735.8999999999999,613.8999999999999 | |
C 738.6999999999998,626.4999999999999,738.5999999999999,629.2999999999998,734.6999999999998,639.0999999999999 | |
C 732.7999999999998,643.6999999999999,729.1999999999998,654.1999999999999,726.5999999999998,662.4999999999999 | |
C 721.1999999999998,679.6999999999999,717.2999999999998,688.7999999999998,714.7999999999998,690.0999999999999 | |
C 712.7999999999998,691.1999999999999,710.6999999999998,690.4999999999999,705.2999999999998,686.8 | |
C 699.4999999999999,682.9,688.9999999999999,678,686.2999999999998,678 | |
C 685.0999999999998,678,683.7999999999998,677.5,683.4999999999999,677 | |
C 682.4999999999999,675.4,671.2999999999998,675.8,667.6999999999999,677.6 | |
C 662.9999999999999,680,659.1999999999999,683.9,657.9999999999999,687.5 | |
C 656.9999999999999,690.6,657.3999999999999,698.9,659.5999999999999,722 | |
C 660.1999999999999,727.9,659.8999999999999,729.3,657.4999999999999,734.5 | |
C 653.5999999999999,742.8,651.1999999999999,746,649.3999999999999,745.3 | |
C 648.5999999999999,745,646.0999999999999,741.5999999999999,643.8999999999999,737.5999999999999 | |
C 641.5999999999999,733.6999999999999,638.4999999999999,728.5999999999999,636.8999999999999,726.3 | |
C 635.2999999999998,724,633.9999999999999,721.5999999999999,633.9999999999999,720.9 | |
C 633.9999999999999,720.1999999999999,631.9999999999999,716.5,629.5999999999999,712.6 | |
C 627.1999999999999,708.7,623.9999999999999,703.1,622.4999999999999,700.1 | |
C 615.0999999999999,685.4,604.4999999999999,673.3000000000001,594.9999999999999,668.8000000000001 | |
C 591.3999999999999,667.2,587.3999999999999,665.2,585.9999999999999,664.5000000000001 | |
C 584.5999999999999,663.8000000000001,580.7999999999998,658.9000000000001,577.4999999999999,653.7000000000002 | |
C 574.1999999999999,648.5000000000001,569.2999999999998,641.8000000000002,566.6999999999999,638.9000000000002 | |
C 562.5999999999999,634.5000000000002,561.9999999999999,633.2000000000002,562.5999999999999,631.1000000000003 | |
C 563.8999999999999,626.3000000000003,564.1999999999999,592.8000000000003,562.9999999999999,585.5000000000002 | |
C 560.7999999999998,572.4000000000002,557.8999999999999,561.7000000000003,554.7999999999998,555.6000000000003 | |
C 550.6999999999998,547.6000000000003,544.0999999999998,539.1000000000003,539.2999999999998,535.7000000000003 | |
C 529.6999999999998,529.1000000000003,515.0999999999998,526.8000000000003,498.59999999999985,529.5000000000002 | |
C 493.29999999999984,530.3000000000002,487.1999999999999,531.0000000000002,484.99999999999983,531.0000000000002 | |
C 482.6999999999998,531.0000000000002,478.79999999999984,531.5000000000002,476.29999999999984,532.2000000000003 | |
C 470.29999999999984,533.7000000000003,469.39999999999986,532.5000000000002,468.49999999999983,521.7000000000003 | |
C 468.1999999999998,517.2000000000003,467.59999999999985,512.7000000000003,467.3999999999998,511.7000000000003 | |
C 466.5999999999998,509.2000000000003,463.2999999999998,509.60000000000025,461.2999999999998,512.6000000000003 | |
C 459.7999999999998,515.0000000000002,459.69999999999976,516.2000000000003,460.7999999999998,524.8000000000003 | |
C 462.19999999999976,535.6000000000003,461.4999999999998,537.3000000000003,455.5999999999998,538.6000000000003 | |
C 449.1999999999998,539.9000000000002,426.6999999999998,548.0000000000002,422.4999999999998,550.4000000000002 | |
C 420.0999999999998,551.8000000000002,416.69999999999976,554.2000000000002,414.89999999999975,555.7000000000002 | |
C 413.09999999999974,557.3000000000002,409.59999999999974,559.6000000000001,407.09999999999974,561.0000000000001 | |
C 401.39999999999975,564.2000000000002,399.09999999999974,568.6000000000001,394.59999999999974,585.6000000000001 | |
C 392.7999999999997,592.7000000000002,390.4999999999997,601.1000000000001,389.59999999999974,604.3000000000002 | |
C 387.2999999999997,612.5000000000002,387.59999999999974,615.4000000000002,391.4999999999997,627.6000000000001 | |
C 393.4999999999997,633.8000000000002,394.9999999999997,640.4000000000001,394.9999999999997,643.2000000000002 | |
C 394.9999999999997,649.6000000000001,400.4999999999997,670.2000000000002,403.7999999999997,676.3000000000002 | |
C 405.1999999999997,679.0000000000002,408.39999999999975,683.5000000000002,410.89999999999975,686.4000000000002 | |
C 413.4999999999998,689.3000000000002,418.19999999999976,695.0000000000002,421.4999999999998,699.0000000000002 | |
C 436.39999999999975,717.4000000000002,443.69999999999976,721.6000000000003,474.9999999999998,729.9000000000002 | |
C 482.39999999999975,731.8000000000002,485.5999999999998,733.1000000000003,485.7999999999998,734.3000000000002 | |
C 485.9999999999998,735.2000000000002,483.4999999999998,741.4000000000002,480.19999999999976,748.2000000000002 | |
C 470.4999999999998,768.4000000000002,470.19999999999976,769.1000000000001,466.89999999999975,779.5000000000001 | |
C 457.2999999999997,810.4000000000001,453.9999999999998,830.1000000000001,452.4999999999998,866.0000000000001 | |
C 451.89999999999975,880.1000000000001,451.2999999999998,883.8000000000001,448.89999999999975,891.5000000000001 | |
C 443.59999999999974,908.5000000000001,439.09999999999974,926.3000000000001,438.9999999999998,930.2000000000002 | |
V 933.0000000000001 | |
H 571.8999999999997 | |
H 704.7999999999997 | |
L 705.2999999999997,927.7000000000002 | |
C 705.6999999999997,924.9000000000002,706.3999999999997,920.0000000000001,706.9999999999998,917.0000000000001 | |
C 708.3999999999997,910.1000000000001,709.7999999999997,900.9000000000001,710.8999999999997,890.5000000000001 | |
C 711.8999999999997,881.8000000000001,712.6999999999997,879.0000000000001,714.0999999999998,879.0000000000001 | |
C 715.5999999999998,879.0000000000001,716.6999999999998,882.9000000000001,718.4999999999998,894.5000000000001 | |
C 719.3999999999997,900.5000000000001,721.1999999999998,909.9000000000001,722.5999999999998,915.2000000000002 | |
C 723.8999999999997,920.5000000000001,724.9999999999998,926.7000000000002,724.9999999999998,928.9000000000002 | |
V 933.0000000000002 | |
H 894.0999999999998 | |
H 1063.1999999999998 | |
L 1062.4999999999998,926.2000000000003 | |
C 1061.3999999999999,916.0000000000002,1061.6999999999998,887.0000000000002,1062.9999999999998,885.5000000000002 | |
C 1064.3999999999999,883.8000000000002,1067.8999999999999,882.6000000000003,1078.4999999999998,880.1000000000003 | |
C 1094.5999999999997,876.3000000000003,1097.9999999999998,875.2000000000003,1106.5999999999997,870.5000000000002 | |
C 1121.4999999999998,862.5000000000002,1122.1999999999996,861.7000000000003,1114.9999999999998,860.5000000000002 | |
C 1112.7999999999997,860.1000000000003,1110.6999999999998,859.4000000000002,1110.3999999999999,858.8000000000002 | |
C 1110.1,858.3000000000002,1113.6999999999998,853.9000000000002,1118.3999999999999,849.1000000000001 | |
C 1123.1,844.2000000000002,1126.9999999999998,839.8000000000002,1126.9999999999998,839.2000000000002 | |
C 1126.9999999999998,837.5000000000001,1124.2999999999997,837.1000000000001,1110.9999999999998,836.8000000000002 | |
L 1098.4999999999998,836.5000000000002 | |
L 1069.6999999999998,850.8000000000002 | |
C 1053.7999999999997,858.7000000000002,1040.1,865.0000000000002,1039.1999999999998,864.8000000000002 | |
C 1037.2999999999997,864.4000000000002,1035.8999999999999,859.8000000000002,1033.3999999999999,845.0000000000002 | |
C 1032.3999999999999,839.1000000000003,1030.6,833.3000000000002,1028.8,829.6000000000003 | |
C 1026,824.1000000000003,1025.8999999999999,823.3000000000003,1027,820.0000000000002 | |
C 1028,816.9000000000002,1027.9,815.0000000000002,1026.6,808.9000000000002 | |
C 1025.6,804.9000000000002,1024.3,798.2000000000002,1023.5999999999999,794.0000000000002 | |
C 1022.8,789.8000000000002,1021.1999999999999,784.4000000000002,1019.9999999999999,782.1000000000003 | |
C 1018.3999999999999,778.9000000000002,1017.9999999999999,776.8000000000003,1018.4999999999999,774.3000000000003 | |
C 1019.0999999999999,770.9000000000003,1018.4999999999999,767.5000000000003,1012.8999999999999,745.0000000000003 | |
C 1011.3999999999999,738.7000000000004,1009.5999999999999,730.6000000000004,1008.9999999999999,727.1000000000004 | |
C 1008.3999999999999,723.6000000000004,1006.7999999999998,717.8000000000004,1005.5999999999999,714.1000000000004 | |
C 1004.3,710.5000000000003,1002.6999999999999,704.8000000000004,1001.9999999999999,701.5000000000003 | |
C 1001.3999999999999,698.2000000000004,999.8999999999999,693.5000000000003,998.8999999999999,691.1000000000004 | |
C 997.8999999999999,688.7000000000004,996.9999999999999,685.1000000000004,996.9999999999999,683.1000000000004 | |
C 996.9999999999999,681.1000000000004,996.5999999999999,678.0000000000003,995.9999999999999,676.1000000000004 | |
C 994.8999999999999,672.2000000000004,995.5999999999999,670.4000000000003,997.3999999999999,672.0000000000003 | |
C 998.0999999999999,672.5000000000003,999.9999999999999,672.7000000000004,1001.5999999999999,672.4000000000003 | |
C 1004.4999999999999,671.9000000000003,1004.6999999999999,672.1000000000004,1007.1999999999999,678.7000000000003 | |
C 1008.6999999999999,682.4000000000003,1011.3,689.4000000000003,1012.9999999999999,694.2000000000003 | |
C 1017.4999999999999,707.0000000000002,1024.6999999999998,722.5000000000002,1026.1999999999998,722.5000000000002 | |
C 1027.1,722.5000000000002,1027.7999999999997,719.4000000000002,1028.4999999999998,712.2000000000003 | |
C 1029.3999999999999,702.3000000000003,1029.5999999999997,701.7000000000003,1032.1999999999998,700.4000000000003 | |
C 1037.6,697.6000000000004,1036.9999999999998,692.3000000000003,1030.6,685.2000000000003 | |
C 1027.5,681.8000000000003,1027,680.5000000000002,1026.1,672.9000000000003 | |
C 1025.6,668.3000000000003,1024.6,656.4000000000003,1023.9999999999999,646.5000000000003 | |
C 1022.8999999999999,627.2000000000004,1022.4999999999999,623.9000000000003,1021.0999999999999,617.2000000000004 | |
C 1020.4999999999999,614.2000000000004,1020.5999999999999,611.6000000000004,1021.4999999999999,608.7000000000004 | |
C 1023.5999999999999,601.4000000000004,1026.3,602.9000000000004,1030,613.5000000000003 | |
C 1031.1,616.8000000000003,1032.4,620.2000000000004,1032.9,621.0000000000003 | |
C 1033.3000000000002,621.8000000000003,1035.8000000000002,627.4000000000003,1038.3000000000002,633.5000000000003 | |
C 1040.9,639.5000000000003,1043.9,645.8000000000003,1045.1000000000001,647.5000000000003 | |
L 1047.1000000000001,650.5000000000003 | |
L 1046.7,646.0000000000003 | |
C 1046.4,643.5000000000003,1045.6000000000001,639.0000000000003,1045,636.0000000000003 | |
C 1044,631.2000000000004,1044,630.4000000000003,1045.5,629.3000000000003 | |
C 1046.7,628.5000000000003,1047.1,627.3000000000003,1046.7,625.3000000000003 | |
C 1045.1000000000001,617.6000000000003,1040.9,595.0000000000003,1040.4,591.0000000000003 | |
C 1040.1000000000001,588.5000000000003,1038.7,581.2000000000004,1037.4,574.7000000000004 | |
C 1035,562.9000000000004,1034.3000000000002,553.0000000000003,1035.8000000000002,553.0000000000003 | |
C 1036.9,553.0000000000003,1038.6000000000001,556.5000000000003,1039.8000000000002,561.5000000000003 | |
C 1044.8000000000002,581.0000000000003,1053.3000000000002,606.0000000000003,1059.2000000000003,618.0000000000003 | |
C 1074.9000000000003,650.4000000000003,1079.5000000000002,659.0000000000003,1082.1000000000004,660.6000000000004 | |
C 1082.9000000000003,661.1000000000004,1083.1000000000004,660.6000000000004,1082.7000000000003,658.9000000000003 | |
C 1081.8000000000002,655.3000000000003,1075.4000000000003,627.9000000000003,1072.9000000000003,617.0000000000003 | |
C 1070.3000000000004,605.5000000000003,1069.3000000000004,595.0000000000003,1070.8000000000004,595.0000000000003 | |
C 1072.2000000000005,595.0000000000003,1074.9000000000003,598.8000000000003,1081.3000000000004,610.2000000000004 | |
C 1084.2000000000005,615.4000000000004,1089.9000000000003,624.0000000000003,1093.8000000000004,629.2000000000004 | |
C 1104.3000000000004,643.4000000000004,1105.2000000000005,643.4000000000004,1102.6000000000004,629.8000000000004 | |
C 1097.6000000000004,603.4000000000004,1096.0000000000005,582.3000000000004,1094.5000000000005,519.5000000000005 | |
C 1094.2000000000005,506.30000000000047,1093.5000000000005,486.70000000000044,1093.0000000000005,476.00000000000045 | |
C 1092.5000000000005,465.30000000000047,1092.0000000000005,450.20000000000044,1092.0000000000005,442.50000000000045 | |
C 1092.0000000000005,427.1000000000005,1088.8000000000004,382.20000000000044,1086.6000000000004,366.50000000000045 | |
C 1083.2000000000003,342.70000000000044,1081.8000000000004,333.80000000000047,1079.4000000000003,322.00000000000045 | |
C 1073.7000000000003,293.30000000000047,1068.3000000000004,271.70000000000044,1062.8000000000004,255.00000000000045 | |
C 1054.9000000000003,231.00000000000045,1050.8000000000004,219.70000000000044,1045.9000000000003,209.00000000000045 | |
C 1036.2000000000003,187.50000000000045,1032.3000000000004,176.80000000000047,1032.7000000000003,173.00000000000045 | |
C 1033.3000000000002,168.60000000000045,1029.7000000000003,153.40000000000046,1026.5000000000002,145.90000000000046 | |
C 1022.8000000000002,137.40000000000046,1011.6000000000003,117.60000000000046,1008.1000000000003,113.10000000000046 | |
C 1006.3000000000003,110.90000000000046,1003.3000000000003,106.70000000000046,1001.3000000000003,103.80000000000047 | |
C 996.4000000000003,96.60000000000046,977.5000000000003,77.90000000000046,972.5000000000003,75.30000000000047 | |
C 970.3000000000003,74.20000000000047,966.9000000000003,72.40000000000046,964.9000000000003,71.20000000000047 | |
C 954.6000000000004,65.40000000000047,925.3000000000003,62.30000000000047,912.2000000000003,65.50000000000047 | |
C 908.5000000000002,66.40000000000047,903.3000000000003,68.10000000000046,900.6000000000003,69.30000000000047 | |
C 895.9000000000002,71.30000000000047,895.7000000000003,71.30000000000047,892.1000000000003,69.50000000000047 | |
C 890.1000000000003,68.40000000000047,877.3000000000003,56.40000000000047,863.6000000000003,42.70000000000047 | |
C 849.9,29.1,835,15.2,830.6,11.9 | |
C 826.1,8.6,820.8,4.6,818.8,3 | |
L 815.1,0 | |
H 774 | |
H 732.9 | |
Z | |
M 795.3000000000001,526.7 | |
C 797.8000000000001,532,798.1,536,796.1,536 | |
C 795.8000000000001,536,793.2,537.8,790.4,539.9 | |
C 783.6999999999999,544.9,782.1,544.1999999999999,783.8,537 | |
C 784.5,534.2,785,526.8,785,520.6 | |
C 785,514.4,785.3,509,785.7,508.6 | |
C 786.3000000000001,508,788,511.20000000000005,795.3000000000001,526.7 | |
Z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
原推文 https://twitter.com/NeoTrumeet/status/1351661745455071232?s=19
Kotlin 的一些
o.getXXX()
可以简化o.xxx
但另一些不能这个重写也可能有能再化简(功能的等价调用方式上或复用上),相信 Kotlin 版可缩至 40L 内
整体来看也还算可以的,不可能处理大量 text 所以 stream 化也没必要,Java Scanner 的性能我觉得不可信
之前不知道 SVG Path 可以这么玩,也不知道
subSequence
(返回仅可charAt
系) 和substring
有什么区别,现在明白了。