ranger-compiler 2.1.69 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/README.md +991 -96
- package/{compiler/Lang.clj → dist/Lang.rgr} +2345 -75
- package/dist/README.md +116 -0
- package/dist/{bin/api.d.ts → api.d.ts} +430 -154
- package/dist/api.js +34345 -0
- package/{lib/Ajax.clj → dist/lib/Ajax.rgr} +1 -1
- package/{lib/CmdParams.clj → dist/lib/CmdParams.rgr} +72 -72
- package/{lib/Crypto.clj → dist/lib/Crypto.rgr} +1 -1
- package/{lib/DOMLib.clj → dist/lib/DOMLib.rgr} +2 -2
- package/{lib/Engine3D.clj → dist/lib/Engine3D.rgr} +1 -1
- package/{lib/ImmutableVector.clj → dist/lib/ImmutableVector.rgr} +364 -364
- package/{lib/IndexedDB.clj → dist/lib/IndexedDB.rgr} +1 -1
- package/{lib/JSON.clj → dist/lib/JSON.rgr} +105 -2
- package/{lib/JinxProcess.clj → dist/lib/JinxProcess.rgr} +3 -3
- package/{lib/Storage.clj → dist/lib/Storage.rgr} +1 -1
- package/{lib/Timers.clj → dist/lib/Timers.rgr} +176 -170
- package/{lib/ViewLib.clj → dist/lib/ViewLib.rgr} +1 -1
- package/dist/lib/lib/ACEEditor.rgr +5 -0
- package/dist/lib/lib/Ajax.rgr +196 -0
- package/dist/lib/lib/CmdParams.rgr +72 -0
- package/dist/lib/lib/Crypto.rgr +90 -0
- package/dist/lib/lib/DOMLib.rgr +307 -0
- package/{examples/3D/Engine3D.clj → dist/lib/lib/Engine3D.rgr} +870 -857
- package/dist/lib/lib/ImmutableVector.rgr +364 -0
- package/dist/lib/lib/IndexedDB.rgr +32 -0
- package/{compiler/JSON.clj → dist/lib/lib/JSON.rgr} +106 -3
- package/dist/lib/lib/JinxProcess.rgr +838 -0
- package/dist/lib/lib/SQL.rgr +44 -0
- package/dist/lib/lib/ServiceLib.rgr +9 -0
- package/dist/lib/lib/Storage.rgr +89 -0
- package/dist/lib/lib/Time.rgr +75 -0
- package/dist/lib/lib/Timers.rgr +176 -0
- package/dist/lib/lib/TypedArrays.rgr +14 -0
- package/dist/lib/lib/ViewLib.rgr +851 -0
- package/dist/lib/lib/WebLib.rgr +47 -0
- package/dist/lib/lib/WebServerLib.rgr +137 -0
- package/{lib/ranger-dir.clj → dist/lib/lib/ranger-dir.rgr} +1 -1
- package/{compiler/stdlib.clj → dist/lib/lib/stdlib.rgr} +42 -19
- package/{lib/stdops.clj → dist/lib/lib/stdops.rgr} +1 -1
- package/dist/lib/ranger-dir.rgr +175 -0
- package/{lib/stdlib.clj → dist/lib/stdlib.rgr} +2 -2
- package/dist/lib/stdops.rgr +168 -0
- package/dist/package.json +47 -0
- package/{bin/output.js → dist/rgrc.js} +15377 -7935
- package/dist/stdops.rgr +168 -0
- package/package.json +196 -38
- package/adventofcode/day1/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day1/bin/day1.cpp +0 -124
- package/adventofcode/day1/bin/day1.go +0 -75
- package/adventofcode/day1/bin/day1.js +0 -45
- package/adventofcode/day1/bin/day1.php +0 -46
- package/adventofcode/day1/bin/day1.scala +0 -48
- package/adventofcode/day1/bin/day1.swift +0 -48
- package/adventofcode/day1/bin/day1_part2.cpp +0 -180
- package/adventofcode/day1/bin/day1_part2.go +0 -123
- package/adventofcode/day1/bin/day1_part2.js +0 -76
- package/adventofcode/day1/bin/day1_part2.php +0 -88
- package/adventofcode/day1/bin/day1_part2.scala +0 -81
- package/adventofcode/day1/bin/day1_part2.swift +0 -91
- package/adventofcode/day1/bin/day_one.java +0 -38
- package/adventofcode/day1/bin/day_one_part_two.java +0 -57
- package/adventofcode/day1/bin/operatorsOf.java +0 -37
- package/adventofcode/day1/bin/operatorsOf_5.java +0 -10
- package/adventofcode/day1/bin/operatorsOfboolean_5.java +0 -10
- package/adventofcode/day1/bin/variant.hpp +0 -2416
- package/adventofcode/day1/compile.bat +0 -7
- package/adventofcode/day1/compile2.bat +0 -7
- package/adventofcode/day1/day1.clj +0 -19
- package/adventofcode/day1/day1_part2.clj +0 -43
- package/adventofcode/day1/input1.txt +0 -1
- package/adventofcode/day2/bin/LambdaSignature1.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day2/bin/LambdaSignature2.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day2/bin/day2.cpp +0 -133
- package/adventofcode/day2/bin/day2.go +0 -85
- package/adventofcode/day2/bin/day2.js +0 -45
- package/adventofcode/day2/bin/day2.php +0 -59
- package/adventofcode/day2/bin/day2.scala +0 -54
- package/adventofcode/day2/bin/day2.swift +0 -62
- package/adventofcode/day2/bin/day2_part2.cpp +0 -150
- package/adventofcode/day2/bin/day2_part2.go +0 -101
- package/adventofcode/day2/bin/day2_part2.js +0 -54
- package/adventofcode/day2/bin/day2_part2.php +0 -80
- package/adventofcode/day2/bin/day2_part2.scala +0 -68
- package/adventofcode/day2/bin/day2_part2.swift +0 -82
- package/adventofcode/day2/bin/day_two.java +0 -61
- package/adventofcode/day2/bin/day_two_part_two$1$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.java +0 -80
- package/adventofcode/day2/bin/operatorsOf.class +0 -0
- package/adventofcode/day2/bin/operatorsOf.java +0 -18
- package/adventofcode/day2/bin/variant.hpp +0 -2416
- package/adventofcode/day2/compile.bat +0 -7
- package/adventofcode/day2/compile2.bat +0 -7
- package/adventofcode/day2/day2.clj +0 -60
- package/adventofcode/day2/day2_part2.clj +0 -69
- package/adventofcode/day2/input1.txt +0 -1
- package/adventofcode/day3/bin/Grid.java +0 -92
- package/adventofcode/day3/bin/GridRow.java +0 -5
- package/adventofcode/day3/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day3/bin/day3.cpp +0 -64
- package/adventofcode/day3/bin/day3.go +0 -55
- package/adventofcode/day3/bin/day3.js +0 -42
- package/adventofcode/day3/bin/day3.php +0 -41
- package/adventofcode/day3/bin/day3.scala +0 -52
- package/adventofcode/day3/bin/day3.swift +0 -43
- package/adventofcode/day3/bin/day3_part2.cpp +0 -216
- package/adventofcode/day3/bin/day3_part2.go +0 -188
- package/adventofcode/day3/bin/day3_part2.js +0 -123
- package/adventofcode/day3/bin/day3_part2.php +0 -135
- package/adventofcode/day3/bin/day3_part2.swift +0 -131
- package/adventofcode/day3/bin/day_three_part_two.java +0 -43
- package/adventofcode/day3/bin/day_two.java +0 -42
- package/adventofcode/day3/bin/operatorsOf.java +0 -14
- package/adventofcode/day3/bin/variant.hpp +0 -2416
- package/adventofcode/day3/compile.bat +0 -7
- package/adventofcode/day3/compile2.bat +0 -7
- package/adventofcode/day3/day3.clj +0 -42
- package/adventofcode/day3/day3_part2.clj +0 -112
- package/adventofcode/day4/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day4/bin/day4.cpp +0 -118
- package/adventofcode/day4/bin/day4.go +0 -75
- package/adventofcode/day4/bin/day4.js +0 -40
- package/adventofcode/day4/bin/day4.php +0 -52
- package/adventofcode/day4/bin/day4.scala +0 -47
- package/adventofcode/day4/bin/day4.swift +0 -56
- package/adventofcode/day4/bin/day4_part2.go +0 -129
- package/adventofcode/day4/bin/day4_part2.js +0 -72
- package/adventofcode/day4/bin/day_four.java +0 -41
- package/adventofcode/day4/bin/inputData.java +0 -7
- package/adventofcode/day4/bin/operatorsOf.java +0 -11
- package/adventofcode/day4/bin/variant.hpp +0 -2416
- package/adventofcode/day4/compile.bat +0 -7
- package/adventofcode/day4/compile2.bat +0 -7
- package/adventofcode/day4/day4.clj +0 -32
- package/adventofcode/day4/day4_part2.clj +0 -44
- package/adventofcode/day4/input.clj +0 -519
- package/adventofcode/day4/input.txt +0 -512
- package/bin/api.ts +0 -24471
- package/bin/compiler.ts +0 -24482
- package/compiler/ColorConsole.clj +0 -22
- package/compiler/ContextOperators.clj +0 -75
- package/compiler/FlowEnterVarDef.clj +0 -223
- package/compiler/InputFileSystem.clj +0 -276
- package/compiler/RangerDocs.clj +0 -7
- package/compiler/TFactory.clj +0 -146
- package/compiler/TFiles.clj +0 -23
- package/compiler/TFlow.clj +0 -39
- package/compiler/TNodeFactory.clj +0 -84
- package/compiler/TTypes.clj +0 -188
- package/compiler/VirtualCompiler.clj +0 -800
- package/compiler/bin/ng_Compiler.js +0 -23779
- package/compiler/commonmark_plugin.clj +0 -359
- package/compiler/feat2.bat +0 -2
- package/compiler/feats.bat +0 -9
- package/compiler/feature_tests.clj +0 -192
- package/compiler/index.js +0 -2
- package/compiler/issue_57.clj +0 -25
- package/compiler/makefile_plugin.clj +0 -135
- package/compiler/markdown_plugin.clj +0 -386
- package/compiler/maven_plugin.clj +0 -162
- package/compiler/ng_AndroidPageWriter.clj +0 -299
- package/compiler/ng_CodeNode.clj +0 -756
- package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
- package/compiler/ng_Compiler.clj +0 -49
- package/compiler/ng_CompilerGeneric.clj +0 -260
- package/compiler/ng_CompilerOrig.clj +0 -854
- package/compiler/ng_DictNode.clj +0 -346
- package/compiler/ng_DictNode2.clj +0 -316
- package/compiler/ng_Execute.clj +0 -138
- package/compiler/ng_Execute1.clj +0 -129
- package/compiler/ng_FlowWork.clj +0 -3951
- package/compiler/ng_LiveCompiler.clj +0 -1109
- package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
- package/compiler/ng_RangerActiveOperators.clj +0 -86
- package/compiler/ng_RangerAppClassDesc.clj +0 -400
- package/compiler/ng_RangerAppEnums.clj +0 -86
- package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
- package/compiler/ng_RangerAppMessages.clj +0 -15
- package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
- package/compiler/ng_RangerAppParamDesc.clj +0 -388
- package/compiler/ng_RangerAppWriterContext.clj +0 -1793
- package/compiler/ng_RangerArgMatch.clj +0 -638
- package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
- package/compiler/ng_RangerCppClassWriter.clj +0 -1023
- package/compiler/ng_RangerDocGenerator.clj +0 -305
- package/compiler/ng_RangerFlowParser.clj +0 -4992
- package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
- package/compiler/ng_RangerGenericClassWriter.clj +0 -573
- package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
- package/compiler/ng_RangerImmutableExtension.clj +0 -77
- package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
- package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1042
- package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
- package/compiler/ng_RangerLanguageWriters.clj +0 -14
- package/compiler/ng_RangerLispParser.clj +0 -873
- package/compiler/ng_RangerPHPClassWriter.clj +0 -643
- package/compiler/ng_RangerPlugin.clj +0 -41
- package/compiler/ng_RangerRangerClassWriter.clj +0 -357
- package/compiler/ng_RangerRustClassWriter.clj +0 -420
- package/compiler/ng_RangerScalaClassWriter.clj +0 -818
- package/compiler/ng_RangerSerializeClass.clj +0 -502
- package/compiler/ng_RangerServiceBuilder.clj +0 -63
- package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
- package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
- package/compiler/ng_RangerTypeClass.clj +0 -45
- package/compiler/ng_SourceParser.clj +0 -241
- package/compiler/ng_SourceParser2.clj +0 -214
- package/compiler/ng_WebPageWriter.clj +0 -39
- package/compiler/ng_jsonParser.clj +0 -340
- package/compiler/ng_p_test.clj +0 -1711
- package/compiler/ng_parser.clj +0 -911
- package/compiler/ng_parser2.clj +0 -735
- package/compiler/ng_parser2_backup.clj +0 -1679
- package/compiler/ng_parser_backup.clj +0 -886
- package/compiler/ng_parser_ok.clj +0 -1718
- package/compiler/ng_parser_ok2.clj +0 -1717
- package/compiler/ng_parser_std_match.clj +0 -687
- package/compiler/ng_parser_std_match2.clj +0 -1012
- package/compiler/ng_parser_v2.clj +0 -1251
- package/compiler/ng_ui.clj +0 -403
- package/compiler/ng_ui_test.clj +0 -18
- package/compiler/ng_writer.clj +0 -338
- package/compiler/ng_xmlParser.clj +0 -472
- package/compiler/ng_xmlParser2.clj +0 -317
- package/compiler/ng_xmlParser3.clj +0 -251
- package/compiler/opdoc.bat +0 -4
- package/compiler/operators.md +0 -290
- package/compiler/p.bat +0 -4
- package/compiler/package.json +0 -10
- package/compiler/pcmd.bat +0 -4
- package/compiler/pcmd2.bat +0 -3
- package/compiler/plaintext_plugin.clj +0 -69
- package/compiler/plugin.bat +0 -19
- package/compiler/plugin2.bat +0 -4
- package/compiler/plugin_app.bat +0 -3
- package/compiler/plugin_apps.clj +0 -27
- package/compiler/plugins.bat +0 -10
- package/compiler/reveal_plugin.clj +0 -409
- package/compiler/simplePlugin.clj +0 -780
- package/compiler/t.bat +0 -3
- package/compiler/test_any.clj +0 -43
- package/compiler/test_call.clj +0 -141
- package/compiler/test_chain.clj +0 -79
- package/compiler/test_json.clj +0 -10
- package/compiler/test_lambda.clj +0 -153
- package/compiler/test_pcmd.clj +0 -32
- package/compiler/test_pcmd2.clj +0 -29
- package/compiler/test_plugin.clj +0 -237
- package/compiler/test_readfile.clj +0 -13
- package/compiler/test_reveal.clj +0 -19
- package/compiler/test_slides.clj +0 -312
- package/compiler/test_types.clj +0 -143
- package/compiler/test_types2.clj +0 -49
- package/compiler/test_types3.clj +0 -53
- package/compiler/test_var.clj +0 -40
- package/compiler/tonpm.bat +0 -14
- package/compiler/tonpm2.bat +0 -12
- package/compiler/ui_plugin.clj +0 -507
- package/compiler/ui_plugin2.clj +0 -427
- package/compiler/update-git.bat +0 -3
- package/compiler/vcomp.bat +0 -4
- package/compiler/viewbuilder_Android.clj +0 -176
- package/compiler/viewbuilder_Web.clj +0 -105
- package/dist/bin/api.js +0 -32422
- package/dist/bin/api.js.map +0 -1
- package/dist/bin/compiler.d.ts +0 -1638
- package/dist/bin/compiler.js +0 -32444
- package/dist/bin/compiler.js.map +0 -1
- package/examples/3D/bin/test_3d.js +0 -329
- package/examples/3D/test_3d.clj +0 -385
- package/examples/EVGColor/EVGColor.clj +0 -310
- package/examples/EVGColor/EVGColorContext.clj +0 -176
- package/examples/EVGColor/bin/EVGColor.js +0 -286
- package/examples/EVGColor/bin/minimized.js +0 -286
- package/examples/SVGPath/SVGPath.clj +0 -625
- package/examples/SVGPath/Vec2.clj +0 -103
- package/examples/SVGPath/bin/SVGPath.cpp +0 -887
- package/examples/SVGPath/bin/SVGPath.js +0 -682
- package/examples/SVGPath/bin/minimized.js +0 -578
- package/examples/SVGPath/bin/variant.hpp +0 -2416
- package/examples/minification/Vec2.clj +0 -103
- package/examples/minification/bin/minified.js +0 -44
- package/examples/minification/bin/test.js +0 -117
- package/examples/minification/test.clj +0 -13
- package/fiddle/VirtualCompiler.js +0 -23495
- package/fiddle/browser_editor.js +0 -13240
- package/fiddle/compileEnv.js +0 -1
- package/fiddle/compileEnv.json +0 -1
- package/fiddle/lang_data.js +0 -1
- package/index.html +0 -18
- package/native/httpd/HttpTester.clj +0 -33
- package/native/httpd/RangerWebService.clj +0 -81
- package/operators.md +0 -290
- package/tsconfig.json +0 -29
- package/versions/cpp/compiler.cpp +0 -15032
- package/versions/es6/compiler.js +0 -12860
- package/versions/go/compiler.go +0 -21338
- package/versions/java/AfterCodeNode.java +0 -4
- package/versions/java/ClassJoinPoint.java +0 -6
- package/versions/java/CodeFile.java +0 -42
- package/versions/java/CodeFileSystem.java +0 -72
- package/versions/java/CodeNode.java +0 -807
- package/versions/java/CodeSlice.java +0 -13
- package/versions/java/CodeWriter.java +0 -185
- package/versions/java/ColorConsole.java +0 -8
- package/versions/java/CompilerInterface.java +0 -213
- package/versions/java/DictNode.java +0 -353
- package/versions/java/LiveCompiler.java +0 -772
- package/versions/java/NodeEvalState.java +0 -24
- package/versions/java/OpFindResult.java +0 -6
- package/versions/java/RangerAppArrayValue.java +0 -7
- package/versions/java/RangerAppClassDesc.java +0 -217
- package/versions/java/RangerAppEnum.java +0 -14
- package/versions/java/RangerAppFunctionDesc.java +0 -20
- package/versions/java/RangerAppHashValue.java +0 -11
- package/versions/java/RangerAppInterfaceImpl.java +0 -6
- package/versions/java/RangerAppMethodVariants.java +0 -6
- package/versions/java/RangerAppParamDesc.java +0 -321
- package/versions/java/RangerAppTodo.java +0 -6
- package/versions/java/RangerAppValue.java +0 -10
- package/versions/java/RangerAppWriterContext.java +0 -800
- package/versions/java/RangerArgMatch.java +0 -317
- package/versions/java/RangerBackReference.java +0 -7
- package/versions/java/RangerCSharpClassWriter.java +0 -287
- package/versions/java/RangerCompilerMessage.java +0 -9
- package/versions/java/RangerCppClassWriter.java +0 -725
- package/versions/java/RangerFlowParser.java +0 -2142
- package/versions/java/RangerGenericClassWriter.java +0 -367
- package/versions/java/RangerGolangClassWriter.java +0 -1379
- package/versions/java/RangerJava7ClassWriter.java +0 -652
- package/versions/java/RangerJavaScriptClassWriter.java +0 -305
- package/versions/java/RangerKotlinClassWriter.java +0 -380
- package/versions/java/RangerLispParser.java +0 -845
- package/versions/java/RangerNodeValue.java +0 -9
- package/versions/java/RangerPHPClassWriter.java +0 -527
- package/versions/java/RangerParamEventHandler.java +0 -6
- package/versions/java/RangerParamEventList.java +0 -5
- package/versions/java/RangerParamEventMap.java +0 -27
- package/versions/java/RangerRangerClassWriter.java +0 -268
- package/versions/java/RangerRefForce.java +0 -7
- package/versions/java/RangerScalaClassWriter.java +0 -365
- package/versions/java/RangerSerializeClass.java +0 -148
- package/versions/java/RangerSwift3ClassWriter.java +0 -548
- package/versions/java/RangerTypeClass.java +0 -17
- package/versions/java/SourceCode.java +0 -65
- package/versions/php/compiler.php +0 -13830
- package/versions/swift3/compiler.swift +0 -12542
- /package/{lib/ACEEditor.clj → dist/lib/ACEEditor.rgr} +0 -0
- /package/{lib/SQL.clj → dist/lib/SQL.rgr} +0 -0
- /package/{lib/ServiceLib.clj → dist/lib/ServiceLib.rgr} +0 -0
- /package/{lib/Time.clj → dist/lib/Time.rgr} +0 -0
- /package/{lib/TypedArrays.clj → dist/lib/TypedArrays.rgr} +0 -0
- /package/{lib/WebLib.clj → dist/lib/WebLib.rgr} +0 -0
- /package/{lib/WebServerLib.clj → dist/lib/WebServerLib.rgr} +0 -0
|
@@ -1,625 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Import "Vec2.clj"
|
|
3
|
-
|
|
4
|
-
class PathExecutor {
|
|
5
|
-
fn Move:void( x:double y:double) {
|
|
6
|
-
print "Move called with " + x + ", " + y
|
|
7
|
-
}
|
|
8
|
-
fn Line:void( x:double y:double) {
|
|
9
|
-
print "Line called with " + x + ", " + y
|
|
10
|
-
}
|
|
11
|
-
fn Curve:void( x0:double y0:double x1:double y1:double x2:double y2:double) {
|
|
12
|
-
print "Cubic bezier curve called with " + x0 + ", " + y0 + " "+ x1 + ", " + y1 + " "+ x2 + ", " + y2 + " "
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class PathCollector {
|
|
17
|
-
Extends(PathExecutor)
|
|
18
|
-
def pathParts:[string]
|
|
19
|
-
fn Move:void( x:double y:double) {
|
|
20
|
-
push pathParts "M " + x + " " + y +" "
|
|
21
|
-
}
|
|
22
|
-
fn Line:void( x:double y:double) {
|
|
23
|
-
push pathParts "L " + x + " " + y +" "
|
|
24
|
-
}
|
|
25
|
-
fn Curve:void( x0:double y0:double x1:double y1:double x2:double y2:double) {
|
|
26
|
-
push pathParts "C " + x0 + " " + y0 +" "+ x1 + " " + y1 +" "+ x2 + " " + y2 +" "
|
|
27
|
-
}
|
|
28
|
-
fn getString:string () {
|
|
29
|
-
return (join pathParts " ")
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
class PathSegment {
|
|
34
|
-
def t0:double 0.0
|
|
35
|
-
def t1:double 0.0
|
|
36
|
-
def t2:double 0.0
|
|
37
|
-
def t3:double 0.0
|
|
38
|
-
def t4:double 0.0
|
|
39
|
-
def t5:double 0.0
|
|
40
|
-
def t6:double 0.0
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
class EVGBezierPath {
|
|
44
|
-
def points:[Vec2]
|
|
45
|
-
def next:EVGBezierPath
|
|
46
|
-
def pointCnt:int 0
|
|
47
|
-
def closed:boolean false
|
|
48
|
-
def bounds:Vec2 (Vec2.CreateNew ( 0.0 0.0 ))
|
|
49
|
-
def cp1:Vec2 (Vec2.CreateNew ( 0.0 0.0 ))
|
|
50
|
-
def cp2:Vec2 (Vec2.CreateNew ( 0.0 0.0 ))
|
|
51
|
-
def controlPoint:Vec2 (Vec2.CreateNew ( 0.0 0.0 ))
|
|
52
|
-
|
|
53
|
-
fn close:void () {
|
|
54
|
-
closed = true
|
|
55
|
-
}
|
|
56
|
-
fn Line:void (point:Vec2) {
|
|
57
|
-
}
|
|
58
|
-
fn moveTo:void (point:Vec2) {
|
|
59
|
-
controlPoint.x = point.x
|
|
60
|
-
controlPoint.y = point.y
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
class EVGPathParser {
|
|
65
|
-
|
|
66
|
-
def i:int 0
|
|
67
|
-
def len:int 0
|
|
68
|
-
def buff:charbuffer
|
|
69
|
-
def last_number:double 0.0
|
|
70
|
-
|
|
71
|
-
fn __sqr:double (v:double) {
|
|
72
|
-
return (v * v)
|
|
73
|
-
}
|
|
74
|
-
fn __xformPoint:Vec2 (point:Vec2 seg:PathSegment) {
|
|
75
|
-
def res:Vec2 (Vec2.CreateNew ( ((point.x * seg.t0) + (point.y * seg.t2) + seg.t4)
|
|
76
|
-
((point.x * seg.t1) + (point.y * seg.t3) + seg.t5) ) )
|
|
77
|
-
return res
|
|
78
|
-
}
|
|
79
|
-
fn __xformVec:Vec2 (point:Vec2 seg:PathSegment) {
|
|
80
|
-
return (Vec2.CreateNew ( ((point.x * seg.t0) + (point.y * seg.t2))
|
|
81
|
-
((point.x * seg.t1) + (point.y * seg.t3)) ) )
|
|
82
|
-
}
|
|
83
|
-
fn __vmag:double (point:Vec2) {
|
|
84
|
-
return (sqrt ((point.x * point.x) + (point.y * point.y)))
|
|
85
|
-
}
|
|
86
|
-
fn __vecrat:double (u:Vec2 v:Vec2) {
|
|
87
|
-
return (((u.x * v.x) + (u.y * v.y)) / ((this.__vmag(u)) * (this.__vmag(v))))
|
|
88
|
-
}
|
|
89
|
-
fn __vecang:double (u:Vec2 v:Vec2) {
|
|
90
|
-
def r:double (this.__vecrat(u v))
|
|
91
|
-
if (r < -1.0) {
|
|
92
|
-
r = -1.0
|
|
93
|
-
}
|
|
94
|
-
if (r > 1.0) {
|
|
95
|
-
r = 1.0
|
|
96
|
-
}
|
|
97
|
-
def res:double 1.0
|
|
98
|
-
if ((u.x * v.y) < (u.y * v.x)) {
|
|
99
|
-
res = -1.0
|
|
100
|
-
}
|
|
101
|
-
return (res * (acos r))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
fn scanNumber:boolean () {
|
|
105
|
-
def s:charbuffer (unwrap this.buff)
|
|
106
|
-
def fc:char (charAt s i)
|
|
107
|
-
def c:char fc
|
|
108
|
-
def sp:int 0
|
|
109
|
-
def ep:int 0
|
|
110
|
-
fc = (charAt s i)
|
|
111
|
-
if (((fc == 45) && (((charAt s (i + 1))) >= 46) && (((charAt s (i + 1))) <= 57)) || ((fc >= 48) && (fc <= 57))) {
|
|
112
|
-
sp = i
|
|
113
|
-
i = 1 + i
|
|
114
|
-
c = (charAt s i)
|
|
115
|
-
while ((i < len) && (((c >= 48) && (c <= 57)) || (c == ((ccode "."))) || ((i == sp) && ((c == ((ccode "+"))) || (c == ((ccode "-"))))))) {
|
|
116
|
-
i = 1 + i
|
|
117
|
-
if (i >= len) {
|
|
118
|
-
break
|
|
119
|
-
}
|
|
120
|
-
c = (charAt s i)
|
|
121
|
-
}
|
|
122
|
-
ep = i
|
|
123
|
-
last_number = (unwrap (str2double ((substring s sp ep))))
|
|
124
|
-
return true
|
|
125
|
-
}
|
|
126
|
-
return false
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
fn pathArcTo:Vec2 ( callback:PathExecutor cp:Vec2 args:PathSegment rel:boolean ) {
|
|
130
|
-
def rx 0.0
|
|
131
|
-
def ry 0.0
|
|
132
|
-
def rotx 0.0
|
|
133
|
-
def x1 0.0
|
|
134
|
-
def y1 0.0
|
|
135
|
-
def x2 0.0
|
|
136
|
-
def y2 0.0
|
|
137
|
-
def cx 0.0
|
|
138
|
-
def cy 0.0
|
|
139
|
-
def dx 0.0
|
|
140
|
-
def dy 0.0
|
|
141
|
-
def d 0.0
|
|
142
|
-
def x1p 0.0
|
|
143
|
-
def y1p 0.0
|
|
144
|
-
def cxp 0.0
|
|
145
|
-
def cyp 0.0
|
|
146
|
-
def s 0.0
|
|
147
|
-
def sa 0.0
|
|
148
|
-
def sb 0.0
|
|
149
|
-
def ux 0.0
|
|
150
|
-
def uy 0.0
|
|
151
|
-
def vx 0.0
|
|
152
|
-
def vy 0.0
|
|
153
|
-
def a1 0.0
|
|
154
|
-
def da 0.0
|
|
155
|
-
def x 0.0
|
|
156
|
-
def y 0.0
|
|
157
|
-
def tanx 0.0
|
|
158
|
-
def tany 0.0
|
|
159
|
-
def a 0.0
|
|
160
|
-
def px 0.0
|
|
161
|
-
def py 0.0
|
|
162
|
-
def ptanx 0.0
|
|
163
|
-
def ptany 0.0
|
|
164
|
-
def t (new PathSegment())
|
|
165
|
-
def sinrx 0.0
|
|
166
|
-
def cosrx 0.0
|
|
167
|
-
def fa 0.0
|
|
168
|
-
def fs 0.0
|
|
169
|
-
def i 0
|
|
170
|
-
def ndivs 0
|
|
171
|
-
def hda 0.0
|
|
172
|
-
def kappa 0.0
|
|
173
|
-
def PI_VALUE (M_PI)
|
|
174
|
-
def cpx cp.x
|
|
175
|
-
def cpy cp.y
|
|
176
|
-
rx = ( fabs args.t0)
|
|
177
|
-
ry = ( fabs args.t1)
|
|
178
|
-
rotx = args.t2 / 180.00 * PI_VALUE
|
|
179
|
-
fa = (? ( (fabs args.t3) > 0.00001 ) 1.0 0.0 )
|
|
180
|
-
fs = (? ( (fabs args.t4) > 0.00001 ) 1.0 0.0 )
|
|
181
|
-
x1 = cpx
|
|
182
|
-
y1 = cpy
|
|
183
|
-
if rel {
|
|
184
|
-
x2 = cpx + args.t5
|
|
185
|
-
y2 = cpy + args.t6
|
|
186
|
-
} {
|
|
187
|
-
x2 = args.t5
|
|
188
|
-
y2 = args.t6
|
|
189
|
-
}
|
|
190
|
-
dx = x1 - x2
|
|
191
|
-
dy = y1 - y2
|
|
192
|
-
d = (sqrt ((dx*dx) + (dy*dy)))
|
|
193
|
-
if( (d < 0.00001 ) || (rx < 0.00001) || (ry < 0.00001) ) {
|
|
194
|
-
callback.Line( x2 y2 )
|
|
195
|
-
return (Vec2.CreateNew (x2 y2))
|
|
196
|
-
}
|
|
197
|
-
sinrx = (sin rotx)
|
|
198
|
-
cosrx = (cos rotx)
|
|
199
|
-
x1p = ( cosrx * dx ) / 2.0 + ( sinrx * dy / 2.0 )
|
|
200
|
-
y1p = ( -1.0 * sinrx * dx ) / 2.0 + ( cosrx * dy / 2.0 )
|
|
201
|
-
d = (x1p*x1p) / (rx*rx) + (y1p*y1p) / (ry*ry)
|
|
202
|
-
if ( d > 1.0 ) {
|
|
203
|
-
d = (sqrt d)
|
|
204
|
-
rx = rx * d
|
|
205
|
-
ry = ry * d
|
|
206
|
-
}
|
|
207
|
-
s = 0.0
|
|
208
|
-
sa = (rx*rx)*(ry*ry) - (rx*rx)*(y1p*y1p) - (ry*ry)*(x1p*x1p)
|
|
209
|
-
sb = (rx*rx)*(y1p*y1p) + (ry*ry)*(x1p*x1p)
|
|
210
|
-
if( sa < 0.0 ) {
|
|
211
|
-
sa = 0.0
|
|
212
|
-
}
|
|
213
|
-
if( sb > 0.0 ) {
|
|
214
|
-
s = (sqrt (sa / sb))
|
|
215
|
-
}
|
|
216
|
-
if ( fa == fs ) {
|
|
217
|
-
s = -1.0 * s
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
cxp = s * rx * y1p / ry
|
|
221
|
-
cyp = s * (-1.0 * ry) * x1p / rx
|
|
222
|
-
cx = (x1 + x2) / 2.0 + (cosrx * cxp - sinrx * cyp)
|
|
223
|
-
cy = (y1 + y2) / 2.0 + (sinrx * cxp + cosrx * cyp)
|
|
224
|
-
|
|
225
|
-
def u (Vec2.CreateNew ( ( ( x1p - cxp ) / rx) ( ( y1p - cyp ) / ry) ) )
|
|
226
|
-
def v (Vec2.CreateNew ( ( ( -1.0*x1p - cxp ) / rx ) ( ( -1.0*y1p - cyp ) / ry ) ))
|
|
227
|
-
def unitV (Vec2.CreateNew (1.0 0.0 ))
|
|
228
|
-
a1 = (this.__vecang( unitV u ))
|
|
229
|
-
da = (this.__vecang( u v))
|
|
230
|
-
if( (fs == 0.0) && (da > 0.0) ) {
|
|
231
|
-
da = da - 2.0 * PI_VALUE
|
|
232
|
-
} {
|
|
233
|
-
if( ( fs == 1.0) && (da < 0.0)) {
|
|
234
|
-
da = 2.0 * PI_VALUE + da
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
t.t0 = cosrx
|
|
238
|
-
t.t1 = sinrx
|
|
239
|
-
t.t2 = -1.0 * sinrx
|
|
240
|
-
t.t3 = cosrx
|
|
241
|
-
t.t4 = cx
|
|
242
|
-
t.t5 = cy
|
|
243
|
-
|
|
244
|
-
ndivs = (to_int ( ( (fabs da) / (PI_VALUE * 0.5) ) + 1.0 ) )
|
|
245
|
-
hda = ( da / (to_double ndivs)) / 2.0
|
|
246
|
-
kappa = (fabs ( 4.0 / 3.0 * (1.0 - (cos hda) ) / (sin hda) ) )
|
|
247
|
-
if (da < 0.0) {
|
|
248
|
-
kappa = -1.0 * kappa
|
|
249
|
-
}
|
|
250
|
-
i = 0
|
|
251
|
-
while ( i <= ndivs ) {
|
|
252
|
-
a = a1 + (da * (to_double i) / (to_double ndivs))
|
|
253
|
-
dx = (cos a)
|
|
254
|
-
dy = (sin a)
|
|
255
|
-
def trans (this.__xformPoint ( (Vec2.CreateNew ( (dx*rx) (dy*ry) )) t ))
|
|
256
|
-
x = trans.x
|
|
257
|
-
y = trans.y
|
|
258
|
-
def v_trans (this.__xformVec ( (Vec2.CreateNew ( (-1.0 * dy*rx *kappa) (dx*ry*kappa) )) t ))
|
|
259
|
-
tanx = v_trans.x
|
|
260
|
-
tany = v_trans.y
|
|
261
|
-
if( i > 0 ) {
|
|
262
|
-
callback.Curve(
|
|
263
|
-
(px + ptanx) (py + ptany)
|
|
264
|
-
(x - tanx) ( y - tany )
|
|
265
|
-
x y
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
px = x
|
|
269
|
-
py = y
|
|
270
|
-
ptanx = tanx
|
|
271
|
-
ptany = tany
|
|
272
|
-
i = i + 1
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
def rv (Vec2.CreateNew (x2 y2))
|
|
276
|
-
return rv
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
fn parsePath:void (path:string callback:PathExecutor) {
|
|
280
|
-
|
|
281
|
-
i = 0
|
|
282
|
-
this.buff = (to_charbuffer path)
|
|
283
|
-
def s:charbuffer (unwrap this.buff)
|
|
284
|
-
len = (length s)
|
|
285
|
-
|
|
286
|
-
def buff:charbuffer (to_charbuffer path)
|
|
287
|
-
def cmd:char (ccode "L")
|
|
288
|
-
def path:EVGBezierPath (new EVGBezierPath ())
|
|
289
|
-
|
|
290
|
-
def args:PathSegment (new PathSegment())
|
|
291
|
-
def require_args:int 2
|
|
292
|
-
def arg_cnt:int 0
|
|
293
|
-
|
|
294
|
-
def QPx:PathSegment (new PathSegment())
|
|
295
|
-
def QPy:PathSegment (new PathSegment())
|
|
296
|
-
def CPx:PathSegment (new PathSegment())
|
|
297
|
-
def CPy:PathSegment (new PathSegment())
|
|
298
|
-
|
|
299
|
-
def cx:double 0.0
|
|
300
|
-
def cy:double 0.0
|
|
301
|
-
def cx2:double 0.0
|
|
302
|
-
def cy2:double 0.0
|
|
303
|
-
|
|
304
|
-
; callback.Move( cx cy )
|
|
305
|
-
|
|
306
|
-
def last_i:int -1
|
|
307
|
-
|
|
308
|
-
while ( i < len ) {
|
|
309
|
-
if(last_i == i) {
|
|
310
|
-
i = i + 1
|
|
311
|
-
}
|
|
312
|
-
last_i = i
|
|
313
|
-
def c:char (charAt s i)
|
|
314
|
-
|
|
315
|
-
if( (c == (ccode "V")) || (c == (ccode "v")) || (c == (ccode "H")) || (c == (ccode "h")) ) {
|
|
316
|
-
cmd = c
|
|
317
|
-
require_args = 1
|
|
318
|
-
arg_cnt = 0
|
|
319
|
-
continue
|
|
320
|
-
}
|
|
321
|
-
if( (c == (ccode "m")) || (c == (ccode "M")) || (c == (ccode "L")) || (c == (ccode "l")) || (c == (ccode "t")) || (c == (ccode "T")) ) {
|
|
322
|
-
cmd = c
|
|
323
|
-
require_args = 2
|
|
324
|
-
arg_cnt = 0
|
|
325
|
-
continue
|
|
326
|
-
}
|
|
327
|
-
if( (c == (ccode "q")) || (c == (ccode "Q")) || (c == (ccode "S")) || (c == (ccode "s")) ) {
|
|
328
|
-
cmd = c
|
|
329
|
-
require_args = 4
|
|
330
|
-
arg_cnt = 0
|
|
331
|
-
continue
|
|
332
|
-
}
|
|
333
|
-
if( (c == (ccode "c")) || (c == (ccode "C")) ) {
|
|
334
|
-
cmd = c
|
|
335
|
-
require_args = 6
|
|
336
|
-
arg_cnt = 0
|
|
337
|
-
continue
|
|
338
|
-
}
|
|
339
|
-
if( (c == (ccode "a")) || (c == (ccode "A")) ) {
|
|
340
|
-
cmd = c
|
|
341
|
-
require_args = 7
|
|
342
|
-
arg_cnt = 0
|
|
343
|
-
continue
|
|
344
|
-
}
|
|
345
|
-
if(this.scanNumber()) {
|
|
346
|
-
switch arg_cnt {
|
|
347
|
-
case 0 { args.t0 = last_number }
|
|
348
|
-
case 1 { args.t1 = last_number }
|
|
349
|
-
case 2 { args.t2 = last_number }
|
|
350
|
-
case 3 { args.t3 = last_number }
|
|
351
|
-
case 4 { args.t4 = last_number }
|
|
352
|
-
case 5 { args.t5 = last_number }
|
|
353
|
-
case 6 { args.t6 = last_number }
|
|
354
|
-
default {
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
arg_cnt = arg_cnt + 1
|
|
359
|
-
if ( arg_cnt >= require_args ) {
|
|
360
|
-
switch cmd {
|
|
361
|
-
case (ccode "m") {
|
|
362
|
-
callback.Move( (cx + args.t0) (cy + args.t1) )
|
|
363
|
-
cx = args.t0
|
|
364
|
-
cy = args.t1
|
|
365
|
-
cmd = (ccode "L")
|
|
366
|
-
require_args = 2
|
|
367
|
-
cx2 = cx
|
|
368
|
-
cy2 = cy
|
|
369
|
-
}
|
|
370
|
-
case (ccode "M") {
|
|
371
|
-
callback.Move( args.t0 args.t1 )
|
|
372
|
-
cx = args.t0
|
|
373
|
-
cy = args.t1
|
|
374
|
-
cmd = (ccode "L")
|
|
375
|
-
require_args = 2
|
|
376
|
-
cx2 = cx
|
|
377
|
-
cy2 = cy
|
|
378
|
-
}
|
|
379
|
-
case (ccode "l") {
|
|
380
|
-
callback.Line( (cx + args.t0) (cy + args.t1) )
|
|
381
|
-
cx = cx + args.t0
|
|
382
|
-
cy = cy + args.t1
|
|
383
|
-
cx2 = cx
|
|
384
|
-
cy2 = cy
|
|
385
|
-
}
|
|
386
|
-
case (ccode "L") {
|
|
387
|
-
callback.Line( args.t0 args.t1 )
|
|
388
|
-
cx = args.t0
|
|
389
|
-
cy = args.t1
|
|
390
|
-
cx2 = cx
|
|
391
|
-
cy2 = cy
|
|
392
|
-
}
|
|
393
|
-
case (ccode "h") {
|
|
394
|
-
callback.Line( (cx + args.t0) cy )
|
|
395
|
-
cx = cx + args.t0
|
|
396
|
-
cx2 = cx
|
|
397
|
-
}
|
|
398
|
-
case (ccode "H") {
|
|
399
|
-
callback.Line( args.t0 cy )
|
|
400
|
-
cx = args.t0
|
|
401
|
-
cx2 = cx
|
|
402
|
-
}
|
|
403
|
-
case (ccode "v") {
|
|
404
|
-
callback.Line( cx (cy + args.t0) )
|
|
405
|
-
cy = cy + args.t0
|
|
406
|
-
cy2 = cy
|
|
407
|
-
}
|
|
408
|
-
case (ccode "V") {
|
|
409
|
-
callback.Line( cx args.t0 )
|
|
410
|
-
cy = args.t0
|
|
411
|
-
cy2 = cy
|
|
412
|
-
}
|
|
413
|
-
case (ccode "c") {
|
|
414
|
-
callback.Curve( (cx + args.t0) (cy + args.t1)
|
|
415
|
-
(cx + args.t2) (cy + args.t3)
|
|
416
|
-
(cx + args.t4) (cy + args.t5)
|
|
417
|
-
)
|
|
418
|
-
cx2 = cx + args.t2
|
|
419
|
-
cy2 = cy + args.t3
|
|
420
|
-
cx = cx + args.t4
|
|
421
|
-
cy = cy + args.t5
|
|
422
|
-
}
|
|
423
|
-
case (ccode "C") {
|
|
424
|
-
callback.Curve( args.t0 args.t1
|
|
425
|
-
args.t2 args.t3
|
|
426
|
-
args.t4 args.t5
|
|
427
|
-
)
|
|
428
|
-
cx2 = args.t2
|
|
429
|
-
cy2 = args.t3
|
|
430
|
-
cx = args.t4
|
|
431
|
-
cy = args.t5
|
|
432
|
-
}
|
|
433
|
-
case (ccode "s") {
|
|
434
|
-
callback.Curve( (cx + cx - cx2) (cy + cy - cy2)
|
|
435
|
-
(cx + args.t0) (cy + args.t1)
|
|
436
|
-
(cx + args.t2) (cy + args.t3)
|
|
437
|
-
)
|
|
438
|
-
cx2 = cx + args.t0
|
|
439
|
-
cy2 = cy + args.t1
|
|
440
|
-
cx = cx + args.t2
|
|
441
|
-
cy = cy + args.t3
|
|
442
|
-
}
|
|
443
|
-
case (ccode "S") {
|
|
444
|
-
callback.Curve( (cx + cx - cx2) (cy + cy - cy2)
|
|
445
|
-
args.t0 args.t1
|
|
446
|
-
args.t2 args.t3
|
|
447
|
-
)
|
|
448
|
-
cx2 = args.t0
|
|
449
|
-
cy2 = args.t1
|
|
450
|
-
cx = args.t2
|
|
451
|
-
cy = args.t3
|
|
452
|
-
}
|
|
453
|
-
case (ccode "q") {
|
|
454
|
-
QPx.t0 = cx
|
|
455
|
-
QPy.t0 = cy
|
|
456
|
-
QPx.t1 = cx + args.t0
|
|
457
|
-
QPy.t1 = cy + args.t1
|
|
458
|
-
QPx.t2 = cx + args.t2
|
|
459
|
-
QPy.t2 = cy + args.t3
|
|
460
|
-
CPx.t0 = QPx.t0
|
|
461
|
-
CPy.t0 = QPy.t0
|
|
462
|
-
CPx.t1 = QPx.t0 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t0 )
|
|
463
|
-
CPy.t1 = QPy.t0 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t0 )
|
|
464
|
-
CPx.t2 = QPx.t2 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t2 )
|
|
465
|
-
CPy.t2 = QPy.t2 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t2 )
|
|
466
|
-
CPx.t3 = QPx.t2
|
|
467
|
-
CPy.t3 = QPy.t2
|
|
468
|
-
callback.Curve( CPx.t1 CPy.t1
|
|
469
|
-
CPx.t2 CPy.t2
|
|
470
|
-
CPx.t3 CPy.t3
|
|
471
|
-
)
|
|
472
|
-
cx2 = CPx.t2
|
|
473
|
-
cy2 = CPy.t2
|
|
474
|
-
cx = CPx.t3
|
|
475
|
-
cy = CPy.t3
|
|
476
|
-
}
|
|
477
|
-
case (ccode "Q") {
|
|
478
|
-
QPx.t0 = cx
|
|
479
|
-
QPy.t0 = cy
|
|
480
|
-
QPx.t1 = args.t0
|
|
481
|
-
QPy.t1 = args.t1
|
|
482
|
-
QPx.t2 = args.t2
|
|
483
|
-
QPy.t2 = args.t3
|
|
484
|
-
CPx.t0 = QPx.t0
|
|
485
|
-
CPy.t0 = QPy.t0
|
|
486
|
-
CPx.t1 = QPx.t0 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t0 )
|
|
487
|
-
CPy.t1 = QPy.t0 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t0 )
|
|
488
|
-
CPx.t2 = QPx.t2 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t2 )
|
|
489
|
-
CPy.t2 = QPy.t2 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t2 )
|
|
490
|
-
CPx.t3 = QPx.t2
|
|
491
|
-
CPy.t3 = QPy.t2
|
|
492
|
-
callback.Curve( CPx.t1 CPy.t1
|
|
493
|
-
CPx.t2 CPy.t2
|
|
494
|
-
CPx.t3 CPy.t3
|
|
495
|
-
)
|
|
496
|
-
cx2 = CPx.t1
|
|
497
|
-
cy2 = CPy.t1
|
|
498
|
-
cx = CPx.t2
|
|
499
|
-
cy = CPy.t3
|
|
500
|
-
}
|
|
501
|
-
case (ccode "T") {
|
|
502
|
-
QPx.t0 = cx
|
|
503
|
-
QPy.t0 = cy
|
|
504
|
-
QPx.t1 = 2.0*cx - cx2
|
|
505
|
-
QPy.t1 = 2.0*cy - cy2
|
|
506
|
-
QPx.t2 = args.t0
|
|
507
|
-
QPy.t2 = args.t1
|
|
508
|
-
CPx.t0 = QPx.t0
|
|
509
|
-
CPy.t0 = QPy.t0
|
|
510
|
-
CPx.t1 = QPx.t0 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t0 )
|
|
511
|
-
CPy.t1 = QPy.t0 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t0 )
|
|
512
|
-
|
|
513
|
-
; TODO: is this correct here ?? it was stored to index 3
|
|
514
|
-
CPx.t2 = QPx.t2
|
|
515
|
-
CPy.t2 = QPy.t2
|
|
516
|
-
callback.Curve( CPx.t0 CPy.t0
|
|
517
|
-
CPx.t1 CPy.t1
|
|
518
|
-
CPx.t2 CPy.t2
|
|
519
|
-
)
|
|
520
|
-
cx2 = CPx.t1
|
|
521
|
-
cy2 = CPy.t1
|
|
522
|
-
cx = CPx.t2
|
|
523
|
-
cy = CPy.t3
|
|
524
|
-
}
|
|
525
|
-
case (ccode "t") {
|
|
526
|
-
QPx.t0 = cx
|
|
527
|
-
QPy.t0 = cy
|
|
528
|
-
QPx.t1 = 2.0*cx - cx2
|
|
529
|
-
QPy.t1 = 2.0*cy - cy2
|
|
530
|
-
QPx.t2 = cx + args.t0
|
|
531
|
-
QPy.t2 = cy + args.t1
|
|
532
|
-
CPx.t0 = QPx.t0
|
|
533
|
-
CPy.t0 = QPy.t0
|
|
534
|
-
CPx.t1 = QPx.t0 + ( 2.0 / 3.0 ) * ( QPx.t1 - QPx.t0 )
|
|
535
|
-
CPy.t1 = QPy.t0 + ( 2.0 / 3.0 ) * ( QPy.t1 - QPy.t0 )
|
|
536
|
-
|
|
537
|
-
; TODO: is this correct here ?? it was stored to index 3
|
|
538
|
-
CPx.t2 = QPx.t2
|
|
539
|
-
CPy.t2 = QPy.t2
|
|
540
|
-
callback.Curve( CPx.t0 CPy.t0
|
|
541
|
-
CPx.t1 CPy.t1
|
|
542
|
-
CPx.t2 CPy.t2
|
|
543
|
-
)
|
|
544
|
-
cx2 = CPx.t1
|
|
545
|
-
cy2 = CPy.t1
|
|
546
|
-
cx = CPx.t2
|
|
547
|
-
cy = CPy.t3
|
|
548
|
-
}
|
|
549
|
-
case (ccode "a") {
|
|
550
|
-
def res (this.pathArcTo(callback (Vec2.CreateNew (cx cy)) args true ))
|
|
551
|
-
cx = res.x
|
|
552
|
-
cy = res.y
|
|
553
|
-
cx2 = cx
|
|
554
|
-
cy2 = cy
|
|
555
|
-
}
|
|
556
|
-
case (ccode "A") {
|
|
557
|
-
def res (this.pathArcTo(callback (Vec2.CreateNew (cx cy)) args false ))
|
|
558
|
-
cx = res.x
|
|
559
|
-
cy = res.y
|
|
560
|
-
cx2 = cx
|
|
561
|
-
cy2 = cy
|
|
562
|
-
}
|
|
563
|
-
default {
|
|
564
|
-
if (arg_cnt >= 2) {
|
|
565
|
-
cx = args.t0
|
|
566
|
-
cy = args.t1
|
|
567
|
-
cx2 = cx
|
|
568
|
-
cy2 = cy
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
; if arg cnt was matched reset args
|
|
573
|
-
arg_cnt = 0
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
sfn m@(main) () {
|
|
579
|
-
def path1 "M130 110 C 120 140, 180 140, 170 110"
|
|
580
|
-
def path2 "M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80"
|
|
581
|
-
def path3 "M10 80 Q 95 10 180 80"
|
|
582
|
-
def path4 "M10 80 Q 52.5 10, 95 80 T 180 80"
|
|
583
|
-
def path5 "M-130 -110 C 120 140, 180 140, 170 110"
|
|
584
|
-
def path6 "M10 315
|
|
585
|
-
L 110 215
|
|
586
|
-
A 30 50 0 0 1 162.55 162.45
|
|
587
|
-
L 172.55 152.45
|
|
588
|
-
A 30 50 -45 0 1 215.1 109.9
|
|
589
|
-
L 315 10"
|
|
590
|
-
|
|
591
|
-
def path7 "M 14.781 14.347 h 1.738 c 0.24 0 0.436 -0.194 0.436 -0.435 v -1.739 c 0 -0.239 -0.195 -0.435 -0.436 -0.435 h -1.738 c -0.239 0 -0.435 0.195 -0.435 0.435 v 1.739 C 14.347 14.152 14.542 14.347 14.781 14.347 M 18.693 3.045 H 1.307 c -0.48 0 -0.869 0.39 -0.869 0.869 v 12.17 c 0 0.479 0.389 0.869 0.869 0.869 h 17.387 c 0.479 0 0.869 -0.39 0.869 -0.869 V 3.915 C 19.562 3.435 19.173 3.045 18.693 3.045 M 18.693 16.085 H 1.307 V 9.13 h 17.387 V 16.085 Z M 18.693 5.653 H 1.307 V 3.915 h 17.387 V 5.653 Z M 3.48 12.608 h 7.824 c 0.24 0 0.435 -0.195 0.435 -0.436 c 0 -0.239 -0.194 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.195 -0.435 0.435 C 3.045 12.413 3.24 12.608 3.48 12.608 M 3.48 14.347 h 6.085 c 0.24 0 0.435 -0.194 0.435 -0.435 s -0.195 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.194 -0.435 0.435 S 3.24 14.347 3.48 14.347"
|
|
592
|
-
def path8 "M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 c -0.245 -0.916 -1.186 -1.458 -2.101 -1.213 L 3.592 2.912 C 2.676 3.157 2.133 4.098 2.378 5.014 l 0.186 0.695 H 2.278 c -0.947 0 -1.716 0.768 -1.716 1.716 V 17.72 c 0 0.947 0.769 1.716 1.716 1.716 h 13.728 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 C 19.438 11.624 18.669 10.856 17.722 10.856 M 16.006 6.566 c 0.473 0 0.857 0.384 0.857 0.858 v 0.238 c -0.253 -0.146 -0.544 -0.238 -0.857 -0.238 h -0.157 l -0.229 -0.858 H 16.006 Z M 14.41 5.372 l 0.55 2.053 H 6.67 L 14.41 5.372 Z M 3.814 3.741 l 8.657 -2.29 c 0.458 -0.123 0.928 0.149 1.051 0.607 l 0.222 0.828 L 3.43 5.621 l -0.223 -0.83 C 3.084 4.333 3.356 3.863 3.814 3.741 M 1.42 7.424 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 0.517 l 0.229 0.858 H 2.278 c -0.314 0 -0.605 0.091 -0.858 0.238 V 7.424 Z M 16.863 17.72 c 0 0.474 -0.385 0.858 -0.857 0.858 H 2.278 c -0.474 0 -0.858 -0.385 -0.858 -0.858 V 9.141 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 13.728 c 0.473 0 0.857 0.384 0.857 0.858 v 1.715 h -1.716 c -0.947 0 -1.716 0.768 -1.716 1.716 v 1.716 c 0 0.947 0.769 1.716 1.716 1.716 h 1.716 V 17.72 Z M 18.58 14.288 c 0 0.474 -0.385 0.857 -0.858 0.857 h -2.574 c -0.474 0 -0.857 -0.384 -0.857 -0.857 v -1.716 c 0 -0.474 0.384 -0.858 0.857 -0.858 h 2.574 c 0.474 0 0.858 0.385 0.858 0.858 V 14.288 Z M 9.571 16.861 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.236 0 0.429 -0.191 0.429 -0.429 S 9.808 16.861 9.571 16.861 M 12.145 16.861 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.43 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.191 0.43 -0.429 S 12.382 16.861 12.145 16.861 M 9.571 9.141 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 C 9.808 9.998 10 9.806 10 9.569 S 9.808 9.141 9.571 9.141"
|
|
593
|
-
def path9 "M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 -3 -4"
|
|
594
|
-
def path10 "M 16.853 8.355 V 5.888 c 0 -3.015 -2.467 -5.482 -5.482 -5.482 H 8.629 c -3.015 0 -5.482 2.467 -5.482 5.482 v 2.467 l -2.741 7.127 c 0 1.371 4.295 4.112 9.594 4.112 s 9.594 -2.741 9.594 -4.112 L 16.853 8.355 Z M 5.888 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 6.402 17.137 6.173 17.367 5.888 17.367 Z M 5.203 10 c 0 -0.377 0.19 -0.928 0.423 -1.225 c 0 0 0.651 -0.831 1.976 -0.831 c 0.672 0 1.141 0.309 1.141 0.309 C 9.057 8.46 9.315 8.938 9.315 9.315 v 1.028 c 0 0.188 -0.308 0.343 -0.685 0.343 H 5.888 C 5.511 10.685 5.203 10.377 5.203 10 Z M 7.944 16.853 H 7.259 v -1.371 l 0.685 -0.685 V 16.853 Z M 9.657 16.853 H 8.629 v -2.741 h 1.028 V 16.853 Z M 8.972 13.426 v -1.028 c 0 -0.568 0.46 -1.028 1.028 -1.028 c 0.568 0 1.028 0.46 1.028 1.028 v 1.028 H 8.972 Z M 11.371 16.853 h -1.028 v -2.741 h 1.028 V 16.853 Z M 12.741 16.853 h -0.685 v -2.056 l 0.685 0.685 V 16.853 Z M 14.112 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 14.626 17.137 14.396 17.367 14.112 17.367 Z M 14.112 10.685 h -2.741 c -0.377 0 -0.685 -0.154 -0.685 -0.343 V 9.315 c 0 -0.377 0.258 -0.855 0.572 -1.062 c 0 0 0.469 -0.309 1.141 -0.309 c 1.325 0 1.976 0.831 1.976 0.831 c 0.232 0.297 0.423 0.848 0.423 1.225 S 14.489 10.685 14.112 10.685 Z M 18.347 15.801 c -0.041 0.016 -0.083 0.023 -0.124 0.023 c -0.137 0 -0.267 -0.083 -0.319 -0.218 l -2.492 -6.401 c -0.659 -1.647 -1.474 -2.289 -2.905 -2.289 c -0.95 0 -1.746 0.589 -1.754 0.595 c -0.422 0.317 -1.084 0.316 -1.507 0 C 9.239 7.505 8.435 6.916 7.492 6.916 c -1.431 0 -2.246 0.642 -2.906 2.292 l -2.491 6.398 c -0.069 0.176 -0.268 0.264 -0.443 0.195 c -0.176 -0.068 -0.264 -0.267 -0.195 -0.444 l 2.492 -6.401 c 0.765 -1.911 1.824 -2.726 3.543 -2.726 c 1.176 0 2.125 0.702 2.165 0.731 c 0.179 0.135 0.506 0.135 0.685 0 c 0.04 -0.029 0.99 -0.731 2.165 -0.731 c 1.719 0 2.779 0.814 3.542 2.723 l 2.493 6.404 C 18.611 15.534 18.524 15.733 18.347 15.801 Z"
|
|
595
|
-
def path11 "M10,6.536c-2.263,0-4.099,1.836-4.099,4.098S7.737,14.732,10,14.732s4.099-1.836,4.099-4.098S12.263,6.536,10,6.536M10,13.871c-1.784,0-3.235-1.453-3.235-3.237S8.216,7.399,10,7.399c1.784,0,3.235,1.452,3.235,3.235S11.784,13.871,10,13.871M17.118,5.672l-3.237,0.014L12.52,3.697c-0.082-0.105-0.209-0.168-0.343-0.168H7.824c-0.134,0-0.261,0.062-0.343,0.168L6.12,5.686H2.882c-0.951,0-1.726,0.748-1.726,1.699v7.362c0,0.951,0.774,1.725,1.726,1.725h14.236c0.951,0,1.726-0.773,1.726-1.725V7.195C18.844,6.244,18.069,5.672,17.118,5.672 M17.98,14.746c0,0.477-0.386,0.861-0.862,0.861H2.882c-0.477,0-0.863-0.385-0.863-0.861V7.384c0-0.477,0.386-0.85,0.863-0.85l3.451,0.014c0.134,0,0.261-0.062,0.343-0.168l1.361-1.989h3.926l1.361,1.989c0.082,0.105,0.209,0.168,0.343,0.168l3.451-0.014c0.477,0,0.862,0.184,0.862,0.661V14.746z"
|
|
596
|
-
def ex (new PathExecutor)
|
|
597
|
-
def parser (new EVGPathParser)
|
|
598
|
-
parser.parsePath(path1 ex)
|
|
599
|
-
parser.parsePath(path2 ex)
|
|
600
|
-
parser.parsePath(path3 ex)
|
|
601
|
-
parser.parsePath(path4 ex)
|
|
602
|
-
parser.parsePath(path5 ex)
|
|
603
|
-
parser.parsePath(path6 ex)
|
|
604
|
-
def coll (new PathCollector)
|
|
605
|
-
parser.parsePath(path6 coll)
|
|
606
|
-
print (coll.getString())
|
|
607
|
-
|
|
608
|
-
def coll (new PathCollector)
|
|
609
|
-
parser.parsePath(path7 coll)
|
|
610
|
-
print (coll.getString())
|
|
611
|
-
print " ----- "
|
|
612
|
-
def coll (new PathCollector)
|
|
613
|
-
parser.parsePath(path8 coll)
|
|
614
|
-
print (coll.getString())
|
|
615
|
-
print " ----- "
|
|
616
|
-
def coll (new PathCollector)
|
|
617
|
-
parser.parsePath(path9 coll)
|
|
618
|
-
print (coll.getString())
|
|
619
|
-
print " ----- "
|
|
620
|
-
def coll (new PathCollector)
|
|
621
|
-
parser.parsePath(path10 coll)
|
|
622
|
-
print (coll.getString())
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|