ranger-compiler 3.5.1 → 3.5.2

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.
Files changed (338) hide show
  1. package/CHANGELOG.md +1064 -20
  2. package/LICENSE +3 -1
  3. package/README.md +123 -28
  4. package/dist/Lang.rgr +1188 -290
  5. package/dist/api.d.ts +2343 -879
  6. package/dist/api.js +79923 -56921
  7. package/dist/lib/JSON.rgr +102 -91
  8. package/dist/lib/Shell.rgr +4 -4
  9. package/dist/lib/apple/AppleToolchain.rgr +4 -4
  10. package/dist/lib/apple/README.md +5 -4
  11. package/dist/lib/apple/apple_test.rgr +1 -1
  12. package/dist/lib/core/README.md +1 -1
  13. package/dist/lib/evg/EVG.rgr +12 -0
  14. package/dist/lib/evg/EVGA11yFromTree.rgr +302 -0
  15. package/dist/lib/evg/EVGA11yTree.rgr +894 -0
  16. package/dist/lib/evg/EVGBox.rgr +267 -0
  17. package/dist/lib/evg/EVGBoxShorthandTest.rgr +220 -0
  18. package/dist/lib/evg/EVGCodepoint.rgr +316 -0
  19. package/dist/lib/evg/EVGColor.rgr +700 -0
  20. package/dist/lib/evg/EVGCommands.rgr +177 -0
  21. package/dist/lib/evg/EVGComponent.rgr +331 -0
  22. package/dist/lib/evg/EVGComponentTest.rgr +387 -0
  23. package/dist/lib/evg/EVGConnector.rgr +541 -0
  24. package/dist/lib/evg/EVGConnectorTest.rgr +306 -0
  25. package/dist/lib/evg/EVGDisplayList.rgr +4186 -0
  26. package/dist/lib/evg/EVGEasing.rgr +370 -0
  27. package/dist/lib/evg/EVGEffectTest.rgr +253 -0
  28. package/dist/lib/evg/EVGElement.rgr +4914 -0
  29. package/dist/lib/evg/EVGFixedTest.rgr +289 -0
  30. package/dist/lib/evg/EVGFlexRulesTest.rgr +317 -0
  31. package/dist/lib/evg/EVGFlexWrapTest.rgr +246 -0
  32. package/dist/lib/evg/EVGFling.rgr +244 -0
  33. package/dist/lib/evg/EVGFocus.rgr +400 -0
  34. package/dist/lib/evg/EVGFocusTest.rgr +399 -0
  35. package/dist/lib/evg/EVGGradient.rgr +322 -0
  36. package/dist/lib/evg/EVGGrapheme.rgr +190 -0
  37. package/dist/lib/evg/EVGGrid.rgr +975 -0
  38. package/dist/lib/evg/EVGHitTest.rgr +208 -0
  39. package/dist/lib/evg/EVGHoles.rgr +294 -0
  40. package/dist/lib/evg/EVGHostMeasurerTest.rgr +281 -0
  41. package/dist/lib/evg/EVGHostTextMeasurer.rgr +331 -0
  42. package/dist/lib/evg/EVGHostTree.rgr +834 -0
  43. package/dist/lib/evg/EVGHostTreeTest.rgr +447 -0
  44. package/dist/lib/evg/EVGImageDecode.rgr +117 -0
  45. package/dist/lib/evg/EVGImageMeasurer.rgr +86 -0
  46. package/dist/lib/evg/EVGInspect.rgr +883 -0
  47. package/dist/lib/evg/EVGInvalidateTest.rgr +432 -0
  48. package/dist/lib/evg/EVGJsonTest.rgr +535 -0
  49. package/dist/lib/evg/EVGLayout.rgr +4220 -0
  50. package/dist/lib/evg/EVGMeasure.rgr +1267 -0
  51. package/dist/lib/evg/EVGOverlayTest.rgr +626 -0
  52. package/dist/lib/evg/EVGPatch.rgr +1721 -0
  53. package/dist/lib/evg/EVGPatchTest.rgr +692 -0
  54. package/dist/lib/evg/EVGPopoverTest.rgr +395 -0
  55. package/dist/lib/evg/EVGReconcile.rgr +226 -0
  56. package/dist/lib/evg/EVGReconcileTest.rgr +421 -0
  57. package/dist/lib/evg/EVGReject.rgr +126 -0
  58. package/dist/lib/evg/EVGRelayoutTest.rgr +375 -0
  59. package/dist/lib/evg/EVGRtlLayoutTest.rgr +319 -0
  60. package/dist/lib/evg/EVGRuler.rgr +232 -0
  61. package/dist/lib/evg/EVGRulerTest.rgr +172 -0
  62. package/dist/lib/evg/EVGSelectChrome.rgr +178 -0
  63. package/dist/lib/evg/EVGStyleCacheTest.rgr +419 -0
  64. package/dist/lib/evg/EVGStyleSheet.rgr +2148 -0
  65. package/dist/lib/evg/EVGStyleStateTest.rgr +407 -0
  66. package/dist/lib/evg/EVGStyleVarTest.rgr +471 -0
  67. package/dist/lib/evg/EVGText.rgr +105 -0
  68. package/dist/lib/evg/EVGTextEngine.rgr +536 -0
  69. package/dist/lib/evg/EVGTextMeasurer.rgr +720 -0
  70. package/dist/lib/evg/EVGTimingTest.rgr +1417 -0
  71. package/dist/lib/evg/EVGToolbar.rgr +1369 -0
  72. package/dist/lib/evg/EVGTransition.rgr +728 -0
  73. package/dist/lib/evg/EVGTreeJson.rgr +721 -0
  74. package/dist/lib/evg/EVGUnit.rgr +554 -0
  75. package/dist/lib/evg/EVGViewportUnitTest.rgr +236 -0
  76. package/dist/lib/evg/EvgApp.rgr +189 -0
  77. package/dist/lib/evg/EvgBitmapTracer.rgr +4277 -0
  78. package/dist/lib/evg/EvgBitmapTracerTest.rgr +2119 -0
  79. package/dist/lib/evg/EvgHost.rgr +451 -0
  80. package/dist/lib/evg/EvgTest.rgr +91 -0
  81. package/dist/lib/evg/EvgTraceColor.rgr +236 -0
  82. package/dist/lib/evg/EvgTraceCurve.rgr +648 -0
  83. package/dist/lib/evg/EvgTraceFit.rgr +767 -0
  84. package/dist/lib/evg/EvgTracePath.rgr +435 -0
  85. package/dist/lib/evg/EvgTraceTypes.rgr +559 -0
  86. package/dist/lib/evg/EvgViewport.rgr +313 -0
  87. package/dist/lib/evg/FxDemoDoc.rgr +185 -0
  88. package/dist/lib/evg/HOSTS.md +227 -0
  89. package/dist/lib/evg/ISSUES.md +835 -0
  90. package/dist/lib/evg/PLAN_ACCESSIBILITY.md +650 -0
  91. package/dist/lib/evg/PLAN_CSS_LAYOUT_AND_FONTS.md +1124 -0
  92. package/dist/lib/evg/PLAN_EFFECTS.md +431 -0
  93. package/dist/lib/evg/PLAN_EVG.md +518 -0
  94. package/dist/lib/evg/PLAN_EVG_RENDERER.md +1674 -0
  95. package/dist/lib/evg/PLAN_INSPECTOR.md +788 -0
  96. package/dist/lib/evg/PLAN_LINKS_AND_FORMS.md +157 -0
  97. package/dist/lib/evg/PLAN_NATIVE_HOSTS.md +671 -0
  98. package/dist/lib/evg/PLAN_VECTOR_IR.md +664 -0
  99. package/dist/lib/evg/PLAN_VIEW_TRANSFORM.md +322 -0
  100. package/dist/lib/evg/PathBuilder.rgr +333 -0
  101. package/dist/lib/evg/README.md +1236 -0
  102. package/dist/lib/evg/SPEC.md +1252 -0
  103. package/dist/lib/evg/SVGPathParser.rgr +1199 -0
  104. package/dist/lib/evg/SvgParser.rgr +1736 -0
  105. package/dist/lib/evg/TODO_EVG_RENDERER.md +595 -0
  106. package/dist/lib/evg/VectorShapes.rgr +331 -0
  107. package/dist/lib/evg/VectorStroke.rgr +107 -0
  108. package/dist/lib/evg/VectorViewBox.rgr +380 -0
  109. package/dist/lib/evg/agent/README.md +290 -0
  110. package/dist/lib/evg/agent/evg_agent.rgr +899 -0
  111. package/dist/lib/evg/agent/fixtures/broken.evg.json +7 -0
  112. package/dist/lib/evg/agent/fixtures/card.evg.json +9 -0
  113. package/dist/lib/evg/agent/fixtures/connector.css +63 -0
  114. package/dist/lib/evg/agent/fixtures/connector.evg.json +14 -0
  115. package/dist/lib/evg/agent/fixtures/drawn.evg.json +129 -0
  116. package/dist/lib/evg/agent/fixtures/gradient.evg.json +4 -0
  117. package/dist/lib/evg/agent/fixtures/popover.css +99 -0
  118. package/dist/lib/evg/agent/fixtures/popover.evg.json +30 -0
  119. package/dist/lib/evg/agent/roundtrip.sh +74 -0
  120. package/dist/lib/evg/agent/smoke.sh +230 -0
  121. package/dist/lib/evg/android/README.md +97 -0
  122. package/dist/lib/evg/android/androidstubs/AndroidStubs.kt +175 -0
  123. package/dist/lib/evg/android/androidstubs/Annotation.kt +10 -0
  124. package/dist/lib/evg/android/androidstubs/App.kt +30 -0
  125. package/dist/lib/evg/android/androidstubs/Content.kt +41 -0
  126. package/dist/lib/evg/android/androidstubs/ContentRes.kt +12 -0
  127. package/dist/lib/evg/android/androidstubs/InputMethod.kt +46 -0
  128. package/dist/lib/evg/android/androidstubs/Net.kt +6 -0
  129. package/dist/lib/evg/android/androidstubs/Os.kt +30 -0
  130. package/dist/lib/evg/android/androidstubs/Util.kt +15 -0
  131. package/dist/lib/evg/android/androidstubs/View.kt +113 -0
  132. package/dist/lib/evg/android/androidstubs/Widget.kt +16 -0
  133. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidEvgSurface.kt +323 -0
  134. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidTextMeasurer.kt +56 -0
  135. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/RippleEffect.kt +262 -0
  136. package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtEvgSurface.kt +238 -0
  137. package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtTextMeasurer.kt +85 -0
  138. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgEngineThread.kt +115 -0
  139. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgPainter.kt +231 -0
  140. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgSurface.kt +117 -0
  141. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/RecordingSurface.kt +94 -0
  142. package/dist/lib/evg/apple/README.md +128 -0
  143. package/dist/lib/evg/apple/Sources/CoreGraphicsEvgSurface.swift +329 -0
  144. package/dist/lib/evg/apple/Sources/CoreTextMeasurer.swift +70 -0
  145. package/dist/lib/evg/apple/Sources/EvgEngineQueue.swift +105 -0
  146. package/dist/lib/evg/apple/Sources/EvgPainter.swift +225 -0
  147. package/dist/lib/evg/apple/Sources/EvgSurface.swift +163 -0
  148. package/dist/lib/evg/apple/Sources/RecordingSurface.swift +110 -0
  149. package/dist/lib/evg/bench/EvgLayoutBench.rgr +34 -0
  150. package/dist/lib/evg/bench/README.md +64 -0
  151. package/dist/lib/evg/bench/layout-bench.mjs +316 -0
  152. package/dist/lib/evg/bench/layout-cases.mjs +510 -0
  153. package/dist/lib/evg/bench/layout-conformance.mjs +254 -0
  154. package/dist/lib/evg/bin/.gitignore +17 -0
  155. package/dist/lib/evg/evg_test.rgr +313 -0
  156. package/dist/lib/evg/gl/README.md +198 -0
  157. package/dist/lib/evg/gl/a11y-paint-check.mjs +73 -0
  158. package/dist/lib/evg/gl/blur-check.mjs +399 -0
  159. package/dist/lib/evg/gl/boxmodel.json +1 -0
  160. package/dist/lib/evg/gl/demo.html +46 -0
  161. package/dist/lib/evg/gl/effect-presets.css +285 -0
  162. package/dist/lib/evg/gl/effect-presets.js +63 -0
  163. package/dist/lib/evg/gl/effect-shots.mjs +135 -0
  164. package/dist/lib/evg/gl/evg-a11y.js +566 -0
  165. package/dist/lib/evg/gl/evg-binary.js +160 -0
  166. package/dist/lib/evg/gl/evg-engine.js +296 -0
  167. package/dist/lib/evg/gl/evg-fx.js +237 -0
  168. package/dist/lib/evg/gl/evg-gestures.js +209 -0
  169. package/dist/lib/evg/gl/evg-list.js +167 -0
  170. package/dist/lib/evg/gl/evg-measure.js +186 -0
  171. package/dist/lib/evg/gl/evg-textinput.js +303 -0
  172. package/dist/lib/evg/gl/evg-view.js +144 -0
  173. package/dist/lib/evg/gl/evg-webgl.js +3942 -0
  174. package/dist/lib/evg/gl/fx-check.mjs +998 -0
  175. package/dist/lib/evg/gl/fx-demo.html +166 -0
  176. package/dist/lib/evg/gl/fx-demo.js +2 -0
  177. package/dist/lib/evg/gl/fx-serve.mjs +47 -0
  178. package/dist/lib/evg/gl/gestures-check.mjs +189 -0
  179. package/dist/lib/evg/gl/list-binary-check.mjs +152 -0
  180. package/dist/lib/evg/gl/measure-check.mjs +135 -0
  181. package/dist/lib/evg/gl/rotation-check.mjs +207 -0
  182. package/dist/lib/evg/gl/shift-check.mjs +113 -0
  183. package/dist/lib/evg/gl/stroke-check.mjs +168 -0
  184. package/dist/lib/evg/gl/text-snap-check.mjs +139 -0
  185. package/dist/lib/evg/gl/view-check.mjs +343 -0
  186. package/dist/lib/evg/gl/view-policy-check.mjs +184 -0
  187. package/dist/lib/evg/html/evg-dom.js +318 -0
  188. package/dist/lib/evg/html/evg-html.js +600 -0
  189. package/dist/lib/evg/inspect/README.md +415 -0
  190. package/dist/lib/evg/inspect/browser-smoke.mjs +115 -0
  191. package/dist/lib/evg/inspect/evg-inspect.js +947 -0
  192. package/dist/lib/evg/inspect/shots/css.png +0 -0
  193. package/dist/lib/evg/inspect/shots/dashboard.png +0 -0
  194. package/dist/lib/evg/inspect/shots/pptx-slide.png +0 -0
  195. package/dist/lib/evg/inspect/shots/state.png +0 -0
  196. package/dist/lib/evg/inspect/shots.mjs +226 -0
  197. package/dist/lib/evg/oracle/css-blur.json +576 -0
  198. package/dist/lib/evg/oracle/css-box.json +157 -0
  199. package/dist/lib/evg/oracle/css-timing.json +709 -0
  200. package/dist/lib/evg/oracle/css_blur_oracle.mjs +529 -0
  201. package/dist/lib/evg/oracle/css_box_oracle.mjs +106 -0
  202. package/dist/lib/evg/oracle/css_timing_oracle.mjs +389 -0
  203. package/dist/lib/evg/original/EVGColor.clj +310 -0
  204. package/dist/lib/evg/original/EVGColorContext.rgr +178 -0
  205. package/dist/lib/evg/original/SVGPath.rgr +627 -0
  206. package/dist/lib/evg/original/Vec2.crgr +103 -0
  207. package/dist/lib/evg/ranger.json +9 -0
  208. package/dist/lib/evg/showcase/README.md +246 -0
  209. package/dist/lib/evg/showcase/assets/emblem.svg +30 -0
  210. package/dist/lib/evg/showcase/assets/rosette.svg +22 -0
  211. package/dist/lib/evg/showcase/build.mjs +651 -0
  212. package/dist/lib/evg/showcase/pages/album.tsx +30 -0
  213. package/dist/lib/evg/showcase/pages/boxmodel.tsx +37 -0
  214. package/dist/lib/evg/showcase/pages/cards.tsx +41 -0
  215. package/dist/lib/evg/showcase/pages/chart_api.tsx +170 -0
  216. package/dist/lib/evg/showcase/pages/charts.tsx +219 -0
  217. package/dist/lib/evg/showcase/pages/drawing.tsx +160 -0
  218. package/dist/lib/evg/showcase/pages/emoji.tsx +91 -0
  219. package/dist/lib/evg/showcase/pages/flex.tsx +46 -0
  220. package/dist/lib/evg/showcase/pages/more.tsx +332 -0
  221. package/dist/lib/evg/showcase/pages/plots.tsx +262 -0
  222. package/dist/lib/evg/showcase/pages/svg.tsx +63 -0
  223. package/dist/lib/evg/showcase/pages/tables.tsx +209 -0
  224. package/dist/lib/evg/showcase/pages/typography.tsx +43 -0
  225. package/dist/lib/evg/showcase/pages/units.tsx +35 -0
  226. package/dist/lib/evg/showcase/pages/variants.tsx +233 -0
  227. package/dist/lib/evg/showcase/pages/vector.tsx +75 -0
  228. package/dist/lib/evg/showcase/pages/views.tsx +223 -0
  229. package/dist/lib/evg/showcase/tests/chart_api_smoke.mjs +339 -0
  230. package/dist/lib/evg/showcase/tests/gl_smoke.mjs +125 -0
  231. package/dist/lib/evg/showcase/themes/chart_api-default.css +15 -0
  232. package/dist/lib/evg/showcase/themes/charts-default.css +29 -0
  233. package/dist/lib/evg/showcase/themes/drawing-default.css +35 -0
  234. package/dist/lib/evg/showcase/themes/more-default.css +128 -0
  235. package/dist/lib/evg/showcase/themes/plots-default.css +18 -0
  236. package/dist/lib/evg/showcase/themes/showcase.css +508 -0
  237. package/dist/lib/evg/showcase/themes/tables-default.css +123 -0
  238. package/dist/lib/evg/showcase/themes/variants-default.css +15 -0
  239. package/dist/lib/evg/showcase/themes/views-default.css +15 -0
  240. package/dist/lib/evg/tools/bench_vs_potrace.mjs +290 -0
  241. package/dist/lib/evg/tools/evg_image_tool.rgr +488 -0
  242. package/dist/lib/evg/tools/evg_trace_bench.rgr +114 -0
  243. package/dist/lib/evg/tools/evg_trace_cli.rgr +662 -0
  244. package/dist/lib/evg/tools/evg_trace_cpp_bench.rgr +83 -0
  245. package/dist/lib/evg/tools/run_trace_bench.sh +74 -0
  246. package/dist/lib/evg/tools/run_trace_cli_smoke.sh +128 -0
  247. package/dist/lib/evg/web/responsive/EvgResponsiveCheck.rgr +271 -0
  248. package/dist/lib/evg/web/responsive/EvgResponsiveDemo.rgr +531 -0
  249. package/dist/lib/evg/web/responsive/README.md +97 -0
  250. package/dist/lib/evg/web/responsive/build.mjs +90 -0
  251. package/dist/lib/evg/web/responsive/dom-check.mjs +169 -0
  252. package/dist/lib/evg/web/responsive/index.html +177 -0
  253. package/dist/lib/evg/web/responsive/smoke.mjs +221 -0
  254. package/dist/lib/evg/web/tools/assets-client.mjs +95 -0
  255. package/dist/lib/evg/web/tools/boot-bench.mjs +189 -0
  256. package/dist/lib/evg/web/tools/inline-assets.mjs +119 -0
  257. package/dist/lib/evg/web/tools/minify.mjs +60 -0
  258. package/dist/lib/evg/web/tracer/build.mjs +87 -0
  259. package/dist/lib/evg/web/tracer/index.html +2805 -0
  260. package/dist/lib/evg/web/tracer/sample.png +0 -0
  261. package/dist/lib/evg/web/tracer/smoke.mjs +1162 -0
  262. package/dist/lib/evgr/Cargo.lock +21 -0
  263. package/dist/lib/evgr/Cargo.toml +19 -0
  264. package/dist/lib/evgr/README.md +140 -0
  265. package/dist/lib/evgr/bench/NativeBench.rgr +246 -0
  266. package/dist/lib/evgr/bench/compare.mjs +252 -0
  267. package/dist/lib/evgr/bench/speed.mjs +277 -0
  268. package/dist/lib/evgr/bin/.gitignore +3 -0
  269. package/dist/lib/evgr/src/bin/bench.rs +106 -0
  270. package/dist/lib/evgr/src/bin/smoke.rs +13 -0
  271. package/dist/lib/evgr/src/grid.rs +730 -0
  272. package/dist/lib/evgr/src/lib.rs +1003 -0
  273. package/dist/lib/evgr/src/style.rs +468 -0
  274. package/dist/lib/evgr/src/text.rs +83 -0
  275. package/dist/lib/image/BitReader.rgr +171 -0
  276. package/dist/lib/image/Buffer.rgr +173 -0
  277. package/dist/lib/image/DCT.rgr +283 -0
  278. package/dist/lib/image/Deflate.rgr +339 -0
  279. package/dist/lib/image/HuffmanDecoder.rgr +181 -0
  280. package/dist/lib/image/ImageBuffer.rgr +706 -0
  281. package/dist/lib/image/JPEGDecoder.rgr +808 -0
  282. package/dist/lib/image/PNGDecoder.rgr +544 -0
  283. package/dist/lib/image/PNGEncoder.rgr +388 -0
  284. package/dist/lib/image/PPMImage.rgr +224 -0
  285. package/dist/lib/image/ProgressiveJPEGDecoder.rgr +1154 -0
  286. package/dist/lib/image/README.md +33 -0
  287. package/dist/lib/image/RasterBuffer.rgr +294 -0
  288. package/dist/lib/image/VP8BoolDecoder.rgr +163 -0
  289. package/dist/lib/image/WebPDecoder.rgr +433 -0
  290. package/dist/lib/image/WebPLossless.rgr +1035 -0
  291. package/dist/lib/image/WebPLossy.rgr +1929 -0
  292. package/dist/lib/image/ranger.json +9 -0
  293. package/dist/lib/image/testdata/webp/anim_2f_24x16.webp +0 -0
  294. package/dist/lib/image/testdata/webp/fixtures.txt +33 -0
  295. package/dist/lib/image/testdata/webp/gen_fixtures.py +261 -0
  296. package/dist/lib/image/testdata/webp/ll_1x1.webp +0 -0
  297. package/dist/lib/image/testdata/webp/ll_alpha_29x21.webp +0 -0
  298. package/dist/lib/image/testdata/webp/ll_gradient_64x64.webp +0 -0
  299. package/dist/lib/image/testdata/webp/ll_meta_32x32.webp +0 -0
  300. package/dist/lib/image/testdata/webp/ll_noise_17x9.webp +0 -0
  301. package/dist/lib/image/testdata/webp/ll_pal11_23x11.webp +0 -0
  302. package/dist/lib/image/testdata/webp/ll_pal2_19x7.webp +0 -0
  303. package/dist/lib/image/testdata/webp/ll_pal40_16x16.webp +0 -0
  304. package/dist/lib/image/testdata/webp/ll_pal4_13x5.webp +0 -0
  305. package/dist/lib/image/testdata/webp/ll_photo_40x30.webp +0 -0
  306. package/dist/lib/image/testdata/webp/ll_predictors_64x32.webp +0 -0
  307. package/dist/lib/image/testdata/webp/ly_1x1.webp +0 -0
  308. package/dist/lib/image/testdata/webp/ly_alph_raw_f0_21x13.webp +0 -0
  309. package/dist/lib/image/testdata/webp/ly_alph_raw_f1_21x13.webp +0 -0
  310. package/dist/lib/image/testdata/webp/ly_alph_raw_f2_21x13.webp +0 -0
  311. package/dist/lib/image/testdata/webp/ly_alph_raw_f3_21x13.webp +0 -0
  312. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f0_21x13.webp +0 -0
  313. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f1_21x13.webp +0 -0
  314. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f2_21x13.webp +0 -0
  315. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f3_21x13.webp +0 -0
  316. package/dist/lib/image/testdata/webp/ly_alpha_33x17.webp +0 -0
  317. package/dist/lib/image/testdata/webp/ly_exif_15x11.webp +0 -0
  318. package/dist/lib/image/testdata/webp/ly_i16_96x80.webp +0 -0
  319. package/dist/lib/image/testdata/webp/ly_nofilter_24x20.webp +0 -0
  320. package/dist/lib/image/testdata/webp/ly_odd_17x9.webp +0 -0
  321. package/dist/lib/image/testdata/webp/ly_photo_48x40.webp +0 -0
  322. package/dist/lib/image/testdata/webp/ly_q100_20x18.webp +0 -0
  323. package/dist/lib/image/testdata/webp/ly_sharp_40x36.webp +0 -0
  324. package/dist/lib/image/testdata/webp/ly_simple_filter_33x31.webp +0 -0
  325. package/dist/lib/image/testdata/webp/ly_vpx_parts8_37x45.webp +0 -0
  326. package/dist/lib/image/testdata/webp/ly_vpx_skip_96x80.webp +0 -0
  327. package/dist/lib/image/tests/WebPDecodeTool.rgr +81 -0
  328. package/dist/lib/image/tests/WebPDecoderTest.rgr +1162 -0
  329. package/dist/lib/image/tests/run_webp_tests.sh +39 -0
  330. package/dist/lib/rust/RsJson.rgr +468 -0
  331. package/dist/lib/rust/RsPrelude.rgr +1663 -0
  332. package/dist/lib/shell_test.rgr +7 -7
  333. package/dist/lib/stdlib.rgr +21 -5
  334. package/dist/lib/zip/ranger.json +6 -0
  335. package/dist/rgrc.js +87318 -67610
  336. package/package.json +1010 -1040
  337. package/dist/README.md +0 -117
  338. package/dist/package.json +0 -47
@@ -0,0 +1,389 @@
1
+ /**
2
+ * The browser, asked what CSS actually does with time.
3
+ *
4
+ * node lib/evg/oracle/css_timing_oracle.mjs
5
+ *
6
+ * Writes `css-timing.json` beside this file. Nothing in EVG reads it at run
7
+ * time; `EVGTimingTest.rgr` is checked against it by hand, the same way the
8
+ * dnd-kit capture works, so a disagreement is a decision someone made rather
9
+ * than a test that quietly moved.
10
+ *
11
+ * Four questions, and the third is the reason this file exists at all:
12
+ *
13
+ * 1. What does each timing function output at a given input progress?
14
+ * Sampled off a real `Animation` rather than a formula, so a keyword's
15
+ * exact control points come from the engine and not from a blog post.
16
+ * 2. Where is a transition with a DELAY during the delay — at the start
17
+ * value, or already moving?
18
+ * 3. When a transition is reversed half way, is the shortened duration a
19
+ * fraction of the INPUT progress or of the EASED OUTPUT progress? The two
20
+ * differ by 20% of the duration on `ease-in` at the midpoint, and the
21
+ * spec's answer is not the one you would guess from the phrase "half way
22
+ * through".
23
+ * 4. Does `transform: rotate()` interpolate as an angle, and about what?
24
+ *
25
+ * Every sample is taken with the animation PAUSED and `currentTime` set by
26
+ * hand. Waiting real milliseconds and reading the result measures the machine's
27
+ * scheduler as much as the engine, and the numbers move between runs.
28
+ */
29
+
30
+ import fs from "node:fs";
31
+ import path from "node:path";
32
+ import { fileURLToPath, pathToFileURL } from "node:url";
33
+ import { requireDom, findChromium, assertDomInstalled } from "../../../gallery/ui/conformance/dom-adapter.mjs";
34
+
35
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
36
+
37
+ const FUNCTIONS = [
38
+ "linear",
39
+ "ease",
40
+ "ease-in",
41
+ "ease-out",
42
+ "ease-in-out",
43
+ "cubic-bezier(0.68, -0.55, 0.27, 1.55)",
44
+ "steps(4, end)",
45
+ "steps(4, start)",
46
+ // Two curves chosen to BREAK a Newton-only solver rather than to look
47
+ // pretty. `cubic-bezier(1, 0, 0, 1)` has a derivative of zero at both ends
48
+ // and near-zero across the middle, and a plain Newton iteration from t = x
49
+ // diverges by six orders of magnitude a hair either side of 0.5 — while
50
+ // landing exactly on 0.5 itself, which is why sampling the round numbers
51
+ // hides it completely.
52
+ "cubic-bezier(1, 0, 0, 1)",
53
+ "cubic-bezier(0.999, 0, 0.001, 1)",
54
+ ];
55
+
56
+ // The awkward values are deliberate. 0.499 and 0.501 straddle the point where
57
+ // a stiff curve's derivative vanishes; 0.05 and 0.95 sit where a solver that
58
+ // gives up at the ends is still plausible-looking in the middle.
59
+ const AT = [0, 0.05, 0.1, 0.2, 0.25, 0.3, 0.4, 0.499, 0.5, 0.501, 0.6, 0.7, 0.75, 0.8, 0.9, 0.95, 1];
60
+
61
+ const PAGE = `<!doctype html><meta charset="utf-8">
62
+ <style>
63
+ #probe { position: absolute; left: 0px; top: 0px; width: 100px; height: 40px;
64
+ background-color: rgb(248, 250, 252); opacity: 1; transform: none; }
65
+ </style>
66
+ <div id="probe"></div>`;
67
+
68
+ async function capture(page) {
69
+ return page.evaluate(
70
+ async ([functions, at]) => {
71
+ const el = document.getElementById("probe");
72
+ const cs = () => getComputedStyle(el);
73
+ const out = {};
74
+
75
+ // --- 1. the timing functions themselves.
76
+ //
77
+ // `left` and not `opacity`: a cubic-bezier whose control points leave
78
+ // [0,1] OVERSHOOTS, and opacity clamps. A clamped sample would report
79
+ // the overshoot as flat and the checker built from it would then accept
80
+ // an implementation that could not overshoot at all.
81
+ out.functions = {};
82
+ for (const easing of functions) {
83
+ const anim = el.animate([{ left: "0px" }, { left: "1000px" }], {
84
+ duration: 1000,
85
+ easing,
86
+ fill: "both",
87
+ });
88
+ anim.pause();
89
+ const samples = [];
90
+ for (const t of at) {
91
+ anim.currentTime = t * 1000;
92
+ samples.push(Number((parseFloat(cs().left) / 1000).toFixed(5)));
93
+ }
94
+ anim.cancel();
95
+ out.functions[easing] = samples;
96
+ }
97
+
98
+ // --- 2. a transition with a delay.
99
+ const bgAt = (spec, from, to, times) => {
100
+ el.style.transition = "none";
101
+ el.style.backgroundColor = from;
102
+ void el.offsetWidth;
103
+ el.style.transition = spec;
104
+ el.style.backgroundColor = to;
105
+ const anim = document.getAnimations().find((a) => a.transitionProperty === "background-color");
106
+ if (!anim) return null;
107
+ anim.pause();
108
+ const rows = times.map((ms) => {
109
+ anim.currentTime = ms;
110
+ return { at: ms, value: cs().backgroundColor };
111
+ });
112
+ anim.cancel();
113
+ el.style.transition = "none";
114
+ return rows;
115
+ };
116
+
117
+ out.delay = {
118
+ spec: "background-color 200ms linear 100ms",
119
+ from: "rgb(0, 0, 0)",
120
+ to: "rgb(200, 200, 200)",
121
+ // The clock a transition's `currentTime` runs on INCLUDES the delay,
122
+ // so 0 and 100 both sit in it and 300 is the end.
123
+ samples: bgAt("background-color 200ms linear 100ms", "rgb(0, 0, 0)", "rgb(200, 200, 200)",
124
+ [0, 50, 100, 150, 200, 250, 300]),
125
+ };
126
+
127
+ // --- 3. reversing a transition part way.
128
+ //
129
+ // Paused and driven by hand for the same reason as everything else here.
130
+ // The number wanted is the DURATION the engine gives the reversed
131
+ // transition, which it reports through `getTiming()`.
132
+ const reverseAfter = (easing, ms, dur) => {
133
+ el.style.transition = "none";
134
+ el.style.backgroundColor = "rgb(0, 0, 0)";
135
+ void el.offsetWidth;
136
+ el.style.transition = `background-color ${dur}ms ${easing}`;
137
+ el.style.backgroundColor = "rgb(255, 255, 255)";
138
+ let anim = document.getAnimations().find((a) => a.transitionProperty === "background-color");
139
+ anim.pause();
140
+ anim.currentTime = ms;
141
+ const atReversal = cs().backgroundColor;
142
+ // Committing the paused value is what makes the reversal start from
143
+ // where the eye is, rather than from where the clock would be once the
144
+ // animation is let go.
145
+ el.style.backgroundColor = "rgb(0, 0, 0)";
146
+ const back = document.getAnimations().find((a) => a.transitionProperty === "background-color");
147
+ const timing = back ? back.effect.getTiming() : null;
148
+ const started = back ? getComputedStyle(el).backgroundColor : null;
149
+ if (back) back.cancel();
150
+ anim.cancel();
151
+ el.style.transition = "none";
152
+ return {
153
+ easing,
154
+ original: dur,
155
+ reversedAt: ms,
156
+ inputProgress: ms / dur,
157
+ valueAtReversal: atReversal,
158
+ reversedDuration: timing ? timing.duration : null,
159
+ reversedDelay: timing ? timing.delay : null,
160
+ startsFrom: started,
161
+ };
162
+ };
163
+
164
+ out.reversal = [
165
+ reverseAfter("linear", 100, 200),
166
+ reverseAfter("ease-in", 100, 200),
167
+ reverseAfter("ease-out", 100, 200),
168
+ reverseAfter("ease", 50, 200),
169
+ ];
170
+
171
+ // Reversing a REVERSAL. The interesting question is whether the
172
+ // shortening compounds naively — halving again to 50ms — or whether the
173
+ // factor is carried and recombined, which would make the third leg
174
+ // LONGER than the second. Guessing this wrong is invisible on a single
175
+ // pass of the pointer and obvious on a jittery one.
176
+ const doubleReverse = (easing, dur, firstAt, secondFraction) => {
177
+ el.style.transition = "none";
178
+ el.style.backgroundColor = "rgb(0, 0, 0)";
179
+ void el.offsetWidth;
180
+ el.style.transition = `background-color ${dur}ms ${easing}`;
181
+ el.style.backgroundColor = "rgb(255, 255, 255)";
182
+ const legs = [];
183
+ let anim = document.getAnimations().find((a) => a.transitionProperty === "background-color");
184
+ anim.pause();
185
+ anim.currentTime = firstAt;
186
+ legs.push({ leg: 1, duration: dur, pausedAt: firstAt, value: cs().backgroundColor });
187
+
188
+ el.style.backgroundColor = "rgb(0, 0, 0)";
189
+ let back = document.getAnimations().find((a) => a.transitionProperty === "background-color");
190
+ back.pause();
191
+ const d2 = back.effect.getTiming().duration;
192
+ back.currentTime = d2 * secondFraction;
193
+ legs.push({ leg: 2, duration: d2, pausedAt: d2 * secondFraction, value: cs().backgroundColor });
194
+
195
+ el.style.backgroundColor = "rgb(255, 255, 255)";
196
+ const fwd = document.getAnimations().find((a) => a.transitionProperty === "background-color");
197
+ const d3 = fwd ? fwd.effect.getTiming().duration : null;
198
+ legs.push({ leg: 3, duration: d3, value: cs().backgroundColor });
199
+ document.getAnimations().forEach((a) => a.cancel());
200
+ el.style.transition = "none";
201
+ return { easing, original: dur, secondFraction, legs };
202
+ };
203
+
204
+ out.doubleReversal = [
205
+ doubleReverse("linear", 200, 100, 0.5),
206
+ doubleReverse("linear", 200, 100, 0.25),
207
+ ];
208
+
209
+ // A delay on a reversal: is the delay shortened by the same factor as
210
+ // the duration, or does the full delay run again?
211
+ out.delayedReversal = (() => {
212
+ el.style.transition = "none";
213
+ el.style.backgroundColor = "rgb(0, 0, 0)";
214
+ void el.offsetWidth;
215
+ el.style.transition = "background-color 200ms linear 100ms";
216
+ el.style.backgroundColor = "rgb(255, 255, 255)";
217
+ const a = document.getAnimations().find((x) => x.transitionProperty === "background-color");
218
+ a.pause();
219
+ a.currentTime = 200; // 100ms of delay + 100ms of the 200ms run
220
+ const at = cs().backgroundColor;
221
+ el.style.backgroundColor = "rgb(0, 0, 0)";
222
+ const b = document.getAnimations().find((x) => x.transitionProperty === "background-color");
223
+ const t = b ? b.effect.getTiming() : null;
224
+ // What the engine REPORTS and what it DOES are two questions. Sample
225
+ // the reversed leg as well, so the delay's fate is settled by the
226
+ // colour on screen rather than by a timing object.
227
+ let samples = null;
228
+ if (b) {
229
+ b.pause();
230
+ samples = [0, 50, 100, 125, 150, 175, 200].map((ms) => {
231
+ b.currentTime = ms;
232
+ return { at: ms, value: cs().backgroundColor };
233
+ });
234
+ }
235
+ document.getAnimations().forEach((x) => x.cancel());
236
+ el.style.transition = "none";
237
+ return {
238
+ spec: "background-color 200ms linear 100ms",
239
+ pausedAt: 200,
240
+ valueAtReversal: at,
241
+ reversedDuration: t ? t.duration : null,
242
+ reversedDelay: t ? t.delay : null,
243
+ reversedSamples: samples,
244
+ };
245
+ })();
246
+
247
+ // --- 3b. fading in from `transparent`
248
+ //
249
+ // `transparent` is rgba(0, 0, 0, 0) — a BLACK with no alpha — so
250
+ // interpolating the four channels independently drags every fade-in
251
+ // through a dark grey before it arrives. CSS avoids that by
252
+ // interpolating in PREMULTIPLIED space, and the difference is visible on
253
+ // any hover that starts from no background at all.
254
+ out.transparentFade = (() => {
255
+ el.style.transition = "none";
256
+ el.style.backgroundColor = "transparent";
257
+ void el.offsetWidth;
258
+ el.style.transition = "background-color 200ms linear";
259
+ el.style.backgroundColor = "rgb(244, 241, 254)";
260
+ const a = document.getAnimations().find((x) => x.transitionProperty === "background-color");
261
+ if (!a) return null;
262
+ a.pause();
263
+ const rows = [0, 50, 100, 150, 200].map((ms) => {
264
+ a.currentTime = ms;
265
+ return { at: ms, value: cs().backgroundColor };
266
+ });
267
+ document.getAnimations().forEach((x) => x.cancel());
268
+ el.style.transition = "none";
269
+ el.style.backgroundColor = "rgb(248, 250, 252)";
270
+ return { from: "transparent", to: "rgb(244, 241, 254)", samples: rows };
271
+ })();
272
+
273
+ // --- 4. transform: rotate
274
+ el.style.transition = "none";
275
+ el.style.transform = "rotate(0deg)";
276
+ void el.offsetWidth;
277
+ const rot = el.animate([{ transform: "rotate(0deg)" }, { transform: "rotate(90deg)" }], {
278
+ duration: 1000,
279
+ easing: "linear",
280
+ fill: "both",
281
+ });
282
+ rot.pause();
283
+ out.rotate = at.map((t) => {
284
+ rot.currentTime = t * 1000;
285
+ return { at: t, matrix: cs().transform };
286
+ });
287
+ rot.cancel();
288
+
289
+ // What a rotation turns about, with no transform-origin set. The
290
+ // rectangle is 100x40 at (0,0); a quarter turn about the CENTRE puts the
291
+ // box somewhere a quarter turn about the corner does not.
292
+ el.style.transform = "rotate(90deg)";
293
+ const r = el.getBoundingClientRect();
294
+ out.rotateOrigin = {
295
+ transformOrigin: cs().transformOrigin,
296
+ boxBefore: { x: 0, y: 0, w: 100, h: 40 },
297
+ boxAfterQuarterTurn: { x: r.x, y: r.y, w: r.width, h: r.height },
298
+ };
299
+ el.style.transform = "none";
300
+
301
+ // --- 5. transform-origin, said every way CSS allows
302
+ //
303
+ // Two questions per case, and they are different questions. What does
304
+ // the engine RESOLVE the origin to (`getComputedStyle` gives it in
305
+ // pixels, so keywords and percentages come back already worked out), and
306
+ // where does the box actually END UP once it is turned about that point.
307
+ // The first can be right while the second is wrong, and only the second
308
+ // is what anyone sees.
309
+ //
310
+ // The single-value forms are the ones worth having in a table. CSS says
311
+ // a lone LENGTH sets x and leaves y at 50%, but a lone `top` or `bottom`
312
+ // is a Y keyword and sets the OTHER axis — so `transform-origin: top`
313
+ // means `50% 0%` and `transform-origin: 10px` means `10px 50%`. Reading
314
+ // "the first value is x" straight off is wrong for exactly the keyword
315
+ // half of the grammar.
316
+ const originCases = [
317
+ "50% 50%", "0 0", "100% 100%", "0% 100%",
318
+ "left top", "right bottom", "center bottom", "top left",
319
+ // Pairs where the two keywords resolve DIFFERENTLY, so the swap rule
320
+ // is observable. `top left` cannot show it: left and top are both 0%,
321
+ // so writing them either way round gives the same point and a swap
322
+ // that never happens looks correct.
323
+ "bottom left", "right top", "top center", "center right",
324
+ "10px 4px", "25% 10px",
325
+ "left", "right", "top", "bottom", "center", "10px", "25%",
326
+ ];
327
+ out.transformOrigin = originCases.map((spec) => {
328
+ el.style.transition = "none";
329
+ el.style.transformOrigin = spec;
330
+ el.style.transform = "none";
331
+ void el.offsetWidth;
332
+ const resolved = cs().transformOrigin;
333
+ el.style.transform = "rotate(90deg)";
334
+ const b = el.getBoundingClientRect();
335
+ el.style.transform = "none";
336
+ return {
337
+ spec,
338
+ resolved,
339
+ boxAfterQuarterTurn: { x: b.x, y: b.y, w: b.width, h: b.height },
340
+ };
341
+ });
342
+ el.style.transformOrigin = "";
343
+
344
+ // Is transform-origin itself animatable, and how does it interpolate
345
+ // between two percentages?
346
+ out.originTransition = (() => {
347
+ el.style.transition = "none";
348
+ el.style.transformOrigin = "0% 0%";
349
+ void el.offsetWidth;
350
+ el.style.transition = "transform-origin 200ms linear";
351
+ el.style.transformOrigin = "100% 100%";
352
+ const a = document.getAnimations().find((x) => x.transitionProperty === "transform-origin");
353
+ if (!a) {
354
+ el.style.transition = "none";
355
+ el.style.transformOrigin = "";
356
+ return { animatable: false };
357
+ }
358
+ a.pause();
359
+ const rows = [0, 50, 100, 150, 200].map((ms) => {
360
+ a.currentTime = ms;
361
+ return { at: ms, resolved: cs().transformOrigin };
362
+ });
363
+ document.getAnimations().forEach((x) => x.cancel());
364
+ el.style.transition = "none";
365
+ el.style.transformOrigin = "";
366
+ return { animatable: true, from: "0% 0%", to: "100% 100%", samples: rows };
367
+ })();
368
+
369
+ return out;
370
+ },
371
+ [FUNCTIONS, AT],
372
+ );
373
+ }
374
+
375
+ assertDomInstalled();
376
+ const { chromium } = requireDom("playwright-core");
377
+ const browser = await chromium.launch({ executablePath: findChromium() });
378
+ const page = await browser.newPage();
379
+ await page.setContent(PAGE);
380
+ const data = await capture(page);
381
+ const version = await page.evaluate(() => navigator.userAgent);
382
+ await browser.close();
383
+
384
+ const file = path.join(HERE, "css-timing.json");
385
+ fs.writeFileSync(file, JSON.stringify({ capturedFrom: version, ...data }, null, 2) + "\n");
386
+ console.log("wrote " + path.relative(process.cwd(), file));
387
+ console.log(JSON.stringify(data.doubleReversal, null, 2));
388
+ console.log(JSON.stringify(data.delayedReversal, null, 2));
389
+ console.log(JSON.stringify(data.rotateOrigin, null, 2));
@@ -0,0 +1,310 @@
1
+ Import "EVGColorContext.clj"
2
+
3
+ class EVGColor {
4
+
5
+ def is_set:boolean true
6
+ def r:double 0.0
7
+ def g:double 0.0
8
+ def b:double 0.0
9
+ def a:double 1.0
10
+
11
+ sfn m@(main):void () {
12
+ def c (new EVGColor)
13
+ c.testFn()
14
+ }
15
+
16
+ fn testFn:void () {
17
+ def colors (new EVGColor)
18
+ def c (EVGColor.hslToRgb( 195.0 100.0 50.0))
19
+ print "RGB of 30 20 10 = " + c.r + "," + c.g + "," + c.b
20
+
21
+ def c (new EVGColor)
22
+ c.fromString("hsl( 195 100.20 50)")
23
+ print "parsed value = (" + (c.red()) + ", " + (c.green()) + ", " + (c.blue()) + " )"
24
+ c.fromString("hsl( 43 100 56)")
25
+ print "parsed value = (" + (c.red()) + ", " + (c.green()) + ", " + (c.blue()) + " )"
26
+ c.fromString("rgb( 43 100 56)")
27
+ print "parsed value = (" + (c.red()) + ", " + (c.green()) + ", " + (c.blue()) + " )"
28
+ c.fromString("rgba( 43 100 56 0.4)")
29
+ print "parsed value = (" + (c.red()) + ", " + (c.green()) + ", " + (c.blue()) + " " + (c.alpha()) + " )"
30
+
31
+ def ctx (new EVGColorContext)
32
+ def redCol (ctx.byName("red"))
33
+ print "Red color is " + (redCol.toCSSString())
34
+ def blueCol (ctx.byName("blue"))
35
+ print "Blue color is " + (blueCol.toCSSString())
36
+ }
37
+
38
+ sfn noColor:EVGColor () {
39
+ def c (new EVGColor)
40
+ c.is_set = false
41
+ return c
42
+ }
43
+
44
+ fn toCSSString:string () {
45
+ if (is_set == false) {
46
+ return "none"
47
+ }
48
+ if( a < 1.0) {
49
+ return ("rgba(" + (this.red()) + "," + (this.green()) + "," + (this.blue()) + ", " + (this.alpha()) + ")" )
50
+ }
51
+ return ("rgb(" + (this.red()) + "," + (this.green()) + "," + (this.blue()) + ")" )
52
+ }
53
+
54
+ fn alpha:double () {
55
+ if( a < 0.0 ) {
56
+ return 0.0
57
+ }
58
+ if ( a > 1.0 ) {
59
+ return 1.0
60
+ }
61
+ return a
62
+ }
63
+ fn red:int () {
64
+ if(r > 255.00) {
65
+ return 255
66
+ }
67
+ if(r < 0.0) {
68
+ return 0
69
+ }
70
+ return (to_int r)
71
+ }
72
+ fn green:int () {
73
+ if(g > 255.00) {
74
+ return 255
75
+ }
76
+ if(g < 0.0) {
77
+ return 0
78
+ }
79
+ return (to_int g)
80
+ }
81
+ fn blue:int () {
82
+ if(b > 255.00) {
83
+ return 255
84
+ }
85
+ if(b < 0.0) {
86
+ return 0
87
+ }
88
+ return (to_int b)
89
+ }
90
+
91
+ sfn hue2rgb:double ( p:double q:double tt:double) {
92
+ def t tt
93
+ if(t < 0.0) {
94
+ t = t + 1.0
95
+ }
96
+ if(t > 1.0) {
97
+ t = t - 1.0
98
+ }
99
+ if(t < (1.0/6.0)) {
100
+ return ( p + (q - p ) * 6.0 * t)
101
+ }
102
+ if(t < (1.0/2.0)) {
103
+ return q
104
+ }
105
+ if(t < (2.0/3.0)) {
106
+ return ( p + (q - p ) * (2.0 / 3.0 - t) * 6.0)
107
+ }
108
+ return p
109
+ }
110
+ sfn hslToRgb:EVGColor (hh:double ss:double ll:double) {
111
+ def r 0.0
112
+ def g 0.0
113
+ def b 0.0
114
+
115
+ def h (hh / 360.0)
116
+ def s (ss / 100.0)
117
+ def l (ll / 100.0)
118
+ if( s == 0.0) {
119
+ r = l
120
+ g = r
121
+ b = r
122
+ } {
123
+ def q (? ( l < 0.5 ) l (l + s - l * s))
124
+ def p ( 2.0 * l - q)
125
+ r = (EVGColor.hue2rgb( p q (h + 1.0/3.0)))
126
+ g = (EVGColor.hue2rgb( p q h))
127
+ b = (EVGColor.hue2rgb( p q (h - 1.0/3.0)))
128
+ }
129
+ def rv (new EVGColor )
130
+ rv.r = r * 255.00
131
+ rv.g = g * 255.00
132
+ rv.b = b * 255.00
133
+ return rv
134
+ }
135
+
136
+ fn copyFrom (col:EVGColor) {
137
+ r = col.r
138
+ g = col.g
139
+ b = col.b
140
+ a = col.a
141
+ is_set = col.is_set
142
+ }
143
+
144
+ fn fromString:void ( str:string ) {
145
+
146
+ def buff:charbuffer (to_charbuffer str)
147
+ def i:int 0
148
+ def last_number:double 0.0
149
+ def len (length buff)
150
+
151
+ def skipSpace (fn:void () {
152
+ while(i < len) {
153
+ def c (charAt buff i)
154
+ if( ( c <= 32) || ( c == (ccode ",")) ) {
155
+ i = i + 1
156
+ } {
157
+ break
158
+ }
159
+ }
160
+ })
161
+ def scanNumber (fn:boolean () {
162
+ def s:charbuffer buff
163
+ def fc:char (charAt s i)
164
+ def c:char fc
165
+ def sp:int 0
166
+ def ep:int 0
167
+ fc = (charAt s i)
168
+ if (((fc == 45) && (((charAt s (i + 1))) >= 46) && (((charAt s (i + 1))) <= 57)) || ((fc >= 48) && (fc <= 57))) {
169
+ sp = i
170
+ i = 1 + i
171
+ c = (charAt s i)
172
+ while ((i < len) && (((c >= 48) && (c <= 57)) || (c == ((ccode "."))) || ((i == sp) && ((c == ((ccode "+"))) || (c == ((ccode "-"))))))) {
173
+ i = 1 + i
174
+ if (i >= len) {
175
+ break
176
+ }
177
+ c = (charAt s i)
178
+ }
179
+ ep = i
180
+ last_number = (unwrap (str2double ((substring s sp ep))))
181
+ return true
182
+ }
183
+ return false
184
+ })
185
+ if(len > 4) {
186
+ if( ((ccode "r" ) == (charAt buff 0)) &&
187
+ ((ccode "g" ) == (charAt buff 1)) &&
188
+ ((ccode "b" ) == (charAt buff 2)) &&
189
+ ((ccode "a" ) == (charAt buff 3)) &&
190
+ ((ccode "(" ) == (charAt buff 4)) ) {
191
+ i = i + 5
192
+ skipSpace()
193
+ def h:double 0.0
194
+ def s:double 0.0
195
+ def l:double 0.0
196
+ def a_lpha 0.0
197
+ def cnt 0
198
+ if( scanNumber () ) {
199
+ h = last_number
200
+ cnt = cnt + 1
201
+ }
202
+ skipSpace()
203
+ if( scanNumber () ) {
204
+ s = last_number
205
+ cnt = cnt + 1
206
+ }
207
+ skipSpace()
208
+ if( scanNumber () ) {
209
+ l = last_number
210
+ cnt = cnt + 1
211
+ }
212
+ skipSpace()
213
+ if( scanNumber () ) {
214
+ a_lpha = last_number
215
+ cnt = cnt + 1
216
+ }
217
+ if ( cnt == 4 ) {
218
+ r = h
219
+ g = s
220
+ b = l
221
+ a = a_lpha
222
+ is_set = true
223
+ return
224
+ }
225
+ }
226
+ if( ((ccode "r" ) == (charAt buff 0)) &&
227
+ ((ccode "g" ) == (charAt buff 1)) &&
228
+ ((ccode "b" ) == (charAt buff 2)) &&
229
+ ((ccode "(" ) == (charAt buff 3)) ) {
230
+ i = i + 4
231
+ skipSpace()
232
+ def h:double 0.0
233
+ def s:double 0.0
234
+ def l:double 0.0
235
+ def cnt 0
236
+ if( scanNumber () ) {
237
+ h = last_number
238
+ cnt = cnt + 1
239
+ }
240
+ skipSpace()
241
+ if( scanNumber () ) {
242
+ s = last_number
243
+ cnt = cnt + 1
244
+ }
245
+ skipSpace()
246
+ if( scanNumber () ) {
247
+ l = last_number
248
+ cnt = cnt + 1
249
+ }
250
+ if ( cnt == 3 ) {
251
+ r = h
252
+ g = s
253
+ b = l
254
+ a = 1.0
255
+ is_set = true
256
+ return
257
+ }
258
+ }
259
+
260
+ if( ((ccode "h" ) == (charAt buff 0)) &&
261
+ ((ccode "s" ) == (charAt buff 1)) &&
262
+ ((ccode "l" ) == (charAt buff 2)) &&
263
+ ((ccode "(" ) == (charAt buff 3)) ) {
264
+ i = i + 4
265
+ skipSpace()
266
+ def h:double 0.0
267
+ def s:double 0.0
268
+ def l:double 0.0
269
+ def cnt 0
270
+ if( scanNumber () ) {
271
+ h = last_number
272
+ cnt = cnt + 1
273
+ }
274
+ skipSpace()
275
+ if( scanNumber () ) {
276
+ s = last_number
277
+ cnt = cnt + 1
278
+ }
279
+ skipSpace()
280
+ if( scanNumber () ) {
281
+ l = last_number
282
+ cnt = cnt + 1
283
+ }
284
+ if ( cnt == 3 ) {
285
+ def rr ( EVGColor.hslToRgb( h s l) )
286
+ this.copyFrom( rr )
287
+ is_set = true
288
+ return
289
+ }
290
+ }
291
+ }
292
+ }
293
+ }
294
+
295
+ class EVGColorStop {
296
+ def is_set false
297
+ def is_linear true
298
+ def x 0.0
299
+ def y 0.0
300
+ def percentage 0.0
301
+ def color:EVGColor (new EVGColor)
302
+ }
303
+
304
+ class EVGGradientColor {
305
+ def is_set false
306
+ def is_linear false
307
+ def degree 0.0
308
+ def stops:[EVGColorStop]
309
+ }
310
+