Compare commits

...
Author SHA1 Message Date
Oliver Davies eb618004c6 Initial working versions of decimate and vectorize 2025-10-05 15:23:18 -07:00
Firestar99 074a33f58f Enable debug logging for cargo-gpu (#3207)
debug cargo-gpu: debug logging
2025-10-05 11:19:21 +00:00
Keavon Chambers 593a89f2e2 Update content throughout the website (#3252) 2025-10-04 00:47:56 +00:00
Oliver DaviesandKeavon Chambers 3cfacccc61 New node: Remap (#3245)
* Added Remap node

* Addressed feedback for mapping range

* Removed extra defaults

* Apply suggestion from @Keavon

---------

Co-authored-by: Keavon Chambers <[email protected]>
2025-10-03 05:51:01 +00:00
Timon 7e8c6cc432 Desktop: Native export (#3188)
* Testing native export with raster convert implementation

* Jpg export

* Fix transparent export

* move texture conversion to runtime

* fixup

* move image encoding into editor export  function

* remove unused frontend message

* remove unused type
2025-10-01 21:13:40 +02:00
Dennis Kobert c697b61a7e Clean up execution context for skipped node graph submissions (#3233) 2025-10-01 10:13:59 +00:00
Dennis Kobert bc66148d2b Reset the overlay context for each draw request and use global font cache (#3231) 2025-09-28 15:36:08 +00:00
Dennis Kobert 84e44810d2 Run preprocessing on benchmarks and fix deadlock (#3230) 2025-09-27 12:36:29 +02:00
Dennis KobertandTimon Schelling ffc74273cc Implement Convert trait to convert between CPU and GPU images (#3194)
* Add upload texture trait

* Make convert trait use explicit converter

* Add gpu texture download implementation

* Add footprint to convert trait

* Cleanup texture upload / download

* Download wgpu textures aligned

* abstract texture download into converter helper

* rename module

not only doing uploads anymore
conversion looks like a ok name

* Remove into_iter call and intermediate vector allocation

---------

Co-authored-by: Timon Schelling <[email protected]>
2025-09-26 14:30:01 +02:00
Timon 4bb1d05fc3 Desktop: Add taskbar icon on Windows (#3225)
* include icon as resource on windows

* load icon
2025-09-26 14:30:01 +02:00
TimonandDennis Kobert d06c8164e1 Desktop: Forward multi-clicks (double/triple/etc.-clicks) to CEF correctly (#3224)
* fix multiclick

* Revert "fix multiclick"

This reverts commit c4130d12ee.

* try another way

* use copy

* Use struct initializer syntax fror click tracker (#3226)

---------

Co-authored-by: Dennis Kobert <[email protected]>
2025-09-26 14:29:56 +02:00
Timon ed22e6a63d Desktop: Add rudimentary support for custom WGPU adapter selection (#3201)
* rudimentary custom wgpu adapter selection

* WgpuContextBuilder

* wasm fix

* fix wasm warnings

* Clean up

* Review suggestions

* fix
2025-09-25 14:38:26 +00:00
Dennis Kobert 4e47b5db93 Restructure gcore/text module and fix memory leak (#3221)
* Restructure gcore/text module and fix memory leak

* Remove unused import

* Fix default font fallback causing wrong caching and rename to TextContext

* Upgrade demo art
2025-09-25 15:29:07 +02:00
Timon d595089bb0 Desktop: Fix maximized window extending outside the screen on Windows (#3210)
Desktop: Fix window extending outside the screen on windows when maximized
2025-09-25 15:22:05 +02:00
Timon 04a2452333 Desktop: Support cursor icon change (#3223)
* browser console message forwarding

* replace target to make it easy to identify browser console messages

* use warn as per review comment

* cursor icon change

* fix win build
2025-09-25 11:23:19 +00:00
Timon b4be616de0 Desktop: Browser console message forwarding (#3193)
* browser console message forwarding

* replace target to make it easy to identify browser console messages

* use warn as per review comment
2025-09-25 10:42:07 +00:00
Timon d15f63f4fd Ensure the LoadPreferences message is dispatched with None when no preferences exist (#3198)
* preference load message on default load

* review fixup
2025-09-23 20:19:16 +00:00
Timon 21f34ab19a Desktop: Enable window resize controls on Wayland compositors (#3183)
wayland client side decorations
2025-09-21 12:17:05 +00:00
Timon 09bc891ab2 Desktop: Forward the pointer leave event to CEF (#3197)
* pointer leave

* make one-liner
2025-09-21 10:23:51 +00:00
Timon 46d5928724 Desktop: Fix window maximize and minimize (#3200)
Fix window maximize and minimize state
2025-09-20 23:48:47 +00:00
Keavon Chambers f4a0f272dd Add note about the September 2025 release to the editor welcome screen 2025-09-20 05:20:20 -07:00
Keavon Chambers ac4665683b Blog post: Graphite community meetup in Germany 2025-09-20 01:59:05 -07:00
Salman Abuhaimed edc018d7b4 Fix Text node regression where font styles within a family are not being applied (#3186)
Fix text node styles not being applied
2025-09-18 19:11:50 -07:00
Keavon Chambers 9d15e56ce1 Fix and clean up typing-related flaws with the Math category of nodes 2025-09-18 16:37:01 -07:00
Keavon Chambers 7e3ab78ea4 Fix more flaws with 'Transform' node rad-to-deg migration; make 'Tangent on Path' also use degrees by default 2025-09-18 14:09:10 -07:00
98 changed files with 2741 additions and 942 deletions

No files matched your search

Generated
+327 -44
View File
@@ -33,12 +33,24 @@ dependencies = [
"gimli", "gimli",
] ]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "adler2" name = "adler2"
version = "2.0.1" version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "adler32"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.12" version = "0.8.12"
@@ -124,6 +136,15 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.20" version = "0.6.20"
@@ -405,6 +426,17 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.5.0" version = "1.5.0"
@@ -421,7 +453,7 @@ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
"nom", "nom",
"num-rational", "num-rational 0.4.2",
"v_frame", "v_frame",
] ]
@@ -443,7 +475,7 @@ dependencies = [
"addr2line", "addr2line",
"cfg-if", "cfg-if",
"libc", "libc",
"miniz_oxide", "miniz_oxide 0.8.9",
"object", "object",
"rustc-demangle", "rustc-demangle",
"windows-targets 0.52.6", "windows-targets 0.52.6",
@@ -470,9 +502,15 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
dependencies = [ dependencies = [
"bit-vec", "bit-vec 0.8.0",
] ]
[[package]]
name = "bit-vec"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]] [[package]]
name = "bit-vec" name = "bit-vec"
version = "0.8.0" version = "0.8.0"
@@ -652,7 +690,7 @@ source = "git+https://github.com/rust-gpu/cargo-gpu?rev=f969528e87baa17a7d48eecf
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_metadata", "cargo_metadata",
"clap", "clap 4.5.46",
"crossterm", "crossterm",
"directories", "directories",
"env_logger", "env_logger",
@@ -685,7 +723,7 @@ dependencies = [
"serde-untagged", "serde-untagged",
"serde-value", "serde-value",
"thiserror 2.0.16", "thiserror 2.0.16",
"toml", "toml 0.8.23",
"unicode-xid", "unicode-xid",
"url", "url",
] ]
@@ -814,6 +852,21 @@ dependencies = [
"half", "half",
] ]
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap",
"unicode-width 0.1.14",
"vec_map",
]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.46" version = "4.5.46"
@@ -833,7 +886,7 @@ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
"clap_lex", "clap_lex",
"strsim", "strsim 0.11.1",
] ]
[[package]] [[package]]
@@ -871,7 +924,7 @@ checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
dependencies = [ dependencies = [
"serde", "serde",
"termcolor", "termcolor",
"unicode-width", "unicode-width 0.2.1",
] ]
[[package]] [[package]]
@@ -930,7 +983,7 @@ dependencies = [
"encode_unicode", "encode_unicode",
"libc", "libc",
"once_cell", "once_cell",
"unicode-width", "unicode-width 0.2.1",
"windows-sys 0.60.2", "windows-sys 0.60.2",
] ]
@@ -1044,7 +1097,7 @@ dependencies = [
"anes", "anes",
"cast", "cast",
"ciborium", "ciborium",
"clap", "clap 4.5.46",
"criterion-plot", "criterion-plot",
"itertools 0.13.0", "itertools 0.13.0",
"num-traits", "num-traits",
@@ -1161,6 +1214,16 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
[[package]]
name = "deflate"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
dependencies = [
"adler32",
"byteorder",
]
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.4.0" version = "0.4.0"
@@ -1302,7 +1365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de5f62da6c2850fd20cdefef7dd5389121869a88de8af3fda5a20bc849eafdd" checksum = "8de5f62da6c2850fd20cdefef7dd5389121869a88de8af3fda5a20bc849eafdd"
dependencies = [ dependencies = [
"bzip2", "bzip2",
"clap", "clap 4.5.46",
"indicatif", "indicatif",
"regex", "regex",
"semver", "semver",
@@ -1317,7 +1380,7 @@ dependencies = [
[[package]] [[package]]
name = "dpi" name = "dpi"
version = "0.1.2" version = "0.1.2"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -1497,7 +1560,7 @@ dependencies = [
"bit_field", "bit_field",
"half", "half",
"lebe", "lebe",
"miniz_oxide", "miniz_oxide 0.8.9",
"rayon-core", "rayon-core",
"smallvec", "smallvec",
"zune-inflate", "zune-inflate",
@@ -1517,6 +1580,9 @@ name = "fastrand"
version = "2.3.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
dependencies = [
"getrandom 0.2.16",
]
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
@@ -1562,7 +1628,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide 0.8.9",
]
[[package]]
name = "flo_curves"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c227ffb4f98baa9073c033e23243089d0ed3dd1f5cd620894452074db48a29b"
dependencies = [
"itertools 0.8.2",
"roots 0.0.6",
"smallvec",
] ]
[[package]] [[package]]
@@ -1882,6 +1959,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "gif"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
dependencies = [
"color_quant",
"weezl",
]
[[package]] [[package]]
name = "gif" name = "gif"
version = "0.13.3" version = "0.13.3"
@@ -2060,7 +2147,7 @@ name = "graphene-cli"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap 4.5.46",
"fern", "fern",
"futures", "futures",
"graph-craft", "graph-craft",
@@ -2085,7 +2172,7 @@ dependencies = [
"dyn-any", "dyn-any",
"glam", "glam",
"graphene-core-shaders", "graphene-core-shaders",
"image", "image 0.25.6",
"kurbo", "kurbo",
"log", "log",
"lyon_geom", "lyon_geom",
@@ -2103,6 +2190,8 @@ dependencies = [
"specta", "specta",
"tinyvec", "tinyvec",
"tokio", "tokio",
"visioncortex",
"vtracer",
"wgpu", "wgpu",
] ]
@@ -2163,7 +2252,7 @@ dependencies = [
"graphene-core", "graphene-core",
"graphene-core-shaders", "graphene-core-shaders",
"graphene-raster-nodes-shaders", "graphene-raster-nodes-shaders",
"image", "image 0.25.6",
"kurbo", "kurbo",
"ndarray", "ndarray",
"node-macro", "node-macro",
@@ -2184,6 +2273,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"cargo-gpu", "cargo-gpu",
"env_logger", "env_logger",
"log",
] ]
[[package]] [[package]]
@@ -2208,7 +2298,7 @@ dependencies = [
"graphene-path-bool", "graphene-path-bool",
"graphene-raster-nodes", "graphene-raster-nodes",
"graphene-svg-renderer", "graphene-svg-renderer",
"image", "image 0.25.6",
"log", "log",
"node-macro", "node-macro",
"reqwest", "reqwest",
@@ -2267,6 +2357,7 @@ dependencies = [
"wgpu", "wgpu",
"windows", "windows",
"winit", "winit",
"winres",
] ]
[[package]] [[package]]
@@ -2285,7 +2376,7 @@ dependencies = [
"graph-craft", "graph-craft",
"graphene-std", "graphene-std",
"graphite-editor", "graphite-editor",
"image", "image 0.25.6",
"ron", "ron",
"serde", "serde",
"thiserror 2.0.16", "thiserror 2.0.16",
@@ -2309,6 +2400,7 @@ dependencies = [
"graph-craft", "graph-craft",
"graphene-std", "graphene-std",
"graphite-proc-macros", "graphite-proc-macros",
"image 0.25.6",
"interpreted-executor", "interpreted-executor",
"js-sys", "js-sys",
"kurbo", "kurbo",
@@ -2419,6 +2511,15 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.5.2" version = "0.5.2"
@@ -2737,6 +2838,25 @@ dependencies = [
"icu_properties", "icu_properties",
] ]
[[package]]
name = "image"
version = "0.23.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"gif 0.11.4",
"jpeg-decoder 0.1.22",
"num-iter",
"num-rational 0.3.2",
"num-traits",
"png 0.16.8",
"scoped_threadpool",
"tiff 0.6.1",
]
[[package]] [[package]]
name = "image" name = "image"
version = "0.25.6" version = "0.25.6"
@@ -2747,15 +2867,15 @@ dependencies = [
"byteorder-lite", "byteorder-lite",
"color_quant", "color_quant",
"exr", "exr",
"gif", "gif 0.13.3",
"image-webp 0.2.4", "image-webp 0.2.4",
"num-traits", "num-traits",
"png", "png 0.17.16",
"qoi", "qoi",
"ravif", "ravif",
"rayon", "rayon",
"rgb", "rgb",
"tiff", "tiff 0.9.1",
"zune-core", "zune-core",
"zune-jpeg", "zune-jpeg",
] ]
@@ -2829,7 +2949,7 @@ checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd"
dependencies = [ dependencies = [
"console", "console",
"portable-atomic", "portable-atomic",
"unicode-width", "unicode-width 0.2.1",
"unit-prefix", "unit-prefix",
"web-time", "web-time",
] ]
@@ -2886,6 +3006,7 @@ dependencies = [
"iai-callgrind", "iai-callgrind",
"log", "log",
"once_cell", "once_cell",
"preprocessor",
"serde", "serde",
"wgpu-executor", "wgpu-executor",
] ]
@@ -2942,6 +3063,15 @@ version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "itertools"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.12.1" version = "0.12.1"
@@ -3022,6 +3152,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "jpeg-decoder"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
dependencies = [
"rayon",
]
[[package]] [[package]]
name = "jpeg-decoder" name = "jpeg-decoder"
version = "0.3.2" version = "0.3.2"
@@ -3325,6 +3464,25 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
dependencies = [
"adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.8.9" version = "0.8.9"
@@ -3573,6 +3731,28 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "num-iter"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-rational" name = "num-rational"
version = "0.4.2" version = "0.4.2"
@@ -3937,11 +4117,11 @@ dependencies = [
"criterion", "criterion",
"glam", "glam",
"glob", "glob",
"image", "image 0.25.6",
"lyon_geom", "lyon_geom",
"regex", "regex",
"resvg", "resvg",
"roots", "roots 0.0.8",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"slotmap", "slotmap",
"smallvec", "smallvec",
@@ -4120,6 +4300,18 @@ dependencies = [
"plotters-backend", "plotters-backend",
] ]
[[package]]
name = "png"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
dependencies = [
"bitflags 1.3.2",
"crc32fast",
"deflate",
"miniz_oxide 0.3.7",
]
[[package]] [[package]]
name = "png" name = "png"
version = "0.17.16" version = "0.17.16"
@@ -4130,7 +4322,7 @@ dependencies = [
"crc32fast", "crc32fast",
"fdeflate", "fdeflate",
"flate2", "flate2",
"miniz_oxide", "miniz_oxide 0.8.9",
] ]
[[package]] [[package]]
@@ -4141,7 +4333,7 @@ checksum = "b5bd19146350fe804f7cb2669c851c03d69da628803dab0d98018142aaa5d829"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"concurrent-queue", "concurrent-queue",
"hermit-abi", "hermit-abi 0.5.2",
"pin-project-lite", "pin-project-lite",
"rustix", "rustix",
"windows-sys 0.60.2", "windows-sys 0.60.2",
@@ -4669,7 +4861,7 @@ version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a325d5e8d1cebddd070b13f44cec8071594ab67d1012797c121f27a669b7958" checksum = "4a325d5e8d1cebddd070b13f44cec8071594ab67d1012797c121f27a669b7958"
dependencies = [ dependencies = [
"gif", "gif 0.13.3",
"image-webp 0.1.3", "image-webp 0.1.3",
"log", "log",
"pico-args", "pico-args",
@@ -4740,6 +4932,12 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "roots"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84348444bd7ad45729d0c49a4240d7cdc11c9d512c06c5ad1835c1ad4acda6db"
[[package]] [[package]]
name = "roots" name = "roots"
version = "0.0.8" version = "0.0.8"
@@ -4937,6 +5135,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scoped_threadpool"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@@ -5326,7 +5530,7 @@ version = "0.9.0"
source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f"
dependencies = [ dependencies = [
"cargo_metadata", "cargo_metadata",
"clap", "clap 4.5.46",
"log", "log",
"memchr", "memchr",
"notify", "notify",
@@ -5390,6 +5594,12 @@ dependencies = [
"float-cmp", "float-cmp",
] ]
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.11.1" version = "0.11.1"
@@ -5550,7 +5760,7 @@ dependencies = [
"cfg-expr", "cfg-expr",
"heck", "heck",
"pkg-config", "pkg-config",
"toml", "toml 0.8.23",
"version-compare", "version-compare",
] ]
@@ -5593,6 +5803,15 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width 0.1.14",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.69" version = "1.0.69"
@@ -5642,6 +5861,17 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "tiff"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437"
dependencies = [
"jpeg-decoder 0.1.22",
"miniz_oxide 0.4.4",
"weezl",
]
[[package]] [[package]]
name = "tiff" name = "tiff"
version = "0.9.1" version = "0.9.1"
@@ -5649,7 +5879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [ dependencies = [
"flate2", "flate2",
"jpeg-decoder", "jpeg-decoder 0.3.2",
"weezl", "weezl",
] ]
@@ -5695,7 +5925,7 @@ dependencies = [
"bytemuck", "bytemuck",
"cfg-if", "cfg-if",
"log", "log",
"png", "png 0.17.16",
"tiny-skia-path", "tiny-skia-path",
] ]
@@ -5816,6 +6046,15 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.23" version = "0.8.23"
@@ -6077,6 +6316,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.2.1" version = "0.2.1"
@@ -6248,6 +6493,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "vello" name = "vello"
version = "0.5.0" version = "0.5.0"
@@ -6257,7 +6508,7 @@ dependencies = [
"futures-intrusive", "futures-intrusive",
"log", "log",
"peniko", "peniko",
"png", "png 0.17.16",
"skrifa 0.31.3", "skrifa 0.31.3",
"static_assertions", "static_assertions",
"thiserror 2.0.16", "thiserror 2.0.16",
@@ -6302,6 +6553,29 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "visioncortex"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dbe154fc281d74b2322adc18de7f9bbb9c4318d58ef6c201007f3fd99df9fff"
dependencies = [
"bit-vec 0.6.3",
"flo_curves",
"log",
"num-traits",
]
[[package]]
name = "vtracer"
version = "0.6.4"
source = "git+https://github.com/otdavies/vtracer?rev=31a8b270f6ff825955cf3af888eae6fbfd36e146#31a8b270f6ff825955cf3af888eae6fbfd36e146"
dependencies = [
"clap 2.34.0",
"fastrand",
"image 0.23.14",
"visioncortex",
]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.5.0" version = "2.5.0"
@@ -6613,7 +6887,7 @@ checksum = "f7b882196f8368511d613c6aeec80655160db6646aebddf8328879a88d54e500"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
"bit-vec", "bit-vec 0.8.0",
"bitflags 2.9.3", "bitflags 2.9.3",
"bytemuck", "bytemuck",
"cfg_aliases", "cfg_aliases",
@@ -7134,7 +7408,7 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]] [[package]]
name = "winit" name = "winit"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"cfg_aliases", "cfg_aliases",
@@ -7161,7 +7435,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-android" name = "winit-android"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"android-activity", "android-activity",
"bitflags 2.9.3", "bitflags 2.9.3",
@@ -7176,7 +7450,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-appkit" name = "winit-appkit"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"block2", "block2",
@@ -7198,7 +7472,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-common" name = "winit-common"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"memmap2", "memmap2",
"objc2", "objc2",
@@ -7213,7 +7487,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-core" name = "winit-core"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"cursor-icon", "cursor-icon",
@@ -7228,7 +7502,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-orbital" name = "winit-orbital"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"dpi", "dpi",
@@ -7243,7 +7517,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-uikit" name = "winit-uikit"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"block2", "block2",
@@ -7264,7 +7538,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-wayland" name = "winit-wayland"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"ahash", "ahash",
"bitflags 2.9.3", "bitflags 2.9.3",
@@ -7290,7 +7564,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-web" name = "winit-web"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"atomic-waker", "atomic-waker",
"bitflags 2.9.3", "bitflags 2.9.3",
@@ -7312,7 +7586,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-win32" name = "winit-win32"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"cursor-icon", "cursor-icon",
@@ -7328,7 +7602,7 @@ dependencies = [
[[package]] [[package]]
name = "winit-x11" name = "winit-x11"
version = "0.30.12" version = "0.30.12"
source = "git+https://github.com/rust-windowing/winit.git?rev=66283a79bddd034c45fb0e72c84fa5cd4e5f82fb#66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad"
dependencies = [ dependencies = [
"bitflags 2.9.3", "bitflags 2.9.3",
"bytemuck", "bytemuck",
@@ -7357,6 +7631,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "winres"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml 0.5.11",
]
[[package]] [[package]]
name = "wit-bindgen" name = "wit-bindgen"
version = "0.45.0" version = "0.45.0"
+14 -6
View File
@@ -56,14 +56,17 @@ default-members = [
] ]
resolver = "2" resolver = "2"
[patch.crates-io]
vtracer = { git = "https://github.com/otdavies/vtracer", rev = "31a8b270f6ff825955cf3af888eae6fbfd36e146" }
[workspace.dependencies] [workspace.dependencies]
# Local dependencies # Local dependencies
dyn-any = { path = "libraries/dyn-any", features = [ dyn-any = { path = "libraries/dyn-any", features = [
"derive", "derive",
"glam", "glam",
"reqwest", "reqwest",
"log-bad-types", "log-bad-types",
"rc", "rc",
] } ] }
preprocessor = { path = "node-graph/preprocessor" } preprocessor = { path = "node-graph/preprocessor" }
math-parser = { path = "libraries/math-parser" } math-parser = { path = "libraries/math-parser" }
@@ -132,7 +135,7 @@ web-sys = { version = "=0.3.77", features = [
"HtmlImageElement", "HtmlImageElement",
"ImageBitmapRenderingContext", "ImageBitmapRenderingContext",
] } ] }
winit = { git = "https://github.com/rust-windowing/winit.git", rev = "66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" } winit = { git = "https://github.com/rust-windowing/winit.git", rev = "37221c7192ef1deec022a2278e54429331c01bad" }
url = "2.5" url = "2.5"
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt"] } tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt"] }
vello = { git = "https://github.com/linebender/vello.git", rev = "87cc5bee6d3a34d15017dbbb58634ddc7f33ff9b" } # TODO switch back to stable when a release is made vello = { git = "https://github.com/linebender/vello.git", rev = "87cc5bee6d3a34d15017dbbb58634ddc7f33ff9b" } # TODO switch back to stable when a release is made
@@ -195,9 +198,14 @@ open = "5.3"
poly-cool = "0.3" poly-cool = "0.3"
spin = "0.10" spin = "0.10"
clap = "4.5" clap = "4.5"
# Set compile type to rlib for wasm compatibility
visioncortex = { version = "0.8.8" }
vtracer = { version = "0.6.4" }
spirv-std = { git = "https://github.com/rust-gpu/rust-gpu", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] } spirv-std = { git = "https://github.com/rust-gpu/rust-gpu", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] }
cargo-gpu = { git = "https://github.com/rust-gpu/cargo-gpu", rev = "f969528e87baa17a7d48eecf4a6fcfdcaaf30566" } cargo-gpu = { git = "https://github.com/rust-gpu/cargo-gpu", rev = "f969528e87baa17a7d48eecf4a6fcfdcaaf30566" }
[workspace.lints.rust] [workspace.lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] } unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"imLine truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"imLine truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.3237704918032787,{"red":1.0,"green":0.0,"blue":1.0,"alpha":0.1}],[0.5655737704918032,{"red":0.8901961,"green":0.8117647,"blue":0.39215687,"alpha":1.0}],[0.8155737704918032,{"red":0.0,"green":1.0,"blue":1.0,"alpha":0.5}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.3237704918032787,{"red":1.0,"green":0.0,"blue":1.0,"alpha":0.1}],[0.5655737704918032,{"red":0.8901961,"green":0.8117647,"blue":0.39215687,"alpha":1.0}],[0.8155737704918032,{"red":0.0,"green":1.0,"blue":1.0,"alpha":0.5}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[18118267825025549699,[642.0740740740741,0.0]],[6379137305818664393,[625.4814814814813,0.0]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[6351696498298648253,[646.8148148148149,0.0]],[10625296323957562985,[473.4814814814815,272.5925925925926]],[13357220652574593654,[574.2222222222222,108.44444444444449]],[301778328144628917,[493.5149940383244,200.29629629629628]],[15992617814592812350,[621.0370370370368,0.0]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[533731991408535384,[501.6296296296296,175.40740740740742]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[318560030360358929,17863574903157697896],[11346538709718766144,13357220652574593654],[13662059715350867364,6379137305818664393],[3710133387837274291,15992617814592812350],[12035095010819582754,18118267825025549699],[2035327810332855521,533731991408535384],[3303411878775644985,301778328144628917],[8661113083384527971,10625296323957562985],[10146665273368938971,6351696498298648253],[3384102572540409881,18442321214082298093],[8462655819889292900,4691860614575868200]],"end_point":[[11346538709718766144,15992617814592812350],[3303411878775644985,10625296323957562985],[8661113083384527971,533731991408535384],[3384102572540409881,18118267825025549699],[12035095010819582754,6351696498298648253],[2035327810332855521,13357220652574593654],[8462655819889292900,301778328144628917],[318560030360358929,4691860614575868200],[10146665273368938971,17863574903157697896],[13662059715350867364,18442321214082298093],[3710133387837274291,6379137305818664393]],"handle_primary":[[11346538709718766144,[9.925839724176626,-9.951533978271286]],[8462655819889292900,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[3303411878775644985,[0.0,0.0]],[10146665273368938971,[0.0,0.0]],[318560030360358929,[-46.95465552079859,46.40007297527743]],[3384102572540409881,[0.0,0.0]],[3710133387837274291,[0.0,0.0]],[13662059715350867364,[0.0,0.0]]],"handle_end":[[8661113083384527971,[-42.34888386913234,41.180638796880466]],[12035095010819582754,[0.0,0.0]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[11346538709718766144,[1.1377781018271662,63.71555518874077]],[318560030360358929,[-97.48148148148152,-81.18518518518522]],[10146665273368938971,[48.16592595101224,-47.597037061827145]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[3710133387837274291,[0.0,0.0]],[13662059715350867364,[68.68148181185177,-54.8859262904691]],[3384102572540409881,[0.5807410754567854,77.36888852918523]]],"stroke":[[8661113083384527971,0],[2035327810332855521,0],[13662059715350867364,0],[12035095010819582754,0],[11346538709718766144,0],[318560030360358929,0],[8462655819889292900,0],[3710133387837274291,0],[3303411878775644985,0],[10146665273368938971,0],[3384102572540409881,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}],[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[533731991408535384,[501.6296296296296,175.40740740740742]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[18118267825025549699,[642.0740740740741,0.0]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[15992617814592812350,[621.0370370370368,0.0]],[13357220652574593654,[574.2222222222222,108.44444444444449]],[301778328144628917,[493.5149940383244,200.29629629629628]],[10625296323957562985,[473.4814814814815,272.5925925925926]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[6351696498298648253,[646.8148148148149,0.0]],[6379137305818664393,[625.4814814814813,0.0]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[3303411878775644985,301778328144628917],[318560030360358929,17863574903157697896],[3384102572540409881,18442321214082298093],[12035095010819582754,18118267825025549699],[13662059715350867364,6379137305818664393],[11346538709718766144,13357220652574593654],[8462655819889292900,4691860614575868200],[2035327810332855521,533731991408535384],[3710133387837274291,15992617814592812350],[10146665273368938971,6351696498298648253],[8661113083384527971,10625296323957562985]],"end_point":[[8661113083384527971,533731991408535384],[12035095010819582754,6351696498298648253],[10146665273368938971,17863574903157697896],[2035327810332855521,13357220652574593654],[8462655819889292900,301778328144628917],[3384102572540409881,18118267825025549699],[3303411878775644985,10625296323957562985],[318560030360358929,4691860614575868200],[3710133387837274291,6379137305818664393],[13662059715350867364,18442321214082298093],[11346538709718766144,15992617814592812350]],"handle_primary":[[3384102572540409881,[0.0,0.0]],[8462655819889292900,[0.0,0.0]],[3710133387837274291,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[10146665273368938971,[0.0,0.0]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[3303411878775644985,[0.0,0.0]],[13662059715350867364,[0.0,0.0]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[318560030360358929,[-46.95465552079859,46.40007297527743]],[11346538709718766144,[9.925839724176626,-9.951533978271286]]],"handle_end":[[318560030360358929,[-97.48148148148152,-81.18518518518522]],[13662059715350867364,[68.68148181185177,-54.8859262904691]],[11346538709718766144,[1.1377781018271662,63.71555518874077]],[3384102572540409881,[0.5807410754567854,77.36888852918523]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[3710133387837274291,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[8661113083384527971,[-42.34888386913234,41.180638796880466]],[10146665273368938971,[48.16592595101224,-47.597037061827145]]],"stroke":[[318560030360358929,0],[3303411878775644985,0],[8661113083384527971,0],[13662059715350867364,0],[12035095010819582754,0],[11346538709718766144,0],[8462655819889292900,0],[3710133387837274291,0],[10146665273368938971,0],[3384102572540409881,0],[2035327810332855521,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}],[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[1,[-103.55555555555554,126.66666666666664]],[18,[145.77777777777777,-97.7777777777778]],[12,[199.5555555555555,10.666666666666629]],[22,[71.11111111111109,-201.7777777777778]],[19,[90.66666666666664,-129.33333333333334]],[4,[18.66666666666663,157.77777777777771]],[15,[111.11111111111114,-60.888888888888914]],[17,[123.99999999999994,-84.00000000000003]],[11,[136.88888888888886,39.111111111111086]],[20,[128.4444444444444,-142.22222222222223]],[16,[159.5555555555555,-75.55555555555557]],[5,[66.22222222222223,152.88888888888886]],[24,[57.77777777777777,-129.33333333333334]],[33,[-78.22222222222223,75.55555555555554]],[10,[216.4444444444444,72.4444444444444]],[8,[252.4444444444444,124.88888888888886]],[9,[156.4444444444444,97.33333333333331]],[3,[45.77777777777777,145.33333333333331]],[32,[9.333333333333314,38.66666666666663]],[28,[39.111111111111086,-58.22222222222226]],[7,[229.33333333333331,152.4444444444444]],[26,[22.66666666666663,-81.33333333333337]],[31,[-53.33333333333337,13.777777777777771]],[27,[-11.111111111111144,-72.00000000000003]],[14,[183.11111111111103,-19.111111111111143]],[6,[123.99999999999994,148.4444444444444]],[23,[19.555555555555543,-139.55555555555557]],[30,[-9.333333333333371,0.0]],[29,[-32.888888888888914,-14.666666666666686]],[25,[0.8888888888888573,-94.66666666666669]],[34,[-5.333333333333371,99.11111111111109]],[21,[76.0,-202.22222222222223]],[2,[-67.55555555555554,158.22222222222217]],[13,[153.77777777777777,-1.3333333333333712]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[7,7],[3,3],[8,8],[10,10],[13,13],[11,11],[31,31],[25,25],[18,18],[34,34],[27,27],[12,12],[22,22],[19,19],[32,32],[5,5],[3Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[18,[145.77777777777777,-97.7777777777778]],[15,[111.11111111111114,-60.888888888888914]],[32,[9.333333333333314,38.66666666666663]],[27,[-11.111111111111144,-72.00000000000003]],[17,[123.99999999999994,-84.00000000000003]],[29,[-32.888888888888914,-14.666666666666686]],[30,[-9.333333333333371,0.0]],[14,[183.11111111111103,-19.111111111111143]],[19,[90.66666666666664,-129.33333333333334]],[1,[-103.55555555555554,126.66666666666664]],[25,[0.8888888888888573,-94.66666666666669]],[33,[-78.22222222222223,75.55555555555554]],[5,[66.22222222222223,152.88888888888886]],[3,[45.77777777777777,145.33333333333331]],[23,[19.555555555555543,-139.55555555555557]],[26,[22.66666666666663,-81.33333333333337]],[34,[-5.333333333333371,99.11111111111109]],[13,[153.77777777777777,-1.3333333333333712]],[8,[252.4444444444444,124.88888888888886]],[31,[-53.33333333333337,13.777777777777771]],[10,[216.4444444444444,72.4444444444444]],[12,[199.5555555555555,10.666666666666629]],[6,[123.99999999999994,148.4444444444444]],[24,[57.77777777777777,-129.33333333333334]],[7,[229.33333333333331,152.4444444444444]],[11,[136.88888888888886,39.111111111111086]],[20,[128.4444444444444,-142.22222222222223]],[28,[39.111111111111086,-58.22222222222226]],[4,[18.66666666666663,157.77777777777771]],[22,[71.11111111111109,-201.7777777777778]],[9,[156.4444444444444,97.33333333333331]],[21,[76.0,-202.22222222222223]],[16,[159.5555555555555,-75.55555555555557]],[2,[-67.55555555555554,158.22222222222217]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[16,16],[29,29],[7,7],[14,14],[22,22],[20,20],[24,24],[25,25],[32,32],[23,23],[33,33],[26,26],[2,2],[13,13],[18,18],[8,8],Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[2,[644.0,726.6666666666666]],[1,[258.00000000000006,994.6666666666664]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::vector::vector_modification::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[1,[823.2222222222221,660.4444444444445]],[8,[746.0000000000001,842.9999999999999]],[2,[745.5,826.0]],[3,[707.5,1026.5]],[6,[725.7777777777779,1026.370370370371]],[4,[709.5555555555554,1026.6666666666667]],[5,[740.4444444444443,857.1111111111111]],[7,[727.5555555555554,1026.6666666666663]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[4,4],[3,3],[1,1],[2,2],[7,7],[5,5],[8,8],[6,6]],"end_point":[[4,5],[8,1],[5,6],[7,8],[6,7],[2,3],[3,4],[1,2]],"handle_primary":[[4,[0.0,0.0]],[7,[0.0,0.0]],[1,[0.0,0.0]],[2,[-24.5,85.0]],[6,[0.0,0.0]],[8,[17.33333333333337,-84.99999999999989]],[5,[0.0,0.0]],[3,[0.0,0.0]]],"handle_end":[[5,[-7.555555555555884,-59.25925925925992]],[8,[1.772016460905547,0.9591220850479658]],[2,[0.0,0.0]],[4,[-23.11111111111109,90.44444444444456]],[7,[-26.8034437596026,131.4399645903585]],[1,[24.5,-85.0]],[6,[0.0,0.0]],[3,[0.0,0.0]]],"stroke":[[3,0],[5,0],[2,0],[4,0Line truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[2,[644.0,726.6666666666666]],[1,[258.00000000000006,994.6666666666664]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::vector::vector_modification::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[7,[727.5555555555554,1026.6666666666663]],[3,[707.5,1026.5]],[5,[740.4444444444443,857.1111111111111]],[1,[823.2222222222221,660.4444444444445]],[8,[746.0000000000001,842.9999999999999]],[6,[725.7777777777779,1026.370370370371]],[4,[709.5555555555554,1026.6666666666667]],[2,[745.5,826.0]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[8,8],[5,5],[1,1],[7,7],[2,2],[3,3],[6,6],[4,4]],"end_point":[[6,7],[7,8],[4,5],[5,6],[3,4],[1,2],[8,1],[2,3]],"handle_primary":[[3,[0.0,0.0]],[2,[-24.5,85.0]],[5,[0.0,0.0]],[4,[0.0,0.0]],[1,[0.0,0.0]],[6,[0.0,0.0]],[7,[0.0,0.0]],[8,[17.33333333333337,-84.99999999999989]]],"handle_end":[[8,[1.772016460905547,0.9591220850479658]],[2,[0.0,0.0]],[3,[0.0,0.0]],[7,[-26.8034437596026,131.4399645903585]],[5,[-7.555555555555884,-59.25925925925992]],[1,[24.5,-85.0]],[6,[0.0,0.0]],[4,[-23.11111111111109,90.44444444444456]]],"stroke":[[1,0],[7,0],[3,0],[8,0Line truncated
+1 -1
View File
@@ -1 +1 @@
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}},"exposed":false}}],"call_argument":{"ConcretLine truncated {"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}},"exposed":false}}],"call_argument":{"ConcretLine truncated
+6 -2
View File
@@ -26,7 +26,7 @@ graphite-desktop-wrapper = { path = "wrapper" }
graphite-desktop-embedded-resources = { path = "embedded-resources", optional = true } graphite-desktop-embedded-resources = { path = "embedded-resources", optional = true }
wgpu = { workspace = true } wgpu = { workspace = true }
winit = { workspace = true, features = [ "serde" ] } winit = { workspace = true, features = [ "wayland-csd-adwaita-notitlebar", "serde" ] }
thiserror = { workspace = true } thiserror = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
cef = { workspace = true } cef = { workspace = true }
@@ -48,7 +48,7 @@ serde = { workspace = true }
ash = { version = "0.38", optional = true } ash = { version = "0.38", optional = true }
# Windows-specific dependencies # Windows-specific dependencies
[target.'cfg(windows)'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.58.0", features = [ windows = { version = "0.58.0", features = [
"Win32_Foundation", "Win32_Foundation",
"Win32_Graphics_Direct3D11", "Win32_Graphics_Direct3D11",
@@ -60,6 +60,7 @@ windows = { version = "0.58.0", features = [
"Win32_System_LibraryLoader", "Win32_System_LibraryLoader",
"Win32_UI_Controls", "Win32_UI_Controls",
"Win32_UI_WindowsAndMessaging", "Win32_UI_WindowsAndMessaging",
"Win32_UI_HiDpi",
], optional = true } ], optional = true }
# macOS-specific dependencies # macOS-specific dependencies
@@ -71,3 +72,6 @@ core-foundation = { version = "0.9", optional = true }
# Linux-specific dependencies # Linux-specific dependencies
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
libc = { version = "0.2", optional = true } libc = { version = "0.2", optional = true }
[target.'cfg(target_os = "windows")'.build-dependencies]
winres = "0.1"
Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

+8
View File
@@ -0,0 +1,8 @@
fn main() {
#[cfg(target_os = "windows")]
{
let mut res = winres::WindowsResource::new();
res.set_icon("assets/graphite-icon-color.ico");
res.compile().expect("Failed to compile Windows resources");
}
}
+19 -6
View File
@@ -166,10 +166,15 @@ impl App {
graphics_state.set_overlays_scene(scene); graphics_state.set_overlays_scene(scene);
} }
} }
DesktopFrontendMessage::UpdateWindowState { maximized, minimized } => { DesktopFrontendMessage::MinimizeWindow => {
if let Some(window) = &self.window { if let Some(window) = &self.window {
window.set_minimized(true);
}
}
DesktopFrontendMessage::MaximizeWindow => {
if let Some(window) = &self.window {
let maximized = !window.is_maximized();
window.set_maximized(maximized); window.set_maximized(maximized);
window.set_minimized(minimized);
} }
} }
DesktopFrontendMessage::DragWindow => { DesktopFrontendMessage::DragWindow => {
@@ -231,10 +236,9 @@ impl App {
self.persistent_data.write_preferences(preferences); self.persistent_data.write_preferences(preferences);
} }
DesktopFrontendMessage::PersistenceLoadPreferences => { DesktopFrontendMessage::PersistenceLoadPreferences => {
if let Some(preferences) = self.persistent_data.load_preferences() { let preferences = self.persistent_data.load_preferences();
let message = DesktopWrapperMessage::LoadPreferences { preferences }; let message = DesktopWrapperMessage::LoadPreferences { preferences };
self.dispatch_desktop_wrapper_message(message); self.dispatch_desktop_wrapper_message(message);
}
} }
} }
} }
@@ -301,6 +305,11 @@ impl App {
self.cef_schedule = Some(instant); self.cef_schedule = Some(instant);
} }
} }
AppEvent::CursorChange(cursor) => {
if let Some(window) = &self.window {
window.set_cursor(cursor);
}
}
AppEvent::CloseWindow => { AppEvent::CloseWindow => {
// TODO: Implement graceful shutdown // TODO: Implement graceful shutdown
@@ -352,6 +361,10 @@ impl ApplicationHandler for App {
WindowEvent::SurfaceResized(size) => { WindowEvent::SurfaceResized(size) => {
let _ = self.cef_window_size_sender.send(size.into()); let _ = self.cef_window_size_sender.send(size.into());
self.cef_context.notify_of_resize(); self.cef_context.notify_of_resize();
if let Some(window) = &self.window {
let maximized = window.is_maximized();
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateMaximized { maximized }));
}
} }
WindowEvent::RedrawRequested => { WindowEvent::RedrawRequested => {
let Some(ref mut graphics_state) = self.graphics_state else { return }; let Some(ref mut graphics_state) = self.graphics_state else { return };
+5
View File
@@ -44,6 +44,7 @@ pub(crate) trait CefEventHandler: Clone + Send + Sync + 'static {
#[cfg(feature = "accelerated_paint")] #[cfg(feature = "accelerated_paint")]
fn draw_gpu(&self, shared_texture: SharedTextureHandle); fn draw_gpu(&self, shared_texture: SharedTextureHandle);
fn load_resource(&self, path: PathBuf) -> Option<Resource>; fn load_resource(&self, path: PathBuf) -> Option<Resource>;
fn cursor_change(&self, cursor: winit::cursor::Cursor);
/// Schedule the main event loop to run the CEF event loop after the timeout. /// Schedule the main event loop to run the CEF event loop after the timeout.
/// See [`_cef_browser_process_handler_t::on_schedule_message_pump_work`] for more documentation. /// See [`_cef_browser_process_handler_t::on_schedule_message_pump_work`] for more documentation.
fn schedule_cef_message_loop_work(&self, scheduled_time: Instant); fn schedule_cef_message_loop_work(&self, scheduled_time: Instant);
@@ -224,6 +225,10 @@ impl CefEventHandler for CefHandler {
None None
} }
fn cursor_change(&self, cursor: winit::cursor::Cursor) {
self.app_event_scheduler.schedule(AppEvent::CursorChange(cursor));
}
fn schedule_cef_message_loop_work(&self, scheduled_time: std::time::Instant) { fn schedule_cef_message_loop_work(&self, scheduled_time: std::time::Instant) {
self.app_event_scheduler.schedule(AppEvent::ScheduleBrowserWork(scheduled_time)); self.app_event_scheduler.schedule(AppEvent::ScheduleBrowserWork(scheduled_time));
} }
+58 -43
View File
@@ -11,14 +11,20 @@ use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, SCROLL_LINE_H
pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputState, event: &WindowEvent) { pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputState, event: &WindowEvent) {
match event { match event {
WindowEvent::PointerMoved { position, .. } => { WindowEvent::PointerMoved { position, .. } | WindowEvent::PointerEntered { position, .. } => {
input_state.cursor_move(position); input_state.cursor_move(position);
let Some(host) = browser.host() else { let Some(host) = browser.host() else { return };
return;
};
host.send_mouse_move_event(Some(&input_state.into()), 0); host.send_mouse_move_event(Some(&input_state.into()), 0);
} }
WindowEvent::PointerLeft { position, .. } => {
if let Some(position) = position {
input_state.cursor_move(position);
}
let Some(host) = browser.host() else { return };
host.send_mouse_move_event(Some(&input_state.into()), 1);
}
WindowEvent::PointerButton { state, button, .. } => { WindowEvent::PointerButton { state, button, .. } => {
let mouse_button = match button { let mouse_button = match button {
ButtonSource::Mouse(mouse_button) => mouse_button, ButtonSource::Mouse(mouse_button) => mouse_button,
@@ -39,9 +45,7 @@ pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputStat
_ => return, //TODO: Handle Forward and Back button _ => return, //TODO: Handle Forward and Back button
}; };
let Some(host) = browser.host() else { let Some(host) = browser.host() else { return };
return;
};
host.send_mouse_click_event(Some(&input_state.into()), cef_button, cef_mouse_up, cef_click_count); host.send_mouse_click_event(Some(&input_state.into()), cef_button, cef_mouse_up, cef_click_count);
} }
WindowEvent::MouseWheel { delta, phase: _, device_id: _, .. } => { WindowEvent::MouseWheel { delta, phase: _, device_id: _, .. } => {
@@ -53,9 +57,7 @@ pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputStat
delta_x *= SCROLL_SPEED_X; delta_x *= SCROLL_SPEED_X;
delta_y *= SCROLL_SPEED_Y; delta_y *= SCROLL_SPEED_Y;
let Some(host) = browser.host() else { let Some(host) = browser.host() else { return };
return;
};
host.send_mouse_wheel_event(Some(&mouse_event), delta_x as i32, delta_y as i32); host.send_mouse_wheel_event(Some(&mouse_event), delta_x as i32, delta_y as i32);
} }
WindowEvent::ModifiersChanged(modifiers) => { WindowEvent::ModifiersChanged(modifiers) => {
@@ -95,9 +97,7 @@ pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputStat
key_event.native_key_code = native_key_code; key_event.native_key_code = native_key_code;
let Some(host) = browser.host() else { let Some(host) = browser.host() else { return };
return;
};
match event.state { match event.state {
ElementState::Pressed => { ElementState::Pressed => {
@@ -151,7 +151,7 @@ impl InputState {
fn mouse_input(&mut self, button: &MouseButton, state: &ElementState) -> ClickCount { fn mouse_input(&mut self, button: &MouseButton, state: &ElementState) -> ClickCount {
self.mouse_state.update(button, state); self.mouse_state.update(button, state);
self.mouse_click_tracker.input(button, state, &self.mouse_position) self.mouse_click_tracker.input(button, state, self.mouse_position)
} }
fn cef_modifiers(&self, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> CefModifiers { fn cef_modifiers(&self, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> CefModifiers {
@@ -187,7 +187,7 @@ impl From<&mut InputState> for MouseEvent {
} }
} }
#[derive(Default, Clone)] #[derive(Default, Clone, Copy)]
pub(crate) struct MousePosition { pub(crate) struct MousePosition {
x: usize, x: usize,
y: usize, y: usize,
@@ -233,7 +233,7 @@ struct ClickTracker {
right: Option<ClickRecord>, right: Option<ClickRecord>,
} }
impl ClickTracker { impl ClickTracker {
fn input(&mut self, button: &MouseButton, state: &ElementState, position: &MousePosition) -> ClickCount { fn input(&mut self, button: &MouseButton, state: &ElementState, position: MousePosition) -> ClickCount {
let record = match button { let record = match button {
MouseButton::Left => &mut self.left, MouseButton::Left => &mut self.left,
MouseButton::Right => &mut self.right, MouseButton::Right => &mut self.right,
@@ -241,53 +241,56 @@ impl ClickTracker {
_ => return ClickCount::Single, _ => return ClickCount::Single,
}; };
let now = Instant::now();
let Some(record) = record else { let Some(record) = record else {
*record = Some(ClickRecord { *record = Some(ClickRecord { position, ..Default::default() });
time: now,
position: position.clone(),
down_count: ClickCount::Single,
up_count: ClickCount::Single,
});
return ClickCount::Single; return ClickCount::Single;
}; };
let previous = record.time;
let now = Instant::now();
record.time = now;
record.position = position;
match state {
ElementState::Pressed if record.down_count == ClickCount::Double => {
*record = ClickRecord {
down_count: ClickCount::Single,
..*record
};
return ClickCount::Single;
}
ElementState::Released if record.up_count == ClickCount::Double => {
*record = ClickRecord {
up_count: ClickCount::Single,
..*record
};
return ClickCount::Single;
}
_ => {}
}
let dx = position.x.abs_diff(record.position.x); let dx = position.x.abs_diff(record.position.x);
let dy = position.y.abs_diff(record.position.y); let dy = position.y.abs_diff(record.position.y);
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL; let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
let within_time = now.saturating_duration_since(record.time) <= MULTICLICK_TIMEOUT; let within_time = now.saturating_duration_since(previous) <= MULTICLICK_TIMEOUT;
let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single }; let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single };
*record = match state { *record = match state {
ElementState::Pressed => ClickRecord { ElementState::Pressed => ClickRecord { down_count: count, ..*record },
time: now, ElementState::Released => ClickRecord { up_count: count, ..*record },
position: position.clone(),
down_count: count.clone(),
up_count: record.up_count.clone(),
},
ElementState::Released => ClickRecord {
time: now,
position: position.clone(),
down_count: record.down_count.clone(),
up_count: count.clone(),
},
}; };
count count
} }
} }
#[derive(Clone)] #[derive(Clone, Copy, PartialEq, Default)]
enum ClickCount { enum ClickCount {
#[default]
Single, Single,
Double, Double,
} }
impl Default for ClickCount {
fn default() -> Self {
Self::Single
}
}
impl From<ClickCount> for i32 { impl From<ClickCount> for i32 {
fn from(count: ClickCount) -> i32 { fn from(count: ClickCount) -> i32 {
match count { match count {
@@ -297,6 +300,7 @@ impl From<ClickCount> for i32 {
} }
} }
#[derive(Clone, Copy)]
struct ClickRecord { struct ClickRecord {
time: Instant, time: Instant,
position: MousePosition, position: MousePosition,
@@ -304,6 +308,17 @@ struct ClickRecord {
up_count: ClickCount, up_count: ClickCount,
} }
impl Default for ClickRecord {
fn default() -> Self {
Self {
time: Instant::now(),
position: Default::default(),
down_count: Default::default(),
up_count: Default::default(),
}
}
}
struct CefModifiers(u32); struct CefModifiers(u32);
impl CefModifiers { impl CefModifiers {
fn new(input_state: &InputState, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> Self { fn new(input_state: &InputState, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> Self {
+2
View File
@@ -10,6 +10,8 @@ mod render_process_v8_handler;
mod resource_handler; mod resource_handler;
mod scheme_handler_factory; mod scheme_handler_factory;
mod display_handler;
pub(super) mod render_handler; pub(super) mod render_handler;
pub(super) mod task; pub(super) mod task;
@@ -1,23 +1,26 @@
use cef::rc::{Rc, RcImpl}; use cef::rc::{Rc, RcImpl};
use cef::sys::{_cef_client_t, cef_base_ref_counted_t}; use cef::sys::{_cef_client_t, cef_base_ref_counted_t};
use cef::{ImplClient, LifeSpanHandler, RenderHandler, WrapClient}; use cef::{DisplayHandler, ImplClient, LifeSpanHandler, RenderHandler, WrapClient};
use crate::cef::CefEventHandler; use crate::cef::CefEventHandler;
use crate::cef::ipc::{MessageType, UnpackMessage, UnpackedMessage}; use crate::cef::ipc::{MessageType, UnpackMessage, UnpackedMessage};
use super::browser_process_life_span_handler::BrowserProcessLifeSpanHandlerImpl; use super::browser_process_life_span_handler::BrowserProcessLifeSpanHandlerImpl;
use super::display_handler::DisplayHandlerImpl;
pub(crate) struct BrowserProcessClientImpl<H: CefEventHandler> { pub(crate) struct BrowserProcessClientImpl<H: CefEventHandler> {
object: *mut RcImpl<_cef_client_t, Self>, object: *mut RcImpl<_cef_client_t, Self>,
render_handler: RenderHandler, render_handler: RenderHandler,
event_handler: H, event_handler: H,
display_handler: DisplayHandler,
} }
impl<H: CefEventHandler> BrowserProcessClientImpl<H> { impl<H: CefEventHandler> BrowserProcessClientImpl<H> {
pub(crate) fn new(render_handler: RenderHandler, event_handler: H) -> Self { pub(crate) fn new(render_handler: RenderHandler, event_handler: H) -> Self {
Self { Self {
object: std::ptr::null_mut(), object: std::ptr::null_mut(),
render_handler, render_handler,
event_handler, event_handler: event_handler.clone(),
display_handler: DisplayHandler::new(DisplayHandlerImpl::new(event_handler)),
} }
} }
} }
@@ -57,6 +60,10 @@ impl<H: CefEventHandler> ImplClient for BrowserProcessClientImpl<H> {
Some(LifeSpanHandler::new(BrowserProcessLifeSpanHandlerImpl::new())) Some(LifeSpanHandler::new(BrowserProcessLifeSpanHandlerImpl::new()))
} }
fn display_handler(&self) -> Option<cef::DisplayHandler> {
Some(self.display_handler.clone())
}
fn get_raw(&self) -> *mut _cef_client_t { fn get_raw(&self) -> *mut _cef_client_t {
self.object.cast() self.object.cast()
} }
@@ -72,6 +79,7 @@ impl<H: CefEventHandler> Clone for BrowserProcessClientImpl<H> {
object: self.object, object: self.object,
render_handler: self.render_handler.clone(), render_handler: self.render_handler.clone(),
event_handler: self.event_handler.clone(), event_handler: self.event_handler.clone(),
display_handler: self.display_handler.clone(),
} }
} }
} }
+136
View File
@@ -0,0 +1,136 @@
use cef::rc::{Rc, RcImpl};
use cef::sys::{_cef_display_handler_t, cef_base_ref_counted_t, cef_cursor_type_t::*, cef_log_severity_t::*};
use cef::{CefString, ImplDisplayHandler, WrapDisplayHandler};
use winit::cursor::CursorIcon;
use crate::cef::CefEventHandler;
pub(crate) struct DisplayHandlerImpl<H: CefEventHandler> {
object: *mut RcImpl<_cef_display_handler_t, Self>,
event_handler: H,
}
impl<H: CefEventHandler> DisplayHandlerImpl<H> {
pub fn new(event_handler: H) -> Self {
Self {
object: std::ptr::null_mut(),
event_handler,
}
}
}
impl<H: CefEventHandler> ImplDisplayHandler for DisplayHandlerImpl<H> {
fn on_cursor_change(&self, _browser: Option<&mut cef::Browser>, _cursor: cef::CursorHandle, cursor_type: cef::CursorType, _custom_cursor_info: Option<&cef::CursorInfo>) -> ::std::os::raw::c_int {
let cursor = match cursor_type.into() {
CT_POINTER => CursorIcon::Default,
CT_CROSS => CursorIcon::Crosshair,
CT_HAND => CursorIcon::Pointer,
CT_IBEAM => CursorIcon::Text,
CT_WAIT => CursorIcon::Wait,
CT_HELP => CursorIcon::Help,
CT_EASTRESIZE => CursorIcon::EResize,
CT_NORTHRESIZE => CursorIcon::NResize,
CT_NORTHEASTRESIZE => CursorIcon::NeResize,
CT_NORTHWESTRESIZE => CursorIcon::NwResize,
CT_SOUTHRESIZE => CursorIcon::SResize,
CT_SOUTHEASTRESIZE => CursorIcon::SeResize,
CT_SOUTHWESTRESIZE => CursorIcon::SwResize,
CT_WESTRESIZE => CursorIcon::WResize,
CT_NORTHSOUTHRESIZE => CursorIcon::NsResize,
CT_EASTWESTRESIZE => CursorIcon::EwResize,
CT_NORTHEASTSOUTHWESTRESIZE => CursorIcon::NeswResize,
CT_NORTHWESTSOUTHEASTRESIZE => CursorIcon::NwseResize,
CT_COLUMNRESIZE => CursorIcon::ColResize,
CT_ROWRESIZE => CursorIcon::RowResize,
CT_MIDDLEPANNING => CursorIcon::AllScroll,
CT_EASTPANNING => CursorIcon::AllScroll,
CT_NORTHPANNING => CursorIcon::AllScroll,
CT_NORTHEASTPANNING => CursorIcon::AllScroll,
CT_NORTHWESTPANNING => CursorIcon::AllScroll,
CT_SOUTHPANNING => CursorIcon::AllScroll,
CT_SOUTHEASTPANNING => CursorIcon::AllScroll,
CT_SOUTHWESTPANNING => CursorIcon::AllScroll,
CT_WESTPANNING => CursorIcon::AllScroll,
CT_MOVE => CursorIcon::Move,
CT_VERTICALTEXT => CursorIcon::VerticalText,
CT_CELL => CursorIcon::Cell,
CT_CONTEXTMENU => CursorIcon::ContextMenu,
CT_ALIAS => CursorIcon::Alias,
CT_PROGRESS => CursorIcon::Progress,
CT_NODROP => CursorIcon::NoDrop,
CT_COPY => CursorIcon::Copy,
CT_NONE => CursorIcon::Default,
CT_NOTALLOWED => CursorIcon::NotAllowed,
CT_ZOOMIN => CursorIcon::ZoomIn,
CT_ZOOMOUT => CursorIcon::ZoomOut,
CT_GRAB => CursorIcon::Grab,
CT_GRABBING => CursorIcon::Grabbing,
CT_MIDDLE_PANNING_VERTICAL => CursorIcon::AllScroll,
CT_MIDDLE_PANNING_HORIZONTAL => CursorIcon::AllScroll,
CT_CUSTOM => CursorIcon::Default,
CT_DND_NONE => CursorIcon::Default,
CT_DND_MOVE => CursorIcon::Move,
CT_DND_COPY => CursorIcon::Copy,
CT_DND_LINK => CursorIcon::Alias,
CT_NUM_VALUES => CursorIcon::Default,
_ => CursorIcon::Default,
};
self.event_handler.cursor_change(cursor.into());
1 // We handled the cursor change.
}
fn on_console_message(
&self,
_browser: Option<&mut cef::Browser>,
level: cef::LogSeverity,
message: Option<&CefString>,
source: Option<&CefString>,
line: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int {
let message = message.map(|m| m.to_string()).unwrap_or_default();
let source = source.map(|s| s.to_string()).unwrap_or_default();
let line = line as i64;
let browser_source = format!("{source}:{line}");
static BROWSER: &str = "browser";
match level.as_ref() {
LOGSEVERITY_FATAL | LOGSEVERITY_ERROR => tracing::error!(target: BROWSER, "{browser_source} {message}"),
LOGSEVERITY_WARNING => tracing::warn!(target: BROWSER, "{browser_source} {message}"),
LOGSEVERITY_INFO => tracing::info!(target: BROWSER, "{browser_source} {message}"),
LOGSEVERITY_DEFAULT | LOGSEVERITY_VERBOSE => tracing::debug!(target: BROWSER, "{browser_source} {message}"),
_ => tracing::trace!(target: BROWSER, "{browser_source} {message}"),
}
0
}
fn get_raw(&self) -> *mut _cef_display_handler_t {
self.object.cast()
}
}
impl<H: CefEventHandler> Clone for DisplayHandlerImpl<H> {
fn clone(&self) -> Self {
unsafe {
let rc_impl = &mut *self.object;
rc_impl.interface.add_ref();
}
Self {
object: self.object,
event_handler: self.event_handler.clone(),
}
}
}
impl<H: CefEventHandler> Rc for DisplayHandlerImpl<H> {
fn as_base(&self) -> &cef_base_ref_counted_t {
unsafe {
let base = &*self.object;
std::mem::transmute(&base.cef_object)
}
}
}
impl<H: CefEventHandler> WrapDisplayHandler for DisplayHandlerImpl<H> {
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_display_handler_t, Self>) {
self.object = object;
}
}
+1
View File
@@ -3,6 +3,7 @@ use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
pub(crate) enum AppEvent { pub(crate) enum AppEvent {
UiUpdate(wgpu::Texture), UiUpdate(wgpu::Texture),
CursorChange(winit::cursor::Cursor),
ScheduleBrowserWork(std::time::Instant), ScheduleBrowserWork(std::time::Instant),
WebCommunicationInitialized, WebCommunicationInitialized,
DesktopWrapperMessage(DesktopWrapperMessage), DesktopWrapperMessage(DesktopWrapperMessage),
+23
View File
@@ -0,0 +1,23 @@
use graphite_desktop_wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
pub(super) async fn create_wgpu_context() -> WgpuContext {
let wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::PUSH_CONSTANTS);
// TODO: add a cli flag to list adapters and exit instead of always printing
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
// TODO: make this configurable via cli flags instead
let wgpu_context = match std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
None => wgpu_context_builder.build().await,
Some(adapter_index) => {
tracing::info!("Overriding WGPU adapter selection with adapter index {adapter_index}");
wgpu_context_builder.build_with_adapter_selection(|_| Some(adapter_index)).await
}
}
.expect("Failed to create WGPU context");
// TODO: add a cli flag to list adapters and exit instead of always printing
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
wgpu_context
}
+4 -4
View File
@@ -2,8 +2,6 @@ use std::process::exit;
use tracing_subscriber::EnvFilter; use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop; use winit::event_loop::EventLoop;
use graphite_desktop_wrapper::WgpuContext;
pub(crate) mod consts; pub(crate) mod consts;
mod app; mod app;
@@ -14,6 +12,8 @@ mod native_window;
mod persist; mod persist;
mod render; mod render;
mod gpu_context;
use app::App; use app::App;
use cef::CefHandler; use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt; use event::CreateAppEventSchedulerEventLoopExt;
@@ -27,11 +27,11 @@ fn main() {
// We are in a CEF subprocess // We are in a CEF subprocess
// This will block until the CEF subprocess quits // This will block until the CEF subprocess quits
let error = cef_context_builder.execute_sub_process(); let error = cef_context_builder.execute_sub_process();
tracing::error!("Cef subprocess failed with error: {error}"); tracing::warn!("Cef subprocess failed with error: {error}");
return; return;
} }
let wgpu_context = futures::executor::block_on(WgpuContext::new()).unwrap(); let wgpu_context = futures::executor::block_on(gpu_context::create_wgpu_context());
let event_loop = EventLoop::new().unwrap(); let event_loop = EventLoop::new().unwrap();
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel(); let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
+12 -2
View File
@@ -24,7 +24,8 @@ impl NativeWindowHandle {
.with_title(APP_NAME) .with_title(APP_NAME)
.with_min_surface_size(winit::dpi::LogicalSize::new(400, 300)) .with_min_surface_size(winit::dpi::LogicalSize::new(400, 300))
.with_surface_size(winit::dpi::LogicalSize::new(1200, 800)) .with_surface_size(winit::dpi::LogicalSize::new(1200, 800))
.with_resizable(true); .with_resizable(true)
.with_theme(Some(winit::window::Theme::Dark));
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
@@ -33,13 +34,22 @@ impl NativeWindowHandle {
use winit::platform::wayland::WindowAttributesWayland; use winit::platform::wayland::WindowAttributesWayland;
use winit::platform::x11::WindowAttributesX11; use winit::platform::x11::WindowAttributesX11;
window = if event_loop.is_wayland() { window = if event_loop.is_wayland() {
let wayland_window = WindowAttributesWayland::default().with_name(APP_ID, ""); let wayland_window = WindowAttributesWayland::default().with_name(APP_ID, "").with_prefer_csd(true);
window.with_platform_attributes(Box::new(wayland_window)) window.with_platform_attributes(Box::new(wayland_window))
} else { } else {
let x11_window = WindowAttributesX11::default().with_name(APP_ID, APP_NAME); let x11_window = WindowAttributesX11::default().with_name(APP_ID, APP_NAME);
window.with_platform_attributes(Box::new(x11_window)) window.with_platform_attributes(Box::new(x11_window))
};
}
#[cfg(target_os = "windows")]
{
if let Ok(win_icon) = winit::platform::windows::WinIcon::from_resource(1, None) {
let icon = winit::icon::Icon(std::sync::Arc::new(win_icon));
window = window.with_window_icon(Some(icon));
} }
} }
window window
} }
#[allow(unused_variables)] #[allow(unused_variables)]
+20 -5
View File
@@ -12,9 +12,11 @@
use std::sync::OnceLock; use std::sync::OnceLock;
use wgpu::rwh::{HasWindowHandle, RawWindowHandle}; use wgpu::rwh::{HasWindowHandle, RawWindowHandle};
use windows::Win32::Foundation::*; use windows::Win32::Foundation::*;
use windows::Win32::Graphics::{Dwm::*, Gdi::HBRUSH}; use windows::Win32::Graphics::Dwm::*;
use windows::Win32::Graphics::Gdi::*;
use windows::Win32::System::LibraryLoader::GetModuleHandleW; use windows::Win32::System::LibraryLoader::GetModuleHandleW;
use windows::Win32::UI::Controls::MARGINS; use windows::Win32::UI::Controls::MARGINS;
use windows::Win32::UI::HiDpi::*;
use windows::Win32::UI::WindowsAndMessaging::*; use windows::Win32::UI::WindowsAndMessaging::*;
use windows::core::PCWSTR; use windows::core::PCWSTR;
use winit::window::Window; use winit::window::Window;
@@ -173,11 +175,24 @@ unsafe fn ensure_helper_class() {
// Main window message handler, called on the UI thread for every message the main window receives. // Main window message handler, called on the UI thread for every message the main window receives.
unsafe extern "system" fn main_window_handle_message(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> LRESULT { unsafe extern "system" fn main_window_handle_message(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> LRESULT {
if msg == WM_NCCALCSIZE { if msg == WM_NCCALCSIZE && wparam.0 != 0 {
if wparam.0 != 0 { // When maximized, shrink to visible frame so content doesn't extend beyond it.
// Return 0 to to tell Windows to skip the default non-client area calculation and drawing. if unsafe { IsZoomed(hwnd).as_bool() } {
return LRESULT(0); let params = unsafe { &mut *(lparam.0 as *mut NCCALCSIZE_PARAMS) };
let dpi = unsafe { GetDpiForWindow(hwnd) };
let size = unsafe { GetSystemMetricsForDpi(SM_CXSIZEFRAME, dpi) };
let pad = unsafe { GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi) };
let inset = (size + pad) as i32;
params.rgrc[0].left += inset;
params.rgrc[0].top += inset;
params.rgrc[0].right -= inset;
params.rgrc[0].bottom -= inset;
} }
// Return 0 to to tell Windows to skip the default non-client area calculation and drawing.
return LRESULT(0);
} }
let Some(handle) = registry::find_by_main(hwnd) else { let Some(handle) = registry::find_by_main(hwnd) else {
@@ -1,7 +1,7 @@
use graphene_std::Color; use graphene_std::Color;
use graphene_std::raster::Image; use graphene_std::raster::Image;
use graphite_editor::messages::app_window::app_window_message_handler::AppWindowPlatform; use graphite_editor::messages::app_window::app_window_message_handler::AppWindowPlatform;
use graphite_editor::messages::prelude::{AppWindowMessage, DocumentMessage, PortfolioMessage, PreferencesMessage}; use graphite_editor::messages::prelude::{AppWindowMessage, DocumentMessage, FrontendMessage, PortfolioMessage, PreferencesMessage};
use crate::messages::Platform; use crate::messages::Platform;
@@ -118,6 +118,10 @@ pub(super) fn handle_desktop_wrapper_message(dispatcher: &mut DesktopWrapperMess
let message = AppWindowMessage::AppWindowUpdatePlatform { platform }; let message = AppWindowMessage::AppWindowUpdatePlatform { platform };
dispatcher.queue_editor_message(message.into()); dispatcher.queue_editor_message(message.into());
} }
DesktopWrapperMessage::UpdateMaximized { maximized } => {
let message = FrontendMessage::UpdateMaximized { maximized };
dispatcher.queue_editor_message(message.into());
}
DesktopWrapperMessage::LoadDocument { DesktopWrapperMessage::LoadDocument {
id, id,
document, document,
@@ -64,18 +64,18 @@ pub(super) fn intercept_frontend_message(dispatcher: &mut DesktopWrapperMessageD
FrontendMessage::TriggerVisitLink { url } => { FrontendMessage::TriggerVisitLink { url } => {
dispatcher.respond(DesktopFrontendMessage::OpenUrl(url)); dispatcher.respond(DesktopFrontendMessage::OpenUrl(url));
} }
FrontendMessage::UpdateWindowState { maximized, minimized } => {
dispatcher.respond(DesktopFrontendMessage::UpdateWindowState { maximized, minimized });
// Forward this to update the UI
return Some(message);
}
FrontendMessage::DragWindow => { FrontendMessage::DragWindow => {
dispatcher.respond(DesktopFrontendMessage::DragWindow); dispatcher.respond(DesktopFrontendMessage::DragWindow);
} }
FrontendMessage::CloseWindow => { FrontendMessage::CloseWindow => {
dispatcher.respond(DesktopFrontendMessage::CloseWindow); dispatcher.respond(DesktopFrontendMessage::CloseWindow);
} }
FrontendMessage::TriggerMinimizeWindow => {
dispatcher.respond(DesktopFrontendMessage::MinimizeWindow);
}
FrontendMessage::TriggerMaximizeWindow => {
dispatcher.respond(DesktopFrontendMessage::MaximizeWindow);
}
FrontendMessage::TriggerPersistenceWriteDocument { document_id, document, details } => { FrontendMessage::TriggerPersistenceWriteDocument { document_id, document, details } => {
dispatcher.respond(DesktopFrontendMessage::PersistenceWriteDocument { dispatcher.respond(DesktopFrontendMessage::PersistenceWriteDocument {
id: document_id, id: document_id,
+3 -1
View File
@@ -5,8 +5,10 @@ use graphite_editor::messages::prelude::{FrontendMessage, Message};
// TODO: Remove usage of this reexport in desktop create and remove this line // TODO: Remove usage of this reexport in desktop create and remove this line
pub use graphene_std::Color; pub use graphene_std::Color;
pub use wgpu_executor::Context as WgpuContext; pub use wgpu_executor::WgpuContext;
pub use wgpu_executor::WgpuContextBuilder;
pub use wgpu_executor::WgpuExecutor; pub use wgpu_executor::WgpuExecutor;
pub use wgpu_executor::WgpuFeatures;
pub mod messages; pub mod messages;
use messages::{DesktopFrontendMessage, DesktopWrapperMessage}; use messages::{DesktopFrontendMessage, DesktopWrapperMessage};
+6 -5
View File
@@ -32,10 +32,8 @@ pub enum DesktopFrontendMessage {
height: f32, height: f32,
}, },
UpdateOverlays(vello::Scene), UpdateOverlays(vello::Scene),
UpdateWindowState { MinimizeWindow,
maximized: bool, MaximizeWindow,
minimized: bool,
},
DragWindow, DragWindow,
CloseWindow, CloseWindow,
PersistenceWriteDocument { PersistenceWriteDocument {
@@ -92,6 +90,9 @@ pub enum DesktopWrapperMessage {
}, },
PollNodeGraphEvaluation, PollNodeGraphEvaluation,
UpdatePlatform(Platform), UpdatePlatform(Platform),
UpdateMaximized {
maximized: bool,
},
LoadDocument { LoadDocument {
id: DocumentId, id: DocumentId,
document: Document, document: Document,
@@ -102,7 +103,7 @@ pub enum DesktopWrapperMessage {
id: DocumentId, id: DocumentId,
}, },
LoadPreferences { LoadPreferences {
preferences: Preferences, preferences: Option<Preferences>,
}, },
} }
+1
View File
@@ -45,6 +45,7 @@ web-sys = { workspace = true }
vello = { workspace = true } vello = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
spin = { workspace = true } spin = { workspace = true }
image = { workspace = true }
# Optional local dependencies # Optional local dependencies
wgpu-executor = { workspace = true, optional = true } wgpu-executor = { workspace = true, optional = true }
@@ -5,8 +5,6 @@ use graphite_proc_macros::{ExtractField, message_handler_data};
#[derive(Debug, Clone, Default, ExtractField)] #[derive(Debug, Clone, Default, ExtractField)]
pub struct AppWindowMessageHandler { pub struct AppWindowMessageHandler {
platform: AppWindowPlatform, platform: AppWindowPlatform,
maximized: bool,
minimized: bool,
} }
#[message_handler_data] #[message_handler_data]
@@ -14,18 +12,10 @@ impl MessageHandler<AppWindowMessage, ()> for AppWindowMessageHandler {
fn process_message(&mut self, message: AppWindowMessage, responses: &mut std::collections::VecDeque<Message>, _: ()) { fn process_message(&mut self, message: AppWindowMessage, responses: &mut std::collections::VecDeque<Message>, _: ()) {
match message { match message {
AppWindowMessage::AppWindowMaximize => { AppWindowMessage::AppWindowMaximize => {
self.maximized = !self.maximized; responses.add(FrontendMessage::TriggerMaximizeWindow);
responses.add(FrontendMessage::UpdateWindowState {
maximized: self.maximized,
minimized: self.minimized,
});
} }
AppWindowMessage::AppWindowMinimize => { AppWindowMessage::AppWindowMinimize => {
self.minimized = !self.minimized; responses.add(FrontendMessage::TriggerMinimizeWindow);
responses.add(FrontendMessage::UpdateWindowState {
maximized: self.maximized,
minimized: self.minimized,
});
} }
AppWindowMessage::AppWindowUpdatePlatform { platform } => { AppWindowMessage::AppWindowUpdatePlatform { platform } => {
self.platform = platform; self.platform = platform;
@@ -120,6 +120,8 @@ pub enum FrontendMessage {
TriggerVisitLink { TriggerVisitLink {
url: String, url: String,
}, },
TriggerMinimizeWindow,
TriggerMaximizeWindow,
// Update prefix: give the frontend a new value or state for it to use // Update prefix: give the frontend a new value or state for it to use
UpdateActiveDocument { UpdateActiveDocument {
@@ -339,9 +341,8 @@ pub enum FrontendMessage {
UpdatePlatform { UpdatePlatform {
platform: AppWindowPlatform, platform: AppWindowPlatform,
}, },
UpdateWindowState { UpdateMaximized {
maximized: bool, maximized: bool,
minimized: bool,
}, },
DragWindow, DragWindow,
CloseWindow, CloseWindow,
@@ -980,7 +980,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
DocumentNode { DocumentNode {
inputs: vec![NodeInput::import(concrete!(Table<Raster<CPU>>), 0), NodeInput::node(NodeId(0), 0)], inputs: vec![NodeInput::import(concrete!(Table<Raster<CPU>>), 0), NodeInput::node(NodeId(0), 0)],
call_argument: generic!(T), call_argument: generic!(T),
implementation: DocumentNodeImplementation::ProtoNode(wgpu_executor::texture_upload::upload_texture::IDENTIFIER), implementation: DocumentNodeImplementation::ProtoNode(wgpu_executor::texture_conversion::upload_texture::IDENTIFIER),
..Default::default() ..Default::default()
}, },
DocumentNode { DocumentNode {
@@ -1341,6 +1341,13 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
persistent_metadata: DocumentNodePersistentMetadata { persistent_metadata: DocumentNodePersistentMetadata {
display_name: "Transform".to_string(), display_name: "Transform".to_string(),
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(7, 0)), node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(7, 0)),
input_metadata: vec![
("Value", "TODO").into(),
("Translation", "TODO").into(),
("Rotation", "TODO").into(),
("Scale", "TODO").into(),
("Skew", "TODO").into(),
],
..Default::default() ..Default::default()
}, },
..Default::default() ..Default::default()
@@ -215,6 +215,7 @@ pub(crate) fn property_from_type(
Some(x) if x == TypeId::of::<StrokeAlign>() => enum_choice::<StrokeAlign>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<StrokeAlign>() => enum_choice::<StrokeAlign>().for_socket(default_info).property_row(),
Some(x) if x == TypeId::of::<PaintOrder>() => enum_choice::<PaintOrder>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<PaintOrder>() => enum_choice::<PaintOrder>().for_socket(default_info).property_row(),
Some(x) if x == TypeId::of::<ArcType>() => enum_choice::<ArcType>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<ArcType>() => enum_choice::<ArcType>().for_socket(default_info).property_row(),
// Add here
Some(x) if x == TypeId::of::<TextAlign>() => enum_choice::<TextAlign>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<TextAlign>() => enum_choice::<TextAlign>().for_socket(default_info).property_row(),
Some(x) if x == TypeId::of::<MergeByDistanceAlgorithm>() => enum_choice::<MergeByDistanceAlgorithm>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<MergeByDistanceAlgorithm>() => enum_choice::<MergeByDistanceAlgorithm>().for_socket(default_info).property_row(),
Some(x) if x == TypeId::of::<PointSpacingType>() => enum_choice::<PointSpacingType>().for_socket(default_info).property_row(), Some(x) if x == TypeId::of::<PointSpacingType>() => enum_choice::<PointSpacingType>().for_socket(default_info).property_row(),
@@ -12,17 +12,30 @@ use graphene_std::Color;
use graphene_std::math::quad::Quad; use graphene_std::math::quad::Quad;
use graphene_std::subpath::{self, Subpath}; use graphene_std::subpath::{self, Subpath};
use graphene_std::table::Table; use graphene_std::table::Table;
use graphene_std::text::{TextAlign, TypesettingConfig, load_font, to_path}; use graphene_std::text::TextContext;
use graphene_std::text::{Font, FontCache, TextAlign, TypesettingConfig};
use graphene_std::vector::click_target::ClickTargetType; use graphene_std::vector::click_target::ClickTargetType;
use graphene_std::vector::misc::point_to_dvec2; use graphene_std::vector::misc::point_to_dvec2;
use graphene_std::vector::{PointId, SegmentId, Vector}; use graphene_std::vector::{PointId, SegmentId, Vector};
use kurbo::{self, BezPath, ParamCurve}; use kurbo::{self, BezPath, ParamCurve};
use kurbo::{Affine, PathSeg}; use kurbo::{Affine, PathSeg};
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, Mutex, MutexGuard}; use std::sync::{Arc, LazyLock, Mutex, MutexGuard};
use vello::Scene; use vello::Scene;
use vello::peniko; use vello::peniko;
// Global lazy initialized font cache and text context
static GLOBAL_FONT_CACHE: LazyLock<FontCache> = LazyLock::new(|| {
let mut font_cache = FontCache::default();
// Initialize with the hardcoded font used by overlay text
const FONT_DATA: &[u8] = include_bytes!("source-sans-pro-regular.ttf");
let font = Font::new("Source Sans Pro".to_string(), "Regular".to_string());
font_cache.insert(font, String::new(), FONT_DATA.to_vec());
font_cache
});
static GLOBAL_TEXT_CONTEXT: LazyLock<Mutex<TextContext>> = LazyLock::new(|| Mutex::new(TextContext::default()));
pub type OverlayProvider = fn(OverlayContext) -> Message; pub type OverlayProvider = fn(OverlayContext) -> Message;
pub fn empty_provider() -> OverlayProvider { pub fn empty_provider() -> OverlayProvider {
@@ -215,7 +228,7 @@ impl OverlayContext {
pub fn take_scene(self) -> Scene { pub fn take_scene(self) -> Scene {
let mut internal = self.internal.lock().expect("Failed to lock internal overlay context"); let mut internal = self.internal.lock().expect("Failed to lock internal overlay context");
std::mem::take(&mut *internal).scene std::mem::take(&mut internal.scene)
} }
fn internal(&'_ self) -> MutexGuard<'_, OverlayContextInternal> { fn internal(&'_ self) -> MutexGuard<'_, OverlayContextInternal> {
@@ -415,12 +428,7 @@ pub(super) struct OverlayContextInternal {
impl Default for OverlayContextInternal { impl Default for OverlayContextInternal {
fn default() -> Self { fn default() -> Self {
Self { Self::new(DVec2::new(100., 100.), 1., OverlaysVisibilitySettings::default())
scene: Scene::new(),
size: DVec2::ZERO,
device_pixel_ratio: 1.0,
visibility_settings: OverlaysVisibilitySettings::default(),
}
} }
} }
@@ -1007,7 +1015,7 @@ impl OverlayContextInternal {
self.scene.fill(peniko::Fill::NonZero, self.get_transform(), &brush, None, &path); self.scene.fill(peniko::Fill::NonZero, self.get_transform(), &brush, None, &path);
} }
fn get_width(&self, text: &str) -> f64 { fn get_width(&mut self, text: &str) -> f64 {
// Use the actual text-to-path system to get precise text width // Use the actual text-to-path system to get precise text width
const FONT_SIZE: f64 = 12.0; const FONT_SIZE: f64 = 12.0;
@@ -1024,13 +1032,10 @@ impl OverlayContextInternal {
// Load Source Sans Pro font data // Load Source Sans Pro font data
// TODO: Grab this from the node_modules folder (either with `include_bytes!` or ideally at runtime) instead of checking the font file into the repo. // TODO: Grab this from the node_modules folder (either with `include_bytes!` or ideally at runtime) instead of checking the font file into the repo.
// TODO: And maybe use the WOFF2 version (if it's supported) for its smaller, compressed file size. // TODO: And maybe use the WOFF2 version (if it's supported) for its smaller, compressed file size.
const FONT_DATA: &[u8] = include_bytes!("source-sans-pro-regular.ttf"); let font = Font::new("Source Sans Pro".to_string(), "Regular".to_string());
let font_blob = Some(load_font(FONT_DATA)); let mut text_context = GLOBAL_TEXT_CONTEXT.lock().expect("Failed to lock global text context");
let bounds = text_context.bounding_box(text, &font, &GLOBAL_FONT_CACHE, typesetting, false);
// Convert text to paths and calculate actual bounds bounds.x
let text_table = to_path(text, font_blob, typesetting, false);
let text_bounds = self.calculate_text_bounds(&text_table);
text_bounds.width()
} }
fn text(&mut self, text: &str, font_color: &str, background_color: Option<&str>, transform: DAffine2, padding: f64, pivot: [Pivot; 2]) { fn text(&mut self, text: &str, font_color: &str, background_color: Option<&str>, transform: DAffine2, padding: f64, pivot: [Pivot; 2]) {
@@ -1051,15 +1056,18 @@ impl OverlayContextInternal {
// Load Source Sans Pro font data // Load Source Sans Pro font data
// TODO: Grab this from the node_modules folder (either with `include_bytes!` or ideally at runtime) instead of checking the font file into the repo. // TODO: Grab this from the node_modules folder (either with `include_bytes!` or ideally at runtime) instead of checking the font file into the repo.
// TODO: And maybe use the WOFF2 version (if it's supported) for its smaller, compressed file size. // TODO: And maybe use the WOFF2 version (if it's supported) for its smaller, compressed file size.
const FONT_DATA: &[u8] = include_bytes!("source-sans-pro-regular.ttf"); let font = Font::new("Source Sans Pro".to_string(), "Regular".to_string());
let font_blob = Some(load_font(FONT_DATA));
// Convert text to vector paths using the existing text system // Get text dimensions directly from layout
let text_table = to_path(text, font_blob, typesetting, false); let mut text_context = GLOBAL_TEXT_CONTEXT.lock().expect("Failed to lock global text context");
// Calculate text bounds from the generated paths let text_size = text_context.bounding_box(text, &font, &GLOBAL_FONT_CACHE, typesetting, false);
let text_bounds = self.calculate_text_bounds(&text_table); let text_width = text_size.x;
let text_width = text_bounds.width(); let text_height = text_size.y;
let text_height = text_bounds.height(); // Create a rect from the size (assuming text starts at origin)
let text_bounds = kurbo::Rect::new(0.0, 0.0, text_width, text_height);
// Convert text to vector paths for rendering
let text_table = text_context.to_path(text, &font, &GLOBAL_FONT_CACHE, typesetting, false);
// Calculate position based on pivot // Calculate position based on pivot
let mut position = DVec2::ZERO; let mut position = DVec2::ZERO;
@@ -1094,56 +1102,6 @@ impl OverlayContextInternal {
self.render_text_paths(&text_table, font_color, vello_transform); self.render_text_paths(&text_table, font_color, vello_transform);
} }
// Calculate bounds of text from vector table
fn calculate_text_bounds(&self, text_table: &Table<Vector>) -> kurbo::Rect {
let mut min_x = f64::INFINITY;
let mut min_y = f64::INFINITY;
let mut max_x = f64::NEG_INFINITY;
let mut max_y = f64::NEG_INFINITY;
for row in text_table.iter() {
// Use the existing segment_bezier_iter to get all bezier curves
for (_, bezier, _, _) in row.element.segment_bezier_iter() {
let transformed_bezier = bezier.apply_transformation(|point| row.transform.transform_point2(point));
// Add start and end points to bounds
let points = [transformed_bezier.start, transformed_bezier.end];
for point in points {
min_x = min_x.min(point.x);
min_y = min_y.min(point.y);
max_x = max_x.max(point.x);
max_y = max_y.max(point.y);
}
// Add handle points if they exist
match transformed_bezier.handles {
subpath::BezierHandles::Quadratic { handle } => {
min_x = min_x.min(handle.x);
min_y = min_y.min(handle.y);
max_x = max_x.max(handle.x);
max_y = max_y.max(handle.y);
}
subpath::BezierHandles::Cubic { handle_start, handle_end } => {
for handle in [handle_start, handle_end] {
min_x = min_x.min(handle.x);
min_y = min_y.min(handle.y);
max_x = max_x.max(handle.x);
max_y = max_y.max(handle.y);
}
}
_ => {}
}
}
}
if min_x.is_finite() && min_y.is_finite() && max_x.is_finite() && max_y.is_finite() {
kurbo::Rect::new(min_x, min_y, max_x, max_y)
} else {
// Fallback for empty text
kurbo::Rect::new(0.0, 0.0, 0.0, 12.0)
}
}
// Render text paths to the vello scene using existing infrastructure // Render text paths to the vello scene using existing infrastructure
fn render_text_paths(&mut self, text_table: &Table<Vector>, font_color: &str, base_transform: kurbo::Affine) { fn render_text_paths(&mut self, text_table: &Table<Vector>, font_color: &str, base_transform: kurbo::Affine) {
let color = Self::parse_color(font_color); let color = Self::parse_color(font_color);
@@ -1002,10 +1002,7 @@ impl NodeNetworkInterface {
.outward_wires(network_path) .outward_wires(network_path)
.and_then(|outward_wires| outward_wires.get(output_connector)) .and_then(|outward_wires| outward_wires.get(output_connector))
.cloned() .cloned()
.unwrap_or_else(|| { .unwrap_or_default()
log::error!("Could not get {output_connector:?} in outward wires");
Vec::new()
})
.iter() .iter()
.map(|input| match input { .map(|input| match input {
InputConnector::Node { node_id, input_index } => { InputConnector::Node { node_id, input_index } => {
@@ -6470,7 +6467,7 @@ pub struct NodeNetworkTransientMetadata {
pub stack_dependents: TransientMetadata<HashMap<NodeId, LayerOwner>>, pub stack_dependents: TransientMetadata<HashMap<NodeId, LayerOwner>>,
/// Cache for the bounding box around all nodes in node graph space. /// Cache for the bounding box around all nodes in node graph space.
pub all_nodes_bounding_box: TransientMetadata<[DVec2; 2]>, pub all_nodes_bounding_box: TransientMetadata<[DVec2; 2]>,
/// Cache bounding box for all "groups of nodes", which will be used to prevent overlapping nodes // /// Cache bounding box for all "groups of nodes", which will be used to prevent overlapping nodes
// node_group_bounding_box: Vec<(Subpath<ManipulatorGroupId>, Vec<Nodes>)>, // node_group_bounding_box: Vec<(Subpath<ManipulatorGroupId>, Vec<Nodes>)>,
/// Cache for all outward wire connections /// Cache for all outward wire connections
pub outward_wires: TransientMetadata<HashMap<OutputConnector, Vec<InputConnector>>>, pub outward_wires: TransientMetadata<HashMap<OutputConnector, Vec<InputConnector>>>,
@@ -784,6 +784,22 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
.set_input(&InputConnector::node(*node_id, 1), NodeInput::value(TaggedValue::Bool(true), false), network_path); .set_input(&InputConnector::node(*node_id, 1), NodeInput::value(TaggedValue::Bool(true), false), network_path);
} }
// Upgrade the 'Tangent on Path' node to include a boolean input for whether the output should be in radians, which was previously the only option but is now not the default
if (reference == "Tangent on Path") && inputs_count == 4 {
let mut node_template = resolve_document_node_type(reference)?.default_node_template();
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
let old_inputs = document.network_interface.replace_inputs(node_id, network_path, &mut node_template)?;
document.network_interface.set_input(&InputConnector::node(*node_id, 0), old_inputs[0].clone(), network_path);
document.network_interface.set_input(&InputConnector::node(*node_id, 1), old_inputs[1].clone(), network_path);
document.network_interface.set_input(&InputConnector::node(*node_id, 2), old_inputs[2].clone(), network_path);
document.network_interface.set_input(&InputConnector::node(*node_id, 3), old_inputs[3].clone(), network_path);
document
.network_interface
.set_input(&InputConnector::node(*node_id, 4), NodeInput::value(TaggedValue::Bool(true), false), network_path);
}
// Upgrade the Modulo node to include a boolean input for whether the output should be always positive, which was previously not an option // Upgrade the Modulo node to include a boolean input for whether the output should be always positive, which was previously not an option
if reference == "Modulo" && inputs_count == 2 { if reference == "Modulo" && inputs_count == 2 {
let mut node_template = resolve_document_node_type(reference)?.default_node_template(); let mut node_template = resolve_document_node_type(reference)?.default_node_template();
@@ -1044,6 +1060,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
if reference == "Instance Index" && inputs_count == 0 { if reference == "Instance Index" && inputs_count == 0 {
let mut node_template = resolve_document_node_type(reference)?.default_node_template(); let mut node_template = resolve_document_node_type(reference)?.default_node_template();
document.network_interface.replace_implementation(node_id, network_path, &mut node_template); document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
document.network_interface.set_display_name(node_id, "Instance Index".to_string(), network_path);
let mut node_path = network_path.to_vec(); let mut node_path = network_path.to_vec();
node_path.push(*node_id); node_path.push(*node_id);
@@ -1054,6 +1071,30 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
// Migrate the Transform node to use degrees instead of radians // Migrate the Transform node to use degrees instead of radians
if reference == "Transform" && node.inputs.get(6).is_none() { if reference == "Transform" && node.inputs.get(6).is_none() {
let mut node_template = resolve_document_node_type("Transform")?.default_node_template();
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
let old_inputs = document.network_interface.replace_inputs(node_id, network_path, &mut node_template)?;
// Value
document.network_interface.set_input(&InputConnector::node(*node_id, 0), old_inputs[0].clone(), network_path);
// Translation
document.network_interface.set_input(&InputConnector::node(*node_id, 1), old_inputs[1].clone(), network_path);
// Rotation
document.network_interface.set_input(&InputConnector::node(*node_id, 2), old_inputs[2].clone(), network_path);
// Scale
document.network_interface.set_input(&InputConnector::node(*node_id, 3), old_inputs[3].clone(), network_path);
// Skew
document.network_interface.set_input(&InputConnector::node(*node_id, 4), old_inputs[4].clone(), network_path);
// Origin Offset
document
.network_interface
.set_input(&InputConnector::node(*node_id, 5), NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), false), network_path);
// Scale Appearance
document
.network_interface
.set_input(&InputConnector::node(*node_id, 6), NodeInput::value(TaggedValue::Bool(true), false), network_path);
// Migrate rotation from radians to degrees // Migrate rotation from radians to degrees
match node.inputs.get(2)? { match node.inputs.get(2)? {
NodeInput::Value { tagged_value, exposed } => { NodeInput::Value { tagged_value, exposed } => {
@@ -1099,31 +1140,6 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
let new_input = NodeInput::value(TaggedValue::DVec2(new_value), *exposed); let new_input = NodeInput::value(TaggedValue::DVec2(new_value), *exposed);
document.network_interface.set_input(&InputConnector::node(*node_id, 4), new_input, network_path); document.network_interface.set_input(&InputConnector::node(*node_id, 4), new_input, network_path);
} }
if document
.network_interface
.node_metadata(node_id, network_path)
.map(|x| x.persistent_metadata.input_metadata.len() > 5)
.unwrap_or_default()
{
// Remove the possible existence of the old "Pivot" hidden value input that was removed in #2730
let nested_transform_network = [network_path, &[*node_id]].concat();
if node.inputs.get(5).is_some() {
document.network_interface.remove_import(5, &nested_transform_network);
}
// Add the Origin Offset parameter as a hidden input, which will be given actual functionality in the future but is currently used as a marker to detect not-yet-upgraded Transform nodes
document
.network_interface
.add_import(TaggedValue::DVec2(DVec2::ZERO), false, 5, "Origin Offset", "", &nested_transform_network);
document.network_interface.set_input_override(node_id, 5, Some("hidden".to_string()), network_path); // Hide it while we're not yet using it
// Add the Scale Appearance parameter as a hidden input, which will be given actual functionality in the future but is currently used as a marker to detect not-yet-upgraded Transform nodes
document
.network_interface
.add_import(TaggedValue::Bool(true), false, 6, "Scale Appearance", "", &nested_transform_network);
document.network_interface.set_input_override(node_id, 6, Some("hidden".to_string()), network_path); // Hide it while we're not yet using it
}
} }
// Add context features to nodes that don't have them (fine-grained context caching migration) // Add context features to nodes that don't have them (fine-grained context caching migration)
@@ -6,7 +6,7 @@ use crate::messages::prelude::*;
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)] #[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub enum PreferencesMessage { pub enum PreferencesMessage {
// Management messages // Management messages
Load { preferences: PreferencesMessageHandler }, Load { preferences: Option<PreferencesMessageHandler> },
ResetToDefaults, ResetToDefaults,
// Per-preference messages // Per-preference messages
@@ -50,7 +50,9 @@ impl MessageHandler<PreferencesMessage, ()> for PreferencesMessageHandler {
match message { match message {
// Management messages // Management messages
PreferencesMessage::Load { preferences } => { PreferencesMessage::Load { preferences } => {
*self = preferences; if let Some(preferences) = preferences {
*self = preferences;
}
responses.add(PortfolioMessage::EditorPreferences); responses.add(PortfolioMessage::EditorPreferences);
responses.add(PortfolioMessage::UpdateVelloPreference); responses.add(PortfolioMessage::UpdateVelloPreference);
@@ -15,7 +15,7 @@ use graph_craft::document::value::TaggedValue;
use graphene_std::renderer::Quad; use graphene_std::renderer::Quad;
use graphene_std::subpath::{Bezier, BezierHandles}; use graphene_std::subpath::{Bezier, BezierHandles};
use graphene_std::table::Table; use graphene_std::table::Table;
use graphene_std::text::{FontCache, load_font}; use graphene_std::text::FontCache;
use graphene_std::vector::algorithms::bezpath_algorithms::pathseg_compute_lookup_table; use graphene_std::vector::algorithms::bezpath_algorithms::pathseg_compute_lookup_table;
use graphene_std::vector::misc::{HandleId, ManipulatorPointId, dvec2_to_point}; use graphene_std::vector::misc::{HandleId, ManipulatorPointId, dvec2_to_point};
use graphene_std::vector::{HandleExt, PointId, SegmentId, Vector, VectorModification, VectorModificationType}; use graphene_std::vector::{HandleExt, PointId, SegmentId, Vector, VectorModification, VectorModificationType};
@@ -74,8 +74,7 @@ pub fn text_bounding_box(layer: LayerNodeIdentifier, document: &DocumentMessageH
return Quad::from_box([DVec2::ZERO, DVec2::ZERO]); return Quad::from_box([DVec2::ZERO, DVec2::ZERO]);
}; };
let font_data = font_cache.get(font).map(|data| load_font(data)); let far = graphene_std::text::bounding_box(text, font, font_cache, typesetting, false);
let far = graphene_std::text::bounding_box(text, font_data, typesetting, false);
// TODO: Once the instance tables refactor is complete and per_glyph_instances can be removed (since it'll be the default), // TODO: Once the instance tables refactor is complete and per_glyph_instances can be removed (since it'll be the default),
// TODO: remove this because the top of the dashed bounding overlay should no longer be based on the first line's baseline. // TODO: remove this because the top of the dashed bounding overlay should no longer be based on the first line's baseline.
@@ -17,7 +17,7 @@ use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput}; use graph_craft::document::{NodeId, NodeInput};
use graphene_std::Color; use graphene_std::Color;
use graphene_std::renderer::Quad; use graphene_std::renderer::Quad;
use graphene_std::text::{Font, FontCache, TextAlign, TypesettingConfig, lines_clipping, load_font}; use graphene_std::text::{Font, FontCache, TextAlign, TypesettingConfig, lines_clipping};
use graphene_std::vector::style::Fill; use graphene_std::vector::style::Fill;
#[derive(Default, ExtractField)] #[derive(Default, ExtractField)]
@@ -513,8 +513,7 @@ impl Fsm for TextToolFsmState {
transform: document.metadata().transform_to_viewport(tool_data.layer).to_cols_array(), transform: document.metadata().transform_to_viewport(tool_data.layer).to_cols_array(),
}); });
if let Some(editing_text) = tool_data.editing_text.as_mut() { if let Some(editing_text) = tool_data.editing_text.as_mut() {
let font_data = font_cache.get(&editing_text.font).map(|data| load_font(data)); let far = graphene_std::text::bounding_box(&tool_data.new_text, &editing_text.font, font_cache, editing_text.typesetting, false);
let far = graphene_std::text::bounding_box(&tool_data.new_text, font_data, editing_text.typesetting, false);
if far.x != 0. && far.y != 0. { if far.x != 0. && far.y != 0. {
let quad = Quad::from_box([DVec2::ZERO, far]); let quad = Quad::from_box([DVec2::ZERO, far]);
let transformed_quad = document.metadata().transform_to_viewport(tool_data.layer) * quad; let transformed_quad = document.metadata().transform_to_viewport(tool_data.layer) * quad;
@@ -562,8 +561,7 @@ impl Fsm for TextToolFsmState {
// Draw red overlay if text is clipped // Draw red overlay if text is clipped
let transformed_quad = layer_transform * bounds; let transformed_quad = layer_transform * bounds;
if let Some((text, font, typesetting, _)) = graph_modification_utils::get_text(layer.unwrap(), &document.network_interface) { if let Some((text, font, typesetting, _)) = graph_modification_utils::get_text(layer.unwrap(), &document.network_interface) {
let font_data = font_cache.get(font).map(|data| load_font(data)); if lines_clipping(text.as_str(), font, font_cache, typesetting) {
if lines_clipping(text.as_str(), font_data, typesetting) {
overlay_context.line(transformed_quad.0[2], transformed_quad.0[3], Some(COLOR_OVERLAY_RED), Some(3.)); overlay_context.line(transformed_quad.0[2], transformed_quad.0[3], Some(COLOR_OVERLAY_RED), Some(3.));
} }
} }
+94 -23
View File
@@ -51,7 +51,7 @@ pub enum NodeGraphUpdate {
pub struct NodeGraphExecutor { pub struct NodeGraphExecutor {
runtime_io: NodeRuntimeIO, runtime_io: NodeRuntimeIO,
current_execution_id: u64, current_execution_id: u64,
futures: HashMap<u64, ExecutionContext>, futures: VecDeque<(u64, ExecutionContext)>,
node_graph_hash: u64, node_graph_hash: u64,
previous_node_to_inspect: Option<NodeId>, previous_node_to_inspect: Option<NodeId>,
} }
@@ -157,7 +157,7 @@ impl NodeGraphExecutor {
// Execute the node graph // Execute the node graph
let execution_id = self.queue_execution(render_config); let execution_id = self.queue_execution(render_config);
self.futures.insert(execution_id, ExecutionContext { export_config: None, document_id }); self.futures.push_back((execution_id, ExecutionContext { export_config: None, document_id }));
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into()) Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
} }
@@ -190,6 +190,12 @@ impl NodeGraphExecutor {
let size = bounds[1] - bounds[0]; let size = bounds[1] - bounds[0];
let transform = DAffine2::from_translation(bounds[0]).inverse(); let transform = DAffine2::from_translation(bounds[0]).inverse();
let export_format = if export_config.file_type == FileType::Svg || cfg!(not(feature = "gpu")) {
graphene_std::application_io::ExportFormat::Svg
} else {
graphene_std::application_io::ExportFormat::Texture
};
let render_config = RenderConfig { let render_config = RenderConfig {
viewport: Footprint { viewport: Footprint {
transform: DAffine2::from_scale(DVec2::splat(export_config.scale_factor)) * transform, transform: DAffine2::from_scale(DVec2::splat(export_config.scale_factor)) * transform,
@@ -197,7 +203,7 @@ impl NodeGraphExecutor {
..Default::default() ..Default::default()
}, },
time: Default::default(), time: Default::default(),
export_format: graphene_std::application_io::ExportFormat::Svg, export_format,
render_mode: document.render_mode, render_mode: document.render_mode,
hide_artboards: export_config.transparent_background, hide_artboards: export_config.transparent_background,
for_export: true, for_export: true,
@@ -213,34 +219,87 @@ impl NodeGraphExecutor {
export_config: Some(export_config), export_config: Some(export_config),
document_id, document_id,
}; };
self.futures.insert(execution_id, execution_context); self.futures.push_back((execution_id, execution_context));
Ok(()) Ok(())
} }
fn export(&self, node_graph_output: TaggedValue, export_config: ExportConfig, responses: &mut VecDeque<Message>) -> Result<(), String> { fn export(&self, node_graph_output: TaggedValue, export_config: ExportConfig, responses: &mut VecDeque<Message>) -> Result<(), String> {
let TaggedValue::RenderOutput(RenderOutput {
data: RenderOutputType::Svg { svg, .. },
..
}) = node_graph_output
else {
return Err("Incorrect render type for exporting (expected RenderOutput::Svg)".to_string());
};
let ExportConfig { let ExportConfig {
file_type, name, size, scale_factor, .. file_type,
name,
size,
scale_factor,
#[cfg(feature = "gpu")]
transparent_background,
..
} = export_config; } = export_config;
let file_suffix = &format!(".{file_type:?}").to_lowercase(); let file_extension = match file_type {
let name = name + file_suffix; FileType::Svg => "svg",
FileType::Png => "png",
FileType::Jpg => "jpg",
};
let name = format!("{name}.{file_extension}");
if file_type == FileType::Svg { match node_graph_output {
responses.add(FrontendMessage::TriggerSaveFile { name, content: svg.into_bytes() }); TaggedValue::RenderOutput(RenderOutput {
} else { data: RenderOutputType::Svg { svg, .. },
let mime = file_type.to_mime().to_string(); ..
let size = (size * scale_factor).into(); }) => {
responses.add(FrontendMessage::TriggerExportImage { svg, name, mime, size }); if file_type == FileType::Svg {
} responses.add(FrontendMessage::TriggerSaveFile { name, content: svg.into_bytes() });
} else {
let mime = file_type.to_mime().to_string();
let size = (size * scale_factor).into();
responses.add(FrontendMessage::TriggerExportImage { svg, name, mime, size });
}
}
#[cfg(feature = "gpu")]
TaggedValue::RenderOutput(RenderOutput {
data: RenderOutputType::Buffer { data, width, height },
..
}) if file_type != FileType::Svg => {
use image::buffer::ConvertBuffer;
use image::{ImageFormat, RgbImage, RgbaImage};
let Some(image) = RgbaImage::from_raw(width, height, data) else {
return Err(format!("Failed to create image buffer for export"));
};
let mut encoded = Vec::new();
let mut cursor = std::io::Cursor::new(&mut encoded);
match file_type {
FileType::Png => {
let result = if transparent_background {
image.write_to(&mut cursor, ImageFormat::Png)
} else {
let image: RgbImage = image.convert();
image.write_to(&mut cursor, ImageFormat::Png)
};
if let Err(err) = result {
return Err(format!("Failed to encode PNG: {err}"));
}
}
FileType::Jpg => {
let image: RgbImage = image.convert();
let result = image.write_to(&mut cursor, ImageFormat::Jpeg);
if let Err(err) = result {
return Err(format!("Failed to encode JPG: {err}"));
}
}
FileType::Svg => {
return Err(format!("SVG cannot be exported from an image buffer"));
}
}
responses.add(FrontendMessage::TriggerSaveFile { name, content: encoded });
}
_ => {
return Err(format!("Incorrect render type for exporting to an SVG ({file_type:?}, {node_graph_output})"));
}
};
Ok(()) Ok(())
} }
@@ -273,7 +332,19 @@ impl NodeGraphExecutor {
responses.extend(existing_responses.into_iter().map(Into::into)); responses.extend(existing_responses.into_iter().map(Into::into));
document.network_interface.update_vector_modify(vector_modify); document.network_interface.update_vector_modify(vector_modify);
let execution_context = self.futures.remove(&execution_id).ok_or_else(|| "Invalid generation ID".to_string())?; while let Some(&(fid, _)) = self.futures.front() {
if fid < execution_id {
self.futures.pop_front();
} else {
break;
}
}
let Some((fid, execution_context)) = self.futures.pop_front() else {
panic!("InvalidGenerationId")
};
assert_eq!(fid, execution_id, "Missmatch in execution id");
if let Some(export_config) = execution_context.export_config { if let Some(export_config) = execution_context.export_config {
// Special handling for exporting the artwork // Special handling for exporting the artwork
self.export(node_graph_output, export_config, responses)?; self.export(node_graph_output, export_config, responses)?;
+42 -18
View File
@@ -7,9 +7,11 @@ use graph_craft::graphene_compiler::Compiler;
use graph_craft::proto::GraphErrors; use graph_craft::proto::GraphErrors;
use graph_craft::wasm_application_io::EditorPreferences; use graph_craft::wasm_application_io::EditorPreferences;
use graph_craft::{ProtoNodeIdentifier, concrete}; use graph_craft::{ProtoNodeIdentifier, concrete};
use graphene_std::application_io::{ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; use graphene_std::application_io::{ApplicationIo, ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig};
use graphene_std::bounds::RenderBoundingBox; use graphene_std::bounds::RenderBoundingBox;
use graphene_std::memo::IORecord; use graphene_std::memo::IORecord;
use graphene_std::ops::Convert;
use graphene_std::raster_types::Raster;
use graphene_std::renderer::{Render, RenderParams, SvgRender}; use graphene_std::renderer::{Render, RenderParams, SvgRender};
use graphene_std::renderer::{RenderSvgSegmentList, SvgSegment}; use graphene_std::renderer::{RenderSvgSegmentList, SvgSegment};
use graphene_std::table::{Table, TableRow}; use graphene_std::table::{Table, TableRow};
@@ -220,16 +222,44 @@ impl NodeRuntime {
// Resolve the result from the inspection by accessing the monitor node // Resolve the result from the inspection by accessing the monitor node
let inspect_result = self.inspect_state.and_then(|state| state.access(&self.executor)); let inspect_result = self.inspect_state.and_then(|state| state.access(&self.executor));
let texture = if let Ok(TaggedValue::RenderOutput(RenderOutput { let (result, texture) = match result {
data: RenderOutputType::Texture(texture), Ok(TaggedValue::RenderOutput(RenderOutput {
.. data: RenderOutputType::Texture(image_texture),
})) = &result metadata,
{ })) if render_config.for_export => {
// We can early return becaus we know that there is at most one execution request and it will always be handled last let executor = self
Some(texture.clone()) .editor_api
} else { .application_io
None .as_ref()
.unwrap()
.gpu_executor()
.expect("GPU executor should be available when we receive a texture");
let raster_cpu = Raster::new_gpu(image_texture.texture).convert(Footprint::BOUNDLESS, executor).await;
let (data, width, height) = raster_cpu.to_flat_u8();
(
Ok(TaggedValue::RenderOutput(RenderOutput {
data: RenderOutputType::Buffer { data, width, height },
metadata,
})),
None,
)
}
Ok(TaggedValue::RenderOutput(RenderOutput {
data: RenderOutputType::Texture(texture),
metadata,
})) => (
Ok(TaggedValue::RenderOutput(RenderOutput {
data: RenderOutputType::Texture(texture.clone()),
metadata,
})),
Some(texture),
),
r => (r, None),
}; };
self.sender.send_execution_response(ExecutionResponse { self.sender.send_execution_response(ExecutionResponse {
execution_id, execution_id,
result, result,
@@ -274,18 +304,12 @@ impl NodeRuntime {
async fn execute_network(&mut self, render_config: RenderConfig) -> Result<TaggedValue, String> { async fn execute_network(&mut self, render_config: RenderConfig) -> Result<TaggedValue, String> {
use graph_craft::graphene_compiler::Executor; use graph_craft::graphene_compiler::Executor;
let result = match self.executor.input_type() { match self.executor.input_type() {
Some(t) if t == concrete!(RenderConfig) => (&self.executor).execute(render_config).await.map_err(|e| e.to_string()), Some(t) if t == concrete!(RenderConfig) => (&self.executor).execute(render_config).await.map_err(|e| e.to_string()),
Some(t) if t == concrete!(()) => (&self.executor).execute(()).await.map_err(|e| e.to_string()), Some(t) if t == concrete!(()) => (&self.executor).execute(()).await.map_err(|e| e.to_string()),
Some(t) => Err(format!("Invalid input type {t:?}")), Some(t) => Err(format!("Invalid input type {t:?}")),
_ => Err(format!("No input type:\n{:?}", self.node_graph_errors)), _ => Err(format!("No input type:\n{:?}", self.node_graph_errors)),
}; }
let result = match result {
Ok(value) => value,
Err(e) => return Err(e),
};
Ok(result)
} }
/// Updates state data /// Updates state data
@@ -84,5 +84,9 @@
flex: 0 0 30%; flex: 0 0 30%;
text-align: right; text-align: right;
} }
a {
color: inherit;
}
} }
</style> </style>
@@ -9,7 +9,7 @@
const fullscreen = getContext<FullscreenState>("fullscreen"); const fullscreen = getContext<FullscreenState>("fullscreen");
$: requestFullscreenHotkeys = fullscreen.keyboardLockApiSupported && !$fullscreen.keyboardLocked; $: requestFullscreenHotkeys = $fullscreen.keyboardLockApiSupported && !$fullscreen.keyboardLocked;
async function handleClick() { async function handleClick() {
if ($fullscreen.windowFullscreen) fullscreen.exitFullscreen(); if ($fullscreen.windowFullscreen) fullscreen.exitFullscreen();
@@ -159,42 +159,54 @@
<svelte:component this={PANEL_COMPONENTS[panelType]} /> <svelte:component this={PANEL_COMPONENTS[panelType]} />
{:else} {:else}
<LayoutCol class="empty-panel" on:dragover={(e) => e.preventDefault()} on:drop={dropFile}> <LayoutCol class="empty-panel" on:dragover={(e) => e.preventDefault()} on:drop={dropFile}>
<LayoutCol class="content"> <LayoutCol class="top-spacer"></LayoutCol>
<LayoutRow class="logotype"> <LayoutCol class="content-container">
<IconLabel icon="GraphiteLogotypeSolid" /> <LayoutCol class="content">
</LayoutRow> <LayoutRow class="logotype">
<LayoutRow class="actions"> <IconLabel icon="GraphiteLogotypeSolid" />
<table> </LayoutRow>
<tbody> <LayoutRow class="actions">
<tr> <table>
<td> <tbody>
<TextButton label="New Document" icon="File" flush={true} action={() => editor.handle.newDocumentDialog()} /> <tr>
</td> <td>
<td> <TextButton label="New Document" icon="File" flush={true} action={() => editor.handle.newDocumentDialog()} />
<UserInputLabel keysWithLabelsGroups={[[...platformModifiers(true), { key: "KeyN", label: "N" }]]} /> </td>
</td> <td>
</tr> <UserInputLabel keysWithLabelsGroups={[[...platformModifiers(true), { key: "KeyN", label: "N" }]]} />
<tr> </td>
<td> </tr>
<TextButton label="Open Document" icon="Folder" flush={true} action={() => editor.handle.openDocument()} /> <tr>
</td> <td>
<td> <TextButton label="Open Document" icon="Folder" flush={true} action={() => editor.handle.openDocument()} />
<UserInputLabel keysWithLabelsGroups={[[...platformModifiers(false), { key: "KeyO", label: "O" }]]} /> </td>
</td> <td>
</tr> <UserInputLabel keysWithLabelsGroups={[[...platformModifiers(false), { key: "KeyO", label: "O" }]]} />
<tr> </td>
<td colspan="2"> </tr>
<TextButton label="Open Demo Artwork" icon="Image" flush={true} action={() => editor.handle.demoArtworkDialog()} /> <tr>
</td> <td colspan="2">
</tr> <TextButton label="Open Demo Artwork" icon="Image" flush={true} action={() => editor.handle.demoArtworkDialog()} />
<tr> </td>
<td colspan="2"> </tr>
<TextButton label="Support the Development Fund" icon="Heart" flush={true} action={() => editor.handle.visitUrl("https://graphite.rs/donate/")} /> <tr>
</td> <td colspan="2">
</tr> <TextButton label="Support the Development Fund" icon="Heart" flush={true} action={() => editor.handle.visitUrl("https://graphite.rs/donate/")} />
</tbody> </td>
</table> </tr>
</LayoutRow> </tbody>
</table>
</LayoutRow>
</LayoutCol>
</LayoutCol>
<LayoutCol class="bottom-message">
{#if new Date().getFullYear() === 2025}
<TextLabel italic={true} disabled={true}>
September 2025 release — <a href="https://youtube.com/watch?v=Vl5BA4g3QXM" target="_blank">What's new? (video)</a>
— Note: some older documents may render differently and require manual fixes.
<a href="https://ec6796b4.graphite-editor.pages.dev/" target="_blank">Need the old version?</a>
</TextLabel>
{/if}
</LayoutCol> </LayoutCol>
</LayoutCol> </LayoutCol>
{/if} {/if}
@@ -211,6 +223,7 @@
height: 28px; height: 28px;
min-height: auto; min-height: auto;
background: var(--color-1-nearblack); // Needed for the viewport hole punch on desktop background: var(--color-1-nearblack); // Needed for the viewport hole punch on desktop
flex-shrink: 0;
&.min-widths .tab-group .tab { &.min-widths .tab-group .tab {
min-width: 120px; min-width: 120px;
@@ -333,30 +346,53 @@
background: var(--color-2-mildblack); background: var(--color-2-mildblack);
margin: 4px; margin: 4px;
border-radius: 2px; border-radius: 2px;
justify-content: center; justify-content: space-between;
.content { .content-container {
flex: 0 0 auto; flex: 0 0 auto;
align-items: center; justify-content: center;
.logotype { .content {
margin-bottom: 40px; flex: 0 0 auto;
align-items: center;
svg { .logotype {
width: auto; margin-top: 8px;
height: 120px; margin-bottom: 40px;
}
}
.actions { svg {
table { width: auto;
border-spacing: 8px; height: 120px;
margin: -8px;
td {
padding: 0;
} }
} }
.actions {
margin-bottom: 8px;
table {
border-spacing: 8px;
margin: -8px;
td {
padding: 0;
}
}
}
}
}
.top-spacer {
flex: 0 1 48px;
}
.bottom-message {
flex: 0 0 48px;
align-items: center;
justify-content: end;
.text-label {
white-space: wrap;
margin: 0 1em;
} }
} }
} }
+1 -3
View File
@@ -147,9 +147,7 @@ export function createPersistenceManager(editor: Editor, portfolio: PortfolioSta
async function loadPreferences() { async function loadPreferences() {
const preferences = await get<Record<string, unknown>>("preferences", graphiteStore); const preferences = await get<Record<string, unknown>>("preferences", graphiteStore);
if (!preferences) return; editor.handle.loadPreferences(preferences ? JSON.stringify(preferences) : undefined);
editor.handle.loadPreferences(JSON.stringify(preferences));
} }
// FRONTEND MESSAGE SUBSCRIPTIONS // FRONTEND MESSAGE SUBSCRIPTIONS
+2 -3
View File
@@ -302,9 +302,8 @@ export class UpdatePlatform extends JsMessage {
readonly platform!: AppWindowPlatform; readonly platform!: AppWindowPlatform;
} }
export class UpdateWindowState extends JsMessage { export class UpdateMaximized extends JsMessage {
readonly maximized!: boolean; readonly maximized!: boolean;
readonly minimized!: boolean;
} }
export class CloseWindow extends JsMessage {} export class CloseWindow extends JsMessage {}
@@ -1694,7 +1693,7 @@ export const messageMakers: Record<string, MessageMaker> = {
UpdateLayersPanelControlBarLeftLayout, UpdateLayersPanelControlBarLeftLayout,
UpdateLayersPanelControlBarRightLayout, UpdateLayersPanelControlBarRightLayout,
UpdateLayerWidths, UpdateLayerWidths,
UpdateWindowState, UpdateMaximized,
UpdateMenuBarLayout, UpdateMenuBarLayout,
UpdateMouseCursor, UpdateMouseCursor,
UpdateNodeGraphControlBarLayout, UpdateNodeGraphControlBarLayout,
+3 -3
View File
@@ -1,7 +1,7 @@
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { type Editor } from "@graphite/editor"; import { type Editor } from "@graphite/editor";
import { type AppWindowPlatform, UpdatePlatform, UpdateViewportHolePunch, UpdateWindowState } from "@graphite/messages"; import { type AppWindowPlatform, UpdatePlatform, UpdateViewportHolePunch, UpdateMaximized as UpdateMaximized } from "@graphite/messages";
export function createAppWindowState(editor: Editor) { export function createAppWindowState(editor: Editor) {
const { subscribe, update } = writable({ const { subscribe, update } = writable({
@@ -17,9 +17,9 @@ export function createAppWindowState(editor: Editor) {
return state; return state;
}); });
}); });
editor.subscriptions.subscribeJsMessage(UpdateWindowState, (updateWindowState) => { editor.subscriptions.subscribeJsMessage(UpdateMaximized, (updateMaximized) => {
update((state) => { update((state) => {
state.maximized = updateWindowState.maximized; state.maximized = updateMaximized.maximized;
return state; return state;
}); });
}); });
+16 -12
View File
@@ -307,13 +307,6 @@ impl EditorHandle {
} }
} }
/// Minimizes the application window to the taskbar or dock
#[wasm_bindgen(js_name = appWindowMinimize)]
pub fn app_window_minimize(&self) {
let message = AppWindowMessage::AppWindowMinimize;
self.dispatch(message);
}
#[wasm_bindgen(js_name = addPrimaryImport)] #[wasm_bindgen(js_name = addPrimaryImport)]
pub fn add_primary_import(&self) { pub fn add_primary_import(&self) {
self.dispatch(DocumentMessage::AddTransaction); self.dispatch(DocumentMessage::AddTransaction);
@@ -338,6 +331,13 @@ impl EditorHandle {
self.dispatch(NodeGraphMessage::AddSecondaryExport); self.dispatch(NodeGraphMessage::AddSecondaryExport);
} }
/// Minimizes the application window to the taskbar or dock
#[wasm_bindgen(js_name = appWindowMinimize)]
pub fn app_window_minimize(&self) {
let message = AppWindowMessage::AppWindowMinimize;
self.dispatch(message);
}
/// Toggles minimizing or restoring down the application window /// Toggles minimizing or restoring down the application window
#[wasm_bindgen(js_name = appWindowMaximize)] #[wasm_bindgen(js_name = appWindowMaximize)]
pub fn app_window_maximize(&self) { pub fn app_window_maximize(&self) {
@@ -421,14 +421,18 @@ impl EditorHandle {
} }
#[wasm_bindgen(js_name = loadPreferences)] #[wasm_bindgen(js_name = loadPreferences)]
pub fn load_preferences(&self, preferences: String) { pub fn load_preferences(&self, preferences: Option<String>) {
let Ok(preferences) = serde_json::from_str(&preferences) else { let preferences = if let Some(preferences) = preferences {
log::error!("Failed to deserialize preferences"); let Ok(preferences) = serde_json::from_str(&preferences) else {
return; log::error!("Failed to deserialize preferences");
return;
};
Some(preferences)
} else {
None
}; };
let message = PreferencesMessage::Load { preferences }; let message = PreferencesMessage::Load { preferences };
self.dispatch(message); self.dispatch(message);
} }
-4
View File
@@ -222,10 +222,6 @@ pub trait GetEditorPreferences {
pub enum ExportFormat { pub enum ExportFormat {
#[default] #[default]
Svg, Svg,
Png {
transparent: bool,
},
Jpeg,
Canvas, Canvas,
Texture, Texture,
} }
+2
View File
@@ -40,6 +40,8 @@ lyon_geom = { workspace = true }
log = { workspace = true } log = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
poly-cool = { workspace = true } poly-cool = { workspace = true }
vtracer = { workspace = true }
visioncortex = { workspace = true }
# Optional workspace dependencies # Optional workspace dependencies
serde = { workspace = true, optional = true } serde = { workspace = true, optional = true }
+1 -1
View File
@@ -338,7 +338,7 @@ async fn wrap_graphic<T: Into<Graphic> + 'n>(
/// Converts a table of graphical content into a graphic table by placing it into an element of a new wrapper graphic table. /// Converts a table of graphical content into a graphic table by placing it into an element of a new wrapper graphic table.
/// If it is already a graphic table, it is not wrapped again. Use the 'Wrap Graphic' node if wrapping is always desired. /// If it is already a graphic table, it is not wrapped again. Use the 'Wrap Graphic' node if wrapping is always desired.
#[node_macro::node(category("Type Conversion"))] #[node_macro::node(category("General"))]
async fn to_graphic<T: Into<Table<Graphic>> + 'n>( async fn to_graphic<T: Into<Table<Graphic>> + 'n>(
_: impl Ctx, _: impl Ctx,
#[implementations( #[implementations(
+21 -7
View File
@@ -9,9 +9,9 @@ use crate::vector::Vector;
use crate::{Context, Ctx}; use crate::{Context, Ctx};
use glam::{DAffine2, DVec2}; use glam::{DAffine2, DVec2};
#[node_macro::node(category("Type Conversion"))] #[node_macro::node(category("Debug"))]
fn to_string<T: std::fmt::Debug>(_: impl Ctx, #[implementations(bool, f64, u32, u64, DVec2, DAffine2, String)] value: T) -> String { fn to_string(_: impl Ctx, value: String) -> String {
format!("{value:?}") value
} }
#[node_macro::node(category("Text"))] #[node_macro::node(category("Text"))]
@@ -34,10 +34,24 @@ fn string_replace(_: impl Ctx, string: String, from: TextArea, to: TextArea) ->
#[node_macro::node(category("Text"))] #[node_macro::node(category("Text"))]
fn string_slice(_: impl Ctx, string: String, start: f64, end: f64) -> String { fn string_slice(_: impl Ctx, string: String, start: f64, end: f64) -> String {
let start = if start < 0. { string.len() - start.abs() as usize } else { start as usize }; let total_chars = string.chars().count();
let end = if end <= 0. { string.len() - end.abs() as usize } else { end as usize };
let n = end.saturating_sub(start); let start = if start < 0. {
string.char_indices().skip(start).take(n).map(|(_, c)| c).collect() total_chars.saturating_sub(start.abs() as usize)
} else {
(start as usize).min(total_chars)
};
let end = if end <= 0. {
total_chars.saturating_sub(end.abs() as usize)
} else {
(end as usize).min(total_chars)
};
if start >= end {
return String::new();
}
string.chars().skip(start).take(end - start).collect()
} }
// TODO: Return u32, u64, or usize instead of f64 after #1621 is resolved and has allowed us to implement automatic type conversion in the node graph for nodes with generic type inputs. // TODO: Return u32, u64, or usize instead of f64 after #1621 is resolved and has allowed us to implement automatic type conversion in the node graph for nodes with generic type inputs.
+9 -9
View File
@@ -1,6 +1,6 @@
use graphene_core_shaders::Ctx; use graphene_core_shaders::Ctx;
use crate::Node; use crate::{ExtractFootprint, Node, transform::Footprint};
use std::marker::PhantomData; use std::marker::PhantomData;
// TODO: Rename to "Passthrough" // TODO: Rename to "Passthrough"
@@ -50,16 +50,16 @@ fn into<'i, T: 'i + Send + Into<O>, O: 'i + Send>(_: impl Ctx, value: T, _out_ty
/// The [`Convert`] trait allows for conversion between Rust primitive numeric types. /// The [`Convert`] trait allows for conversion between Rust primitive numeric types.
/// Because number casting is lossy, we cannot use the normal [`Into`] trait like we do for other types. /// Because number casting is lossy, we cannot use the normal [`Into`] trait like we do for other types.
pub trait Convert<T>: Sized { pub trait Convert<T, C>: Sized {
/// Converts this type into the (usually inferred) output type. /// Converts this type into the (usually inferred) output type.
#[must_use] #[must_use]
fn convert(self) -> T; fn convert(self, footprint: Footprint, converter: C) -> impl Future<Output = T> + Send;
} }
impl<T: ToString> Convert<String> for T { impl<T: ToString + Send> Convert<String, ()> for T {
/// Converts this type into a `String` using its `ToString` implementation. /// Converts this type into a `String` using its `ToString` implementation.
#[inline] #[inline]
fn convert(self) -> String { async fn convert(self, _: Footprint, _converter: ()) -> String {
self.to_string() self.to_string()
} }
} }
@@ -67,8 +67,8 @@ impl<T: ToString> Convert<String> for T {
/// Implements the [`Convert`] trait for conversion between the cartesian product of Rust's primitive numeric types. /// Implements the [`Convert`] trait for conversion between the cartesian product of Rust's primitive numeric types.
macro_rules! impl_convert { macro_rules! impl_convert {
($from:ty, $to:ty) => { ($from:ty, $to:ty) => {
impl Convert<$to> for $from { impl Convert<$to, ()> for $from {
fn convert(self) -> $to { async fn convert(self, _: Footprint, _: ()) -> $to {
self as $to self as $to
} }
} }
@@ -106,8 +106,8 @@ impl_convert!(isize);
impl_convert!(usize); impl_convert!(usize);
#[node_macro::node(skip_impl)] #[node_macro::node(skip_impl)]
fn convert<'i, T: 'i + Send + Convert<O>, O: 'i + Send>(_: impl Ctx, value: T, _out_ty: PhantomData<O>) -> O { async fn convert<'i, T: 'i + Send + Convert<O, C>, O: 'i + Send, C: 'i + Send>(ctx: impl Ctx + ExtractFootprint, value: T, converter: C, _out_ty: PhantomData<O>) -> O {
value.convert() value.convert(*ctx.try_footprint().unwrap_or(&Footprint::DEFAULT), converter).await
} }
#[cfg(test)] #[cfg(test)]
+1 -1
View File
@@ -9,7 +9,7 @@ use std::sync::{LazyLock, Mutex};
pub use graphene_core_shaders::registry::types; pub use graphene_core_shaders::registry::types;
// Translation struct between macro and definition // Translation struct between macro and definition
#[derive(Clone)] #[derive(Clone, Debug)]
pub struct NodeMetadata { pub struct NodeMetadata {
pub display_name: &'static str, pub display_name: &'static str,
pub category: Option<&'static str>, pub category: Option<&'static str>,
+28
View File
@@ -1,8 +1,11 @@
mod font_cache; mod font_cache;
mod path_builder;
mod text_context;
mod to_path; mod to_path;
use dyn_any::DynAny; use dyn_any::DynAny;
pub use font_cache::*; pub use font_cache::*;
pub use text_context::TextContext;
pub use to_path::*; pub use to_path::*;
/// Alignment of lines of type within a text block. /// Alignment of lines of type within a text block.
@@ -29,3 +32,28 @@ impl From<TextAlign> for parley::Alignment {
} }
} }
} }
#[derive(PartialEq, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub struct TypesettingConfig {
pub font_size: f64,
pub line_height_ratio: f64,
pub character_spacing: f64,
pub max_width: Option<f64>,
pub max_height: Option<f64>,
pub tilt: f64,
pub align: TextAlign,
}
impl Default for TypesettingConfig {
fn default() -> Self {
Self {
font_size: 24.,
line_height_ratio: 1.2,
character_spacing: 0.,
max_width: None,
max_height: None,
tilt: 0.,
align: TextAlign::default(),
}
}
}
+9 -2
View File
@@ -1,5 +1,7 @@
use dyn_any::DynAny; use dyn_any::DynAny;
use parley::fontique::Blob;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc;
/// A font type (storing font family and font style and an optional preview URL) /// A font type (storing font family and font style and an optional preview URL)
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Hash, PartialEq, Eq, DynAny, specta::Type)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Hash, PartialEq, Eq, DynAny, specta::Type)]
@@ -50,8 +52,13 @@ impl FontCache {
} }
/// Try to get the bytes for a font /// Try to get the bytes for a font
pub fn get(&self, font: &Font) -> Option<&Vec<u8>> { pub fn get<'a>(&'a self, font: &'a Font) -> Option<(&'a Vec<u8>, &'a Font)> {
self.resolve_font(font).and_then(|font| self.font_file_data.get(font)) self.resolve_font(font).and_then(|font| self.font_file_data.get(font).map(|data| (data, font)))
}
/// Get font data as a Blob for use with parley/skrifa
pub fn get_blob<'a>(&'a self, font: &'a Font) -> Option<(Blob<u8>, &'a Font)> {
self.get(font).map(|(data, font)| (Blob::new(Arc::new(data.clone())), font))
} }
/// Check if the font is already loaded /// Check if the font is already loaded
+158
View File
@@ -0,0 +1,158 @@
use crate::subpath::{ManipulatorGroup, Subpath};
use crate::table::{Table, TableRow};
use crate::vector::{PointId, Vector};
use glam::{DAffine2, DVec2};
use parley::GlyphRun;
use skrifa::GlyphId;
use skrifa::instance::{LocationRef, NormalizedCoord, Size};
use skrifa::outline::{DrawSettings, OutlinePen};
use skrifa::raw::FontRef as ReadFontsRef;
use skrifa::{MetadataProvider, OutlineGlyph};
pub struct PathBuilder {
current_subpath: Subpath<PointId>,
origin: DVec2,
glyph_subpaths: Vec<Subpath<PointId>>,
pub vector_table: Table<Vector>,
scale: f64,
id: PointId,
}
impl PathBuilder {
pub fn new(per_glyph_instances: bool, scale: f64) -> Self {
Self {
current_subpath: Subpath::new(Vec::new(), false),
glyph_subpaths: Vec::new(),
vector_table: if per_glyph_instances { Table::new() } else { Table::new_from_element(Vector::default()) },
scale,
id: PointId::ZERO,
origin: DVec2::default(),
}
}
fn point(&self, x: f32, y: f32) -> DVec2 {
DVec2::new(self.origin.x + x as f64, self.origin.y - y as f64) * self.scale
}
#[allow(clippy::too_many_arguments)]
fn draw_glyph(&mut self, glyph: &OutlineGlyph<'_>, size: f32, normalized_coords: &[NormalizedCoord], glyph_offset: DVec2, style_skew: Option<DAffine2>, skew: DAffine2, per_glyph_instances: bool) {
let location_ref = LocationRef::new(normalized_coords);
let settings = DrawSettings::unhinted(Size::new(size), location_ref);
glyph.draw(settings, self).unwrap();
// Apply transforms in correct order: style-based skew first, then user-requested skew
// This ensures font synthesis (italic) is applied before user transformations
for glyph_subpath in &mut self.glyph_subpaths {
if let Some(style_skew) = style_skew {
glyph_subpath.apply_transform(style_skew);
}
glyph_subpath.apply_transform(skew);
}
if per_glyph_instances {
self.vector_table.push(TableRow {
element: Vector::from_subpaths(core::mem::take(&mut self.glyph_subpaths), false),
transform: DAffine2::from_translation(glyph_offset),
..Default::default()
});
} else {
for subpath in self.glyph_subpaths.drain(..) {
// Unwrapping here is ok because `self.vector_table` is initialized with a single `Vector` table element
self.vector_table.get_mut(0).unwrap().element.append_subpath(subpath, false);
}
}
}
pub fn render_glyph_run(&mut self, glyph_run: &GlyphRun<'_, ()>, tilt: f64, per_glyph_instances: bool) {
let mut run_x = glyph_run.offset();
let run_y = glyph_run.baseline();
let run = glyph_run.run();
// User-requested tilt applied around baseline to avoid vertical displacement
// Translation ensures rotation point is at the baseline, not origin
let skew = if per_glyph_instances {
DAffine2::from_cols_array(&[1., 0., -tilt.to_radians().tan(), 1., 0., 0.])
} else {
DAffine2::from_translation(DVec2::new(0., run_y as f64))
* DAffine2::from_cols_array(&[1., 0., -tilt.to_radians().tan(), 1., 0., 0.])
* DAffine2::from_translation(DVec2::new(0., -run_y as f64))
};
let synthesis = run.synthesis();
// Font synthesis (e.g., synthetic italic) applied separately from user transforms
// This preserves the distinction between font styling and user transformations
let style_skew = synthesis.skew().map(|angle| {
if per_glyph_instances {
DAffine2::from_cols_array(&[1., 0., -angle.to_radians().tan() as f64, 1., 0., 0.])
} else {
DAffine2::from_translation(DVec2::new(0., run_y as f64))
* DAffine2::from_cols_array(&[1., 0., -angle.to_radians().tan() as f64, 1., 0., 0.])
* DAffine2::from_translation(DVec2::new(0., -run_y as f64))
}
});
let font = run.font();
let font_size = run.font_size();
let normalized_coords = run.normalized_coords().iter().map(|coord| NormalizedCoord::from_bits(*coord)).collect::<Vec<_>>();
// TODO: This can be cached for better performance
let font_collection_ref = font.data.as_ref();
let font_ref = ReadFontsRef::from_index(font_collection_ref, font.index).unwrap();
let outlines = font_ref.outline_glyphs();
for glyph in glyph_run.glyphs() {
let glyph_offset = DVec2::new((run_x + glyph.x) as f64, (run_y - glyph.y) as f64);
run_x += glyph.advance;
let glyph_id = GlyphId::from(glyph.id);
if let Some(glyph_outline) = outlines.get(glyph_id) {
if !per_glyph_instances {
self.origin = glyph_offset;
}
self.draw_glyph(&glyph_outline, font_size, &normalized_coords, glyph_offset, style_skew, skew, per_glyph_instances);
}
}
}
pub fn finalize(mut self) -> Table<Vector> {
if self.vector_table.is_empty() {
self.vector_table = Table::new_from_element(Vector::default());
}
self.vector_table
}
}
impl OutlinePen for PathBuilder {
fn move_to(&mut self, x: f32, y: f32) {
if !self.current_subpath.is_empty() {
self.glyph_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
}
fn line_to(&mut self, x: f32, y: f32) {
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
}
fn quad_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) {
let [handle, anchor] = [self.point(x1, y1), self.point(x2, y2)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle);
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, None, None, self.id.next_id()));
}
fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) {
let [handle1, handle2, anchor] = [self.point(x1, y1), self.point(x2, y2), self.point(x3, y3)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle1);
self.current_subpath
.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, Some(handle2), None, self.id.next_id()));
}
fn close(&mut self) {
self.current_subpath.set_closed(true);
self.glyph_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
}
+129
View File
@@ -0,0 +1,129 @@
use super::{Font, FontCache, TypesettingConfig};
use crate::table::Table;
use crate::vector::Vector;
use core::cell::RefCell;
use glam::DVec2;
use parley::fontique::{Blob, FamilyId, FontInfo};
use parley::{AlignmentOptions, FontContext, Layout, LayoutContext, LineHeight, PositionedLayoutItem, StyleProperty};
use std::collections::HashMap;
use super::path_builder::PathBuilder;
thread_local! {
static THREAD_TEXT: RefCell<TextContext> = RefCell::new(TextContext::default());
}
/// Unified thread-local text processing context that combines font and layout management
/// for efficient text rendering operations.
#[derive(Default)]
pub struct TextContext {
font_context: FontContext,
layout_context: LayoutContext<()>,
/// Cached font metadata for performance optimization
font_info_cache: HashMap<Font, (FamilyId, FontInfo)>,
}
impl TextContext {
/// Access the thread-local TextContext instance for text processing operations
pub fn with_thread_local<F, R>(f: F) -> R
where
F: FnOnce(&mut TextContext) -> R,
{
THREAD_TEXT.with_borrow_mut(f)
}
/// Resolve a font and return its data as a Blob if available
fn resolve_font_data<'a>(&self, font: &'a Font, font_cache: &'a FontCache) -> Option<(Blob<u8>, &'a Font)> {
font_cache.get_blob(font)
}
/// Get or cache font information for a given font
fn get_font_info(&mut self, font: &Font, font_data: &Blob<u8>) -> Option<(String, FontInfo)> {
// Check if we already have the font info cached
if let Some((family_id, font_info)) = self.font_info_cache.get(font) {
if let Some(family_name) = self.font_context.collection.family_name(*family_id) {
return Some((family_name.to_string(), font_info.clone()));
}
}
// Register the font and cache the info
let families = self.font_context.collection.register_fonts(font_data.clone(), None);
families.first().and_then(|(family_id, fonts_info)| {
fonts_info.first().and_then(|font_info| {
self.font_context.collection.family_name(*family_id).map(|family_name| {
// Cache the font info for future use
self.font_info_cache.insert(font.clone(), (*family_id, font_info.clone()));
(family_name.to_string(), font_info.clone())
})
})
})
}
/// Create a text layout using the specified font and typesetting configuration
fn layout_text(&mut self, text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig) -> Option<Layout<()>> {
// Note that the actual_font may not be the desired font if that font is not yet loaded.
// It is important not to cache the default font under the name of another font.
let (font_data, actual_font) = self.resolve_font_data(font, font_cache)?;
let (font_family, font_info) = self.get_font_info(actual_font, &font_data)?;
const DISPLAY_SCALE: f32 = 1.;
let mut builder = self.layout_context.ranged_builder(&mut self.font_context, text, DISPLAY_SCALE, false);
builder.push_default(StyleProperty::FontSize(typesetting.font_size as f32));
builder.push_default(StyleProperty::LetterSpacing(typesetting.character_spacing as f32));
builder.push_default(StyleProperty::FontStack(parley::FontStack::Single(parley::FontFamily::Named(std::borrow::Cow::Owned(font_family)))));
builder.push_default(StyleProperty::FontWeight(font_info.weight()));
builder.push_default(StyleProperty::FontStyle(font_info.style()));
builder.push_default(StyleProperty::FontWidth(font_info.width()));
builder.push_default(LineHeight::FontSizeRelative(typesetting.line_height_ratio as f32));
let mut layout: Layout<()> = builder.build(text);
layout.break_all_lines(typesetting.max_width.map(|mw| mw as f32));
layout.align(typesetting.max_width.map(|max_w| max_w as f32), typesetting.align.into(), AlignmentOptions::default());
Some(layout)
}
/// Convert text to vector paths using the specified font and typesetting configuration
pub fn to_path(&mut self, text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig, per_glyph_instances: bool) -> Table<Vector> {
let Some(layout) = self.layout_text(text, font, font_cache, typesetting) else {
return Table::new_from_element(Vector::default());
};
let mut path_builder = PathBuilder::new(per_glyph_instances, layout.scale() as f64);
for line in layout.lines() {
for item in line.items() {
if let PositionedLayoutItem::GlyphRun(glyph_run) = item {
path_builder.render_glyph_run(&glyph_run, typesetting.tilt, per_glyph_instances);
}
}
}
path_builder.finalize()
}
/// Calculate the bounding box of text using the specified font and typesetting configuration
pub fn bounding_box(&mut self, text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig, for_clipping_test: bool) -> DVec2 {
if !for_clipping_test {
if let (Some(max_height), Some(max_width)) = (typesetting.max_height, typesetting.max_width) {
return DVec2::new(max_width, max_height);
}
}
let Some(layout) = self.layout_text(text, font, font_cache, typesetting) else {
return DVec2::ZERO;
};
DVec2::new(layout.full_width() as f64, layout.height() as f64)
}
/// Check if text lines are being clipped due to height constraints
pub fn lines_clipping(&mut self, text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig) -> bool {
let Some(max_height) = typesetting.max_height else { return false };
let bounds = self.bounding_box(text, font, font_cache, typesetting, true);
max_height < bounds.y
}
}
+11 -244
View File
@@ -1,256 +1,23 @@
use super::TextAlign; use super::text_context::TextContext;
use crate::subpath::{ManipulatorGroup, Subpath}; use super::{Font, FontCache, TypesettingConfig};
use crate::table::{Table, TableRow}; use crate::table::Table;
use crate::vector::{PointId, Vector}; use crate::vector::Vector;
use core::cell::RefCell; use glam::DVec2;
use glam::{DAffine2, DVec2};
use parley::fontique::Blob; use parley::fontique::Blob;
use parley::{AlignmentOptions, FontContext, GlyphRun, Layout, LayoutContext, LineHeight, PositionedLayoutItem, StyleProperty};
use skrifa::GlyphId;
use skrifa::instance::{LocationRef, NormalizedCoord, Size};
use skrifa::outline::{DrawSettings, OutlinePen};
use skrifa::raw::FontRef as ReadFontsRef;
use skrifa::{MetadataProvider, OutlineGlyph};
use std::sync::Arc; use std::sync::Arc;
// Thread-local storage avoids expensive re-initialization of font and layout contexts pub fn to_path(text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig, per_glyph_instances: bool) -> Table<Vector> {
// across multiple text rendering operations within the same thread TextContext::with_thread_local(|ctx| ctx.to_path(text, font, font_cache, typesetting, per_glyph_instances))
thread_local! {
static FONT_CONTEXT: RefCell<FontContext> = RefCell::new(FontContext::new());
static LAYOUT_CONTEXT: RefCell<LayoutContext<()>> = RefCell::new(LayoutContext::new());
} }
struct PathBuilder { pub fn bounding_box(text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig, for_clipping_test: bool) -> DVec2 {
current_subpath: Subpath<PointId>, TextContext::with_thread_local(|ctx| ctx.bounding_box(text, font, font_cache, typesetting, for_clipping_test))
origin: DVec2,
glyph_subpaths: Vec<Subpath<PointId>>,
vector_table: Table<Vector>,
scale: f64,
id: PointId,
}
impl PathBuilder {
fn point(&self, x: f32, y: f32) -> DVec2 {
DVec2::new(self.origin.x + x as f64, self.origin.y - y as f64) * self.scale
}
#[allow(clippy::too_many_arguments)]
fn draw_glyph(&mut self, glyph: &OutlineGlyph<'_>, size: f32, normalized_coords: &[NormalizedCoord], glyph_offset: DVec2, style_skew: Option<DAffine2>, skew: DAffine2, per_glyph_instances: bool) {
let location_ref = LocationRef::new(normalized_coords);
let settings = DrawSettings::unhinted(Size::new(size), location_ref);
glyph.draw(settings, self).unwrap();
// Apply transforms in correct order: style-based skew first, then user-requested skew
// This ensures font synthesis (italic) is applied before user transformations
for glyph_subpath in &mut self.glyph_subpaths {
if let Some(style_skew) = style_skew {
glyph_subpath.apply_transform(style_skew);
}
glyph_subpath.apply_transform(skew);
}
if per_glyph_instances {
self.vector_table.push(TableRow {
element: Vector::from_subpaths(core::mem::take(&mut self.glyph_subpaths), false),
transform: DAffine2::from_translation(glyph_offset),
..Default::default()
});
} else {
for subpath in self.glyph_subpaths.drain(..) {
// Unwrapping here is ok because `self.vector_table` is initialized with a single `Vector` table element
self.vector_table.get_mut(0).unwrap().element.append_subpath(subpath, false);
}
}
}
}
impl OutlinePen for PathBuilder {
fn move_to(&mut self, x: f32, y: f32) {
if !self.current_subpath.is_empty() {
self.glyph_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
}
fn line_to(&mut self, x: f32, y: f32) {
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
}
fn quad_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) {
let [handle, anchor] = [self.point(x1, y1), self.point(x2, y2)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle);
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, None, None, self.id.next_id()));
}
fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) {
let [handle1, handle2, anchor] = [self.point(x1, y1), self.point(x2, y2), self.point(x3, y3)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle1);
self.current_subpath
.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, Some(handle2), None, self.id.next_id()));
}
fn close(&mut self) {
self.current_subpath.set_closed(true);
self.glyph_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
}
}
#[derive(PartialEq, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub struct TypesettingConfig {
pub font_size: f64,
pub line_height_ratio: f64,
pub character_spacing: f64,
pub max_width: Option<f64>,
pub max_height: Option<f64>,
pub tilt: f64,
pub align: TextAlign,
}
impl Default for TypesettingConfig {
fn default() -> Self {
Self {
font_size: 24.,
line_height_ratio: 1.2,
character_spacing: 0.,
max_width: None,
max_height: None,
tilt: 0.,
align: TextAlign::default(),
}
}
}
fn render_glyph_run(glyph_run: &GlyphRun<'_, ()>, path_builder: &mut PathBuilder, tilt: f64, per_glyph_instances: bool) {
let mut run_x = glyph_run.offset();
let run_y = glyph_run.baseline();
let run = glyph_run.run();
// User-requested tilt applied around baseline to avoid vertical displacement
// Translation ensures rotation point is at the baseline, not origin
let skew = if per_glyph_instances {
DAffine2::from_cols_array(&[1., 0., -tilt.to_radians().tan(), 1., 0., 0.])
} else {
DAffine2::from_translation(DVec2::new(0., run_y as f64))
* DAffine2::from_cols_array(&[1., 0., -tilt.to_radians().tan(), 1., 0., 0.])
* DAffine2::from_translation(DVec2::new(0., -run_y as f64))
};
let synthesis = run.synthesis();
// Font synthesis (e.g., synthetic italic) applied separately from user transforms
// This preserves the distinction between font styling and user transformations
let style_skew = synthesis.skew().map(|angle| {
if per_glyph_instances {
DAffine2::from_cols_array(&[1., 0., -angle.to_radians().tan() as f64, 1., 0., 0.])
} else {
DAffine2::from_translation(DVec2::new(0., run_y as f64))
* DAffine2::from_cols_array(&[1., 0., -angle.to_radians().tan() as f64, 1., 0., 0.])
* DAffine2::from_translation(DVec2::new(0., -run_y as f64))
}
});
let font = run.font();
let font_size = run.font_size();
let normalized_coords = run.normalized_coords().iter().map(|coord| NormalizedCoord::from_bits(*coord)).collect::<Vec<_>>();
// TODO: This can be cached for better performance
let font_collection_ref = font.data.as_ref();
let font_ref = ReadFontsRef::from_index(font_collection_ref, font.index).unwrap();
let outlines = font_ref.outline_glyphs();
for glyph in glyph_run.glyphs() {
let glyph_offset = DVec2::new((run_x + glyph.x) as f64, (run_y - glyph.y) as f64);
run_x += glyph.advance;
let glyph_id = GlyphId::from(glyph.id);
if let Some(glyph_outline) = outlines.get(glyph_id) {
if !per_glyph_instances {
path_builder.origin = glyph_offset;
}
path_builder.draw_glyph(&glyph_outline, font_size, &normalized_coords, glyph_offset, style_skew, skew, per_glyph_instances);
}
}
}
fn layout_text(str: &str, font_data: Option<Blob<u8>>, typesetting: TypesettingConfig) -> Option<Layout<()>> {
FONT_CONTEXT.with_borrow_mut(|mut font_cx| {
LAYOUT_CONTEXT.with_borrow_mut(|layout_cx| {
let font_family = font_data.and_then(|font_data| {
font_cx
.collection
.register_fonts(font_data, None)
.first()
.and_then(|(family_id, _)| font_cx.collection.family_name(*family_id).map(String::from))
})?;
const DISPLAY_SCALE: f32 = 1.;
let mut builder = layout_cx.ranged_builder(&mut font_cx, str, DISPLAY_SCALE, false);
builder.push_default(StyleProperty::FontSize(typesetting.font_size as f32));
builder.push_default(StyleProperty::LetterSpacing(typesetting.character_spacing as f32));
builder.push_default(StyleProperty::FontStack(parley::FontStack::Single(parley::FontFamily::Named(std::borrow::Cow::Owned(font_family)))));
builder.push_default(LineHeight::FontSizeRelative(typesetting.line_height_ratio as f32));
let mut layout: Layout<()> = builder.build(str);
layout.break_all_lines(typesetting.max_width.map(|mw| mw as f32));
layout.align(typesetting.max_width.map(|max_w| max_w as f32), typesetting.align.into(), AlignmentOptions::default());
Some(layout)
})
})
}
pub fn to_path(str: &str, font_data: Option<Blob<u8>>, typesetting: TypesettingConfig, per_glyph_instances: bool) -> Table<Vector> {
let Some(layout) = layout_text(str, font_data, typesetting) else {
return Table::new_from_element(Vector::default());
};
let mut path_builder = PathBuilder {
current_subpath: Subpath::new(Vec::new(), false),
glyph_subpaths: Vec::new(),
vector_table: if per_glyph_instances { Table::new() } else { Table::new_from_element(Vector::default()) },
scale: layout.scale() as f64,
id: PointId::ZERO,
origin: DVec2::default(),
};
for line in layout.lines() {
for item in line.items() {
if let PositionedLayoutItem::GlyphRun(glyph_run) = item {
render_glyph_run(&glyph_run, &mut path_builder, typesetting.tilt, per_glyph_instances);
}
}
}
if path_builder.vector_table.is_empty() {
path_builder.vector_table = Table::new_from_element(Vector::default());
}
path_builder.vector_table
}
pub fn bounding_box(str: &str, font_data: Option<Blob<u8>>, typesetting: TypesettingConfig, for_clipping_test: bool) -> DVec2 {
if !for_clipping_test {
if let (Some(max_height), Some(max_width)) = (typesetting.max_height, typesetting.max_width) {
return DVec2::new(max_width, max_height);
}
}
let Some(layout) = layout_text(str, font_data, typesetting) else { return DVec2::ZERO };
DVec2::new(layout.full_width() as f64, layout.height() as f64)
} }
pub fn load_font(data: &[u8]) -> Blob<u8> { pub fn load_font(data: &[u8]) -> Blob<u8> {
Blob::new(Arc::new(data.to_vec())) Blob::new(Arc::new(data.to_vec()))
} }
pub fn lines_clipping(str: &str, font_data: Option<Blob<u8>>, typesetting: TypesettingConfig) -> bool { pub fn lines_clipping(text: &str, font: &Font, font_cache: &FontCache, typesetting: TypesettingConfig) -> bool {
let Some(max_height) = typesetting.max_height else { return false }; TextContext::with_thread_local(|ctx| ctx.lines_clipping(text, font, font_cache, typesetting))
let bounds = bounding_box(str, font_data, typesetting, true);
max_height < bounds.y
} }
@@ -0,0 +1,62 @@
use glam::DVec2;
/// Implements the Ramer-Douglas-Peucker algorithm to find indices of points to keep.
pub fn ramer_douglas_peucker(points: &[DVec2], epsilon: f64) -> Vec<usize> {
if points.len() <= 2 {
return (0..points.len()).collect();
}
let mut kept_indices = Vec::new();
rdp_recursive(points, 0, points.len() - 1, epsilon, &mut kept_indices);
kept_indices.sort_unstable();
kept_indices.dedup();
kept_indices
}
pub fn rdp_recursive(points: &[DVec2], start_idx: usize, end_idx: usize, epsilon: f64, kept_indices: &mut Vec<usize>) {
if start_idx >= end_idx {
return;
}
let mut dmax = 0.0;
let mut index = start_idx;
// Find the point with maximum perpendicular distance from the line segment
for i in (start_idx + 1)..end_idx {
let d = perpendicular_distance(points[i], points[start_idx], points[end_idx]);
if d > dmax {
index = i;
dmax = d;
}
}
// If max distance is greater than epsilon, recursively simplify
if dmax > epsilon {
rdp_recursive(points, start_idx, index, epsilon, kept_indices);
rdp_recursive(points, index, end_idx, epsilon, kept_indices);
} else {
// Keep only the endpoints
kept_indices.push(start_idx);
kept_indices.push(end_idx);
}
}
/// Calculates the perpendicular distance from a point to a line defined by two endpoints.
pub fn perpendicular_distance(point: DVec2, line_start: DVec2, line_end: DVec2) -> f64 {
let dx = line_end.x - line_start.x;
let dy = line_end.y - line_start.y;
let line_length_squared = dx * dx + dy * dy;
// If the line segment is actually a point, return the distance to that point
if line_length_squared == 0.0 {
return point.distance(line_start);
}
// Calculate perpendicular distance using the cross product formula:
// distance = |dy·px - dx·py + x2·y1 - y2·x1| / √(dx² + dy²)
let numerator = (dy * point.x - dx * point.y + line_end.x * line_start.y - line_end.y * line_start.x).abs();
let denominator = line_length_squared.sqrt();
numerator / denominator
}
@@ -1,5 +1,6 @@
pub mod bezpath_algorithms; pub mod bezpath_algorithms;
mod contants; mod contants;
pub mod decimation;
pub mod instance; pub mod instance;
pub mod intersection; pub mod intersection;
pub mod merge_by_distance; pub mod merge_by_distance;
@@ -7,3 +8,4 @@ pub mod offset_subpath;
pub mod poisson_disk; pub mod poisson_disk;
pub mod spline; pub mod spline;
pub mod util; pub mod util;
pub mod vectorize;
@@ -0,0 +1,357 @@
use crate::{
Graphic,
raster_types::{CPU, Raster},
table::{Table, TableRow, TableRowRef},
vector::Vector,
vector::VectorExt,
vector::style::Fill,
};
use glam::{DAffine2, DVec2};
use graphene_core_shaders::color::Color;
use kurbo::{BezPath, PathEl};
use visioncortex::PathSimplifyMode;
use vtracer::{ColorMode, Config, Hierarchical};
/// Parses SVG path data and appends it to a Vector
pub fn parse_svg_paths_to_vector(svg_content: &str) -> Vec<TableRow<Vector>> {
let mut rows = Vec::new();
for element in extract_path_elements(svg_content) {
let attributes = parse_path_attributes(&element);
let Some(path_data) = attribute_value(&attributes, "d") else { continue };
let Ok(bezpath) = BezPath::from_svg(path_data) else { continue };
let fill = parse_fill_attribute(attribute_value(&attributes, "fill"));
let transform = parse_transform_attribute(attribute_value(&attributes, "transform"));
for subpath in split_bezpath_subpaths(&bezpath) {
if subpath.elements().is_empty() {
continue;
}
let mut vector = Vector::default();
vector.append_bezpath(subpath);
vector.style.set_fill(fill.clone());
let mut table_row = TableRow::new_from_element(vector);
table_row.transform = transform;
rows.push(table_row);
}
}
rows
}
fn split_bezpath_subpaths(bezpath: &BezPath) -> Vec<BezPath> {
let mut subpaths = Vec::new();
let mut current = BezPath::new();
for element in bezpath.elements() {
match element {
PathEl::MoveTo(_) => {
if !current.is_empty() {
subpaths.push(std::mem::take(&mut current));
}
current.push(*element);
}
PathEl::ClosePath => {
current.close_path();
subpaths.push(std::mem::take(&mut current));
}
_ => current.push(*element),
}
}
if !current.is_empty() {
subpaths.push(current);
}
subpaths
}
pub fn extract_path_elements(svg_content: &str) -> Vec<String> {
let mut elements = Vec::new();
let mut search_start = 0;
while let Some(relative_start) = svg_content[search_start..].find("<path") {
let start = search_start + relative_start;
let mut index = start + "<path".len();
let mut in_quotes = false;
let mut quote_char = '\0';
while index < svg_content.len() {
let ch = svg_content.as_bytes()[index] as char;
match ch {
'"' | '\'' if !in_quotes => {
in_quotes = true;
quote_char = ch;
}
c if c == quote_char && in_quotes => {
in_quotes = false;
}
'>' if !in_quotes => {
elements.push(svg_content[start..=index].to_string());
search_start = index + 1;
break;
}
_ => {}
}
index += 1;
}
if index >= svg_content.len() {
break;
}
}
elements
}
pub fn is_attribute_name_char(ch: char) -> bool {
ch.is_ascii_alphanumeric() || matches!(ch, '-' | '_' | ':' | '.')
}
pub fn parse_path_attributes(element: &str) -> Vec<(String, String)> {
let mut attributes = Vec::new();
let mut body = element.trim();
if let Some(start) = body.find("<path") {
body = &body[start + "<path".len()..];
} else {
return attributes;
}
if let Some(end) = body.rfind('>') {
body = &body[..end];
}
body = body.trim();
if let Some(stripped) = body.strip_suffix('/') {
body = stripped.trim_end();
}
let bytes = body.as_bytes();
let mut index = 0;
while index < bytes.len() {
while index < bytes.len() && bytes[index].is_ascii_whitespace() {
index += 1;
}
if index >= bytes.len() || bytes[index] == b'/' {
break;
}
let name_start = index;
while index < bytes.len() && is_attribute_name_char(body.as_bytes()[index] as char) {
index += 1;
}
if name_start == index {
index += 1;
continue;
}
let name = body[name_start..index].trim();
while index < bytes.len() && bytes[index].is_ascii_whitespace() {
index += 1;
}
if index >= bytes.len() || bytes[index] != b'=' {
while index < bytes.len() && !bytes[index].is_ascii_whitespace() && bytes[index] != b'/' {
index += 1;
}
continue;
}
index += 1;
while index < bytes.len() && bytes[index].is_ascii_whitespace() {
index += 1;
}
if index >= bytes.len() {
break;
}
let mut value = String::new();
if bytes[index] == b'"' || bytes[index] == b'\'' {
let quote = bytes[index];
index += 1;
let value_start = index;
while index < bytes.len() && bytes[index] != quote {
index += 1;
}
value.push_str(body[value_start..index.min(bytes.len())].trim());
if index < bytes.len() {
index += 1;
}
} else {
let value_start = index;
while index < bytes.len() && !bytes[index].is_ascii_whitespace() && bytes[index] != b'/' {
index += 1;
}
value.push_str(body[value_start..index].trim());
}
attributes.push((name.to_string(), value));
}
attributes
}
pub fn attribute_value<'a>(attributes: &'a [(String, String)], name: &str) -> Option<&'a str> {
attributes.iter().find_map(|(key, value)| (key == name).then_some(value.as_str()))
}
pub fn parse_fill_attribute(value: Option<&str>) -> Fill {
let Some(value) = value.map(str::trim) else {
return Fill::None;
};
if value.eq_ignore_ascii_case("none") {
return Fill::None;
}
if let Some(hex) = value.strip_prefix('#') {
if let Some(color) = Color::from_rgb_str(hex) {
return Fill::Solid(color);
}
} else if let Some(color) = Color::from_rgb_str(value) {
return Fill::Solid(color);
}
Fill::None
}
pub fn transform_from_function(name: &str, arguments: &[f64]) -> DAffine2 {
match name {
"translate" => match arguments.len() {
0 => DAffine2::IDENTITY,
1 => DAffine2::from_translation(DVec2::new(arguments[0], 0.)),
_ => DAffine2::from_translation(DVec2::new(arguments[0], arguments[1])),
},
"scale" => match arguments.len() {
0 => DAffine2::IDENTITY,
1 => DAffine2::from_scale(DVec2::splat(arguments[0])),
_ => DAffine2::from_scale(DVec2::new(arguments[0], arguments[1])),
},
"rotate" => {
if arguments.is_empty() {
return DAffine2::IDENTITY;
}
let angle = arguments[0].to_radians();
if arguments.len() >= 3 {
let center = DVec2::new(arguments[1], arguments[2]);
DAffine2::from_translation(center) * DAffine2::from_angle(angle) * DAffine2::from_translation(-center)
} else {
DAffine2::from_angle(angle)
}
}
"matrix" if arguments.len() == 6 => DAffine2::from_cols_array(&[arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]]),
_ => DAffine2::IDENTITY,
}
}
pub fn parse_transform_attribute(value: Option<&str>) -> DAffine2 {
let Some(value) = value.map(str::trim) else {
return DAffine2::IDENTITY;
};
let mut transform = DAffine2::IDENTITY;
let mut remaining = value;
while let Some(open_paren) = remaining.find('(') {
let (name_part, after_name) = remaining.split_at(open_paren);
let name = name_part.trim();
let after_name = &after_name[1..];
if let Some(close_paren) = after_name.find(')') {
let arguments = after_name[..close_paren]
.split(|c| matches!(c, ',' | ' ' | '\t'))
.filter_map(|token| {
let trimmed = token.trim();
if trimmed.is_empty() { None } else { trimmed.parse::<f64>().ok() }
})
.collect::<Vec<_>>();
transform = transform * transform_from_function(name, &arguments);
remaining = &after_name[close_paren + 1..];
} else {
break;
}
}
transform
}
pub fn color_mode_from_u32(value: u32) -> ColorMode {
match value {
0 => ColorMode::Color,
1 => ColorMode::Binary,
_ => ColorMode::Color,
}
}
pub fn hierarchical_from_u32(value: u32) -> Hierarchical {
match value {
0 => Hierarchical::Stacked,
1 => Hierarchical::Cutout,
_ => Hierarchical::Stacked,
}
}
pub fn simplify_mode_from_u32(value: u32) -> PathSimplifyMode {
match value {
0 => PathSimplifyMode::None,
1 => PathSimplifyMode::Polygon,
2 => PathSimplifyMode::Spline,
_ => PathSimplifyMode::None,
}
}
pub fn build_vectorize_config(
color_mode: u32,
hierarchical: u32,
path_simplify_mode: u32,
filter_speckle: u32,
color_precision: u32,
layer_difference: u32,
corner_threshold: f32,
length_threshold: f64,
max_iterations: u32,
splice_threshold: f32,
path_precision: u32,
) -> Config {
Config {
color_mode: color_mode_from_u32(color_mode),
hierarchical: hierarchical_from_u32(hierarchical),
mode: simplify_mode_from_u32(path_simplify_mode),
filter_speckle: filter_speckle as usize,
color_precision: color_precision as i32,
layer_difference: layer_difference as i32,
corner_threshold: corner_threshold as i32,
length_threshold,
max_iterations: max_iterations as usize,
splice_threshold: splice_threshold as i32,
path_precision: Some(path_precision),
}
}
pub fn vector_row_to_graphic_row(mut vector_row: TableRow<Vector>, source_row: &TableRowRef<'_, Raster<CPU>>) -> TableRow<Graphic> {
vector_row.transform = *source_row.transform * vector_row.transform;
vector_row.alpha_blending = source_row.alpha_blending.clone();
vector_row.source_node_id = source_row.source_node_id.clone();
TableRow {
element: Graphic::Vector(Table::new_from_row(vector_row)),
transform: DAffine2::IDENTITY,
alpha_blending: Default::default(),
source_node_id: Default::default(),
}
}
+2
View File
@@ -74,6 +74,8 @@ pub enum ArcType {
PieSlice, PieSlice,
} }
// Add enum here (widget Dropdown vs Radio)
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)]
#[widget(Radio)] #[widget(Radio)]
+185 -8
View File
@@ -12,7 +12,9 @@ use crate::table::{Table, TableRow, TableRowMut};
use crate::transform::{Footprint, ReferencePoint, Transform}; use crate::transform::{Footprint, ReferencePoint, Transform};
use crate::vector::PointDomain; use crate::vector::PointDomain;
use crate::vector::algorithms::bezpath_algorithms::eval_pathseg_euclidean; use crate::vector::algorithms::bezpath_algorithms::eval_pathseg_euclidean;
use crate::vector::algorithms::decimation::ramer_douglas_peucker;
use crate::vector::algorithms::merge_by_distance::MergeByDistanceExt; use crate::vector::algorithms::merge_by_distance::MergeByDistanceExt;
use crate::vector::algorithms::vectorize::{build_vectorize_config, parse_svg_paths_to_vector, vector_row_to_graphic_row};
use crate::vector::misc::{MergeByDistanceAlgorithm, PointSpacingType, is_linear}; use crate::vector::misc::{MergeByDistanceAlgorithm, PointSpacingType, is_linear};
use crate::vector::misc::{handles_to_segment, segment_to_handles}; use crate::vector::misc::{handles_to_segment, segment_to_handles};
use crate::vector::style::{PaintOrder, StrokeAlign, StrokeCap, StrokeJoin}; use crate::vector::style::{PaintOrder, StrokeAlign, StrokeCap, StrokeJoin};
@@ -202,6 +204,177 @@ where
content content
} }
#[node_macro::node(category("Raster: Filter"), path(graphene_core::vector))]
async fn vectorize(
_: impl Ctx,
image: Table<Raster<CPU>>,
color_mode: u32,
hierarchical: u32,
path_simplify_mode: u32,
#[default(4)]
#[hard_min(1.)]
filter_speckle: u32,
#[default(6)]
#[hard_min(1.)]
#[hard_max(8.)]
color_precision: u32,
#[default(16)]
#[hard_min(0.)]
#[hard_max(255.)]
layer_difference: u32,
#[default(60)]
#[hard_min(0.)]
#[hard_max(180.)]
corner_threshold: f32,
#[default(4.)]
#[hard_min(3.5)]
length_threshold: f64,
#[default(10)]
#[hard_min(1.)]
max_iterations: u32,
#[default(45)]
#[hard_min(0.)]
#[hard_max(180.)]
splice_threshold: f32,
#[default(8)]
#[hard_min(0.)]
path_precision: u32,
) -> Table<Graphic> {
let mut result_table = Table::new();
for row in image.iter() {
let raster = &row.element;
if raster.width == 0 || raster.height == 0 {
continue;
}
let (pixel_data, width, height) = raster.to_flat_u8();
let color_image = vtracer::ColorImage {
pixels: pixel_data,
width: width as usize,
height: height as usize,
};
let config = build_vectorize_config(
color_mode,
hierarchical,
path_simplify_mode,
filter_speckle,
color_precision,
layer_difference,
corner_threshold,
length_threshold,
max_iterations,
splice_threshold,
path_precision,
);
match vtracer::convert(color_image, config) {
Ok(svg_file) => {
let svg_content = svg_file.to_string();
log::trace!("Generated SVG content:\n{}", svg_content);
let vector_rows = parse_svg_paths_to_vector(&svg_content);
let mut graphic_table = Table::new();
for vector_row in vector_rows {
graphic_table.push(vector_row_to_graphic_row(vector_row, &row));
}
let graphic_group = Graphic::Graphic(graphic_table);
let mut graphic_row = TableRow::new_from_element(graphic_group);
graphic_row.transform = *row.transform;
graphic_row.alpha_blending = *row.alpha_blending;
graphic_row.source_node_id = *row.source_node_id;
result_table.push(graphic_row);
}
Err(e) => {
log::error!("Vectorization failed: {}", e);
}
}
}
result_table
}
/// Simplifies vector paths using the Ramer-Douglas-Peucker algorithm for line decimation.
/// Reduces the number of points in a path while preserving its overall shape within a specified tolerance.
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn decimate(
_: impl Ctx,
source: Table<Vector>,
#[default(0.1)]
#[hard_min(0.001)]
tolerance: f64,
) -> Table<Vector> {
use crate::vector::misc::{dvec2_to_point, point_to_dvec2};
use kurbo::Affine;
source
.into_iter()
.map(|row| {
let transform = Affine::new(row.transform.to_cols_array());
let vector = row.element;
let mut new_vector = Vector {
style: vector.style.clone(),
upstream_nested_layers: vector.upstream_nested_layers.clone(),
..Default::default()
};
// Process each bezpath in the vector
for mut bezpath in vector.stroke_bezpath_iter() {
// Apply transform to work in world space for accurate distance calculations
bezpath.apply_affine(transform);
// Extract anchor points from the bezpath
let anchors: Vec<DVec2> = bezpath.segments().map(|seg| point_to_dvec2(seg.start())).collect();
// Handle the last point if the path isn't closed
let is_closed = bezpath.elements().last() == Some(&kurbo::PathEl::ClosePath);
let mut all_anchors = anchors;
if !is_closed {
if let Some(last_seg) = bezpath.segments().last() {
all_anchors.push(point_to_dvec2(last_seg.end()));
}
}
if all_anchors.len() <= 2 {
// Can't simplify paths with 2 or fewer points
bezpath.apply_affine(transform.inverse());
new_vector.append_bezpath(bezpath);
continue;
}
// Apply RDP algorithm
let simplified_indices = ramer_douglas_peucker(&all_anchors, tolerance);
// Build new bezpath from simplified points
let mut simplified_bezpath = kurbo::BezPath::new();
if let Some(&first_idx) = simplified_indices.first() {
simplified_bezpath.move_to(dvec2_to_point(all_anchors[first_idx]));
for &idx in simplified_indices.iter().skip(1) {
simplified_bezpath.line_to(dvec2_to_point(all_anchors[idx]));
}
// Close the path if the original was closed and we have enough points
if is_closed && simplified_indices.len() > 2 {
simplified_bezpath.close_path();
}
}
// Transform back to local space
simplified_bezpath.apply_affine(transform.inverse());
new_vector.append_bezpath(simplified_bezpath);
}
TableRow { element: new_vector, ..row }
})
.collect()
}
#[node_macro::node(category("Instancing"), path(graphene_core::vector))] #[node_macro::node(category("Instancing"), path(graphene_core::vector))]
async fn repeat<I: 'n + Send + Clone>( async fn repeat<I: 'n + Send + Clone>(
_: impl Ctx, _: impl Ctx,
@@ -1211,10 +1384,10 @@ async fn position_on_path(
let euclidian = !parameterized_distance; let euclidian = !parameterized_distance;
let mut bezpaths = content let mut bezpaths = content
.into_iter() .iter()
.flat_map(|vector| { .flat_map(|vector| {
let transform = vector.transform; let transform = *vector.transform;
vector.element.stroke_bezpath_iter().map(|bezpath| (bezpath, transform)).collect::<Vec<_>>() vector.element.stroke_bezpath_iter().map(move |bezpath| (bezpath, transform))
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let bezpath_count = bezpaths.len() as f64; let bezpath_count = bezpaths.len() as f64;
@@ -1246,14 +1419,16 @@ async fn tangent_on_path(
reverse: bool, reverse: bool,
/// Traverse the path using each segment's Bézier curve parameterization instead of the Euclidean distance. Faster to compute but doesn't respect actual distances. /// Traverse the path using each segment's Bézier curve parameterization instead of the Euclidean distance. Faster to compute but doesn't respect actual distances.
parameterized_distance: bool, parameterized_distance: bool,
/// Whether the resulting angle should be given in as radians instead of degrees.
radians: bool,
) -> f64 { ) -> f64 {
let euclidian = !parameterized_distance; let euclidian = !parameterized_distance;
let mut bezpaths = content let mut bezpaths = content
.into_iter() .iter()
.flat_map(|vector| { .flat_map(|vector| {
let transform = vector.transform; let transform = *vector.transform;
vector.element.stroke_bezpath_iter().map(|bezpath| (bezpath, transform)).collect::<Vec<_>>() vector.element.stroke_bezpath_iter().map(move |bezpath| (bezpath, transform))
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let bezpath_count = bezpaths.len() as f64; let bezpath_count = bezpaths.len() as f64;
@@ -1261,7 +1436,7 @@ async fn tangent_on_path(
let progress = if reverse { bezpath_count - progress } else { progress }; let progress = if reverse { bezpath_count - progress } else { progress };
let index = if progress >= bezpath_count { (bezpath_count - 1.) as usize } else { progress as usize }; let index = if progress >= bezpath_count { (bezpath_count - 1.) as usize } else { progress as usize };
bezpaths.get_mut(index).map_or(0., |(bezpath, transform)| { let angle = bezpaths.get_mut(index).map_or(0., |(bezpath, transform)| {
let t = if progress == bezpath_count { 1. } else { progress.fract() }; let t = if progress == bezpath_count { 1. } else { progress.fract() };
let t_value = |t: f64| if euclidian { TValue::Euclidean(t) } else { TValue::Parametric(t) }; let t_value = |t: f64| if euclidian { TValue::Euclidean(t) } else { TValue::Parametric(t) };
@@ -1277,7 +1452,9 @@ async fn tangent_on_path(
} }
-tangent.angle_to(if reverse { -DVec2::X } else { DVec2::X }) -tangent.angle_to(if reverse { -DVec2::X } else { DVec2::X })
}) });
if radians { angle } else { angle.to_degrees() }
} }
#[node_macro::node(category(""), path(graphene_core::vector))] #[node_macro::node(category(""), path(graphene_core::vector))]
+122 -86
View File
@@ -33,24 +33,24 @@ impl ValueProvider for MathNodeContext {
/// Calculates a mathematical expression with input values "A" and "B" /// Calculates a mathematical expression with input values "A" and "B"
#[node_macro::node(category("Math: Arithmetic"), properties("math_properties"))] #[node_macro::node(category("Math: Arithmetic"), properties("math_properties"))]
fn math<U: num_traits::float::Float>( fn math<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The value of "A" when calculating the expression /// The value of "A" when calculating the expression
#[implementations(f64, f32)] #[implementations(f64, f32)]
operand_a: U, operand_a: T,
/// A math expression that may incorporate "A" and/or "B", such as "sqrt(A + B) - B^2" /// A math expression that may incorporate "A" and/or "B", such as "sqrt(A + B) - B^2"
#[default(A + B)] #[default(A + B)]
expression: String, expression: String,
/// The value of "B" when calculating the expression /// The value of "B" when calculating the expression
#[implementations(f64, f32)] #[implementations(f64, f32)]
#[default(1.)] #[default(1.)]
operand_b: U, operand_b: T,
) -> U { ) -> T {
let (node, _unit) = match ast::Node::try_parse_from_str(&expression) { let (node, _unit) = match ast::Node::try_parse_from_str(&expression) {
Ok(expr) => expr, Ok(expr) => expr,
Err(e) => { Err(e) => {
warn!("Invalid expression: `{expression}`\n{e:?}"); warn!("Invalid expression: `{expression}`\n{e:?}");
return U::from(0.).unwrap(); return T::from(0.).unwrap();
} }
}; };
let context = EvalContext::new( let context = EvalContext::new(
@@ -65,14 +65,14 @@ fn math<U: num_traits::float::Float>(
Ok(value) => value, Ok(value) => value,
Err(e) => { Err(e) => {
warn!("Expression evaluation error: {e:?}"); warn!("Expression evaluation error: {e:?}");
return U::from(0.).unwrap(); return T::from(0.).unwrap();
} }
}; };
let Value::Number(num) = value; let Value::Number(num) = value;
match num { match num {
Number::Real(val) => U::from(val).unwrap(), Number::Real(val) => T::from(val).unwrap(),
Number::Complex(c) => U::from(c.re).unwrap(), Number::Complex(c) => T::from(c.re).unwrap(),
} }
} }
@@ -109,11 +109,11 @@ fn subtract<U: Sub<T>, T>(
fn multiply<U: Mul<T>, T>( fn multiply<U: Mul<T>, T>(
_: impl Ctx, _: impl Ctx,
/// The left-hand side of the multiplication operation. /// The left-hand side of the multiplication operation.
#[implementations(f64, f32, u32, f64, DVec2, DVec2, DAffine2)] #[implementations(f64, f32, u32, DVec2, f64, DVec2, DAffine2)]
multiplier: U, multiplier: U,
/// The right-hand side of the multiplication operation. /// The right-hand side of the multiplication operation.
#[default(1.)] #[default(1.)]
#[implementations(f64, f32, u32, DVec2, f64, DVec2, DAffine2)] #[implementations(f64, f32, u32, DVec2, DVec2, f64, DAffine2)]
multiplicand: T, multiplicand: T,
) -> <U as Mul<T>>::Output { ) -> <U as Mul<T>>::Output {
multiplier * multiplicand multiplier * multiplicand
@@ -126,11 +126,11 @@ fn multiply<U: Mul<T>, T>(
fn divide<U: Div<T> + Default + PartialEq, T: Default + PartialEq>( fn divide<U: Div<T> + Default + PartialEq, T: Default + PartialEq>(
_: impl Ctx, _: impl Ctx,
/// The left-hand side of the division operation. /// The left-hand side of the division operation.
#[implementations(f64, f64, f32, f32, u32, u32, DVec2, DVec2, f64)] #[implementations(f64, f32, u32, DVec2, DVec2, f64)]
numerator: U, numerator: U,
/// The right-hand side of the division operation. /// The right-hand side of the division operation.
#[default(1.)] #[default(1.)]
#[implementations(f64, f64, f32, f32, u32, u32, DVec2, f64, DVec2)] #[implementations(f64, f32, u32, DVec2, f64, DVec2)]
denominator: T, denominator: T,
) -> <U as Div<T>>::Output ) -> <U as Div<T>>::Output
where where
@@ -162,58 +162,58 @@ fn modulo<U: Rem<T, Output: Add<T, Output: Rem<T, Output = U::Output>>>, T: Copy
/// The exponent operation (^) calculates the result of raising a number to a power. /// The exponent operation (^) calculates the result of raising a number to a power.
#[node_macro::node(category("Math: Arithmetic"))] #[node_macro::node(category("Math: Arithmetic"))]
fn exponent<U: Pow<T>, T>( fn exponent<T: Pow<T>>(
_: impl Ctx, _: impl Ctx,
/// The base number that will be raised to the power. /// The base number that will be raised to the power.
#[implementations(f64, f32, u32)] #[implementations(f64, f32, u32)]
base: U, base: T,
/// The power to which the base number will be raised. /// The power to which the base number will be raised.
#[default(2.)]
#[implementations(f64, f32, u32)] #[implementations(f64, f32, u32)]
#[default(2.)]
power: T, power: T,
) -> <U as num_traits::Pow<T>>::Output { ) -> <T as num_traits::Pow<T>>::Output {
base.pow(power) base.pow(power)
} }
/// The square root operation (√) calculates the nth root of a number, equivalent to raising the number to the power of 1/n. /// The square root operation (√) calculates the nth root of a number, equivalent to raising the number to the power of 1/n.
#[node_macro::node(category("Math: Arithmetic"))] #[node_macro::node(category("Math: Arithmetic"))]
fn root<U: num_traits::float::Float>( fn root<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The number for which the nth root will be calculated. /// The number for which the nth root will be calculated.
#[default(2.)] #[default(2.)]
#[implementations(f64, f32)] #[implementations(f64, f32)]
radicand: U, radicand: T,
/// The degree of the root to be calculated. Square root is 2, cube root is 3, and so on. /// The degree of the root to be calculated. Square root is 2, cube root is 3, and so on.
#[default(2.)] #[default(2.)]
#[implementations(f64, f32)] #[implementations(f64, f32)]
degree: U, degree: T,
) -> U { ) -> T {
if degree == U::from(2.).unwrap() { if degree == T::from(2.).unwrap() {
radicand.sqrt() radicand.sqrt()
} else if degree == U::from(3.).unwrap() { } else if degree == T::from(3.).unwrap() {
radicand.cbrt() radicand.cbrt()
} else { } else {
radicand.powf(U::from(1.).unwrap() / degree) radicand.powf(T::from(1.).unwrap() / degree)
} }
} }
/// The logarithmic function (log) calculates the logarithm of a number with a specified base. If the natural logarithm function (ln) is desired, set the base to "e". /// The logarithmic function (log) calculates the logarithm of a number with a specified base. If the natural logarithm function (ln) is desired, set the base to "e".
#[node_macro::node(category("Math: Arithmetic"))] #[node_macro::node(category("Math: Arithmetic"))]
fn logarithm<U: num_traits::float::Float>( fn logarithm<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The number for which the logarithm will be calculated. /// The number for which the logarithm will be calculated.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
/// The base of the logarithm, such as 2 (binary), 10 (decimal), and e (natural logarithm). /// The base of the logarithm, such as 2 (binary), 10 (decimal), and e (natural logarithm).
#[default(2.)] #[default(2.)]
#[implementations(f64, f32)] #[implementations(f64, f32)]
base: U, base: T,
) -> U { ) -> T {
if base == U::from(2.).unwrap() { if base == T::from(2.).unwrap() {
value.log2() value.log2()
} else if base == U::from(10.).unwrap() { } else if base == T::from(10.).unwrap() {
value.log10() value.log10()
} else if base - U::from(std::f64::consts::E).unwrap() < U::epsilon() * U::from(1e6).unwrap() { } else if base - T::from(std::f64::consts::E).unwrap() < T::epsilon() * T::from(1e6).unwrap() {
value.ln() value.ln()
} else { } else {
value.log(base) value.log(base)
@@ -222,66 +222,66 @@ fn logarithm<U: num_traits::float::Float>(
/// The sine trigonometric function (sin) calculates the ratio of the angle's opposite side length to its hypotenuse length. /// The sine trigonometric function (sin) calculates the ratio of the angle's opposite side length to its hypotenuse length.
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn sine<U: num_traits::float::Float>( fn sine<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The given angle. /// The given angle.
#[implementations(f64, f32)] #[implementations(f64, f32)]
theta: U, theta: T,
/// Whether the given angle should be interpreted as radians instead of degrees. /// Whether the given angle should be interpreted as radians instead of degrees.
radians: bool, radians: bool,
) -> U { ) -> T {
if radians { theta.sin() } else { theta.to_radians().sin() } if radians { theta.sin() } else { theta.to_radians().sin() }
} }
/// The cosine trigonometric function (cos) calculates the ratio of the angle's adjacent side length to its hypotenuse length. /// The cosine trigonometric function (cos) calculates the ratio of the angle's adjacent side length to its hypotenuse length.
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn cosine<U: num_traits::float::Float>( fn cosine<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The given angle. /// The given angle.
#[implementations(f64, f32)] #[implementations(f64, f32)]
theta: U, theta: T,
/// Whether the given angle should be interpreted as radians instead of degrees. /// Whether the given angle should be interpreted as radians instead of degrees.
radians: bool, radians: bool,
) -> U { ) -> T {
if radians { theta.cos() } else { theta.to_radians().cos() } if radians { theta.cos() } else { theta.to_radians().cos() }
} }
/// The tangent trigonometric function (tan) calculates the ratio of the angle's opposite side length to its adjacent side length. /// The tangent trigonometric function (tan) calculates the ratio of the angle's opposite side length to its adjacent side length.
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn tangent<U: num_traits::float::Float>( fn tangent<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The given angle. /// The given angle.
#[implementations(f64, f32)] #[implementations(f64, f32)]
theta: U, theta: T,
/// Whether the given angle should be interpreted as radians instead of degrees. /// Whether the given angle should be interpreted as radians instead of degrees.
radians: bool, radians: bool,
) -> U { ) -> T {
if radians { theta.tan() } else { theta.to_radians().tan() } if radians { theta.tan() } else { theta.to_radians().tan() }
} }
/// The inverse sine trigonometric function (asin) calculates the angle whose sine is the specified value. /// The inverse sine trigonometric function (asin) calculates the angle whose sine is the specified value.
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn sine_inverse<U: num_traits::float::Float>( fn sine_inverse<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The given value for which the angle will be calculated. Must be in the range [-1, 1] or else the result will be NaN. /// The given value for which the angle will be calculated. Must be in the range [-1, 1] or else the result will be NaN.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
/// Whether the resulting angle should be given in as radians instead of degrees. /// Whether the resulting angle should be given in as radians instead of degrees.
radians: bool, radians: bool,
) -> U { ) -> T {
if radians { value.asin() } else { value.asin().to_degrees() } if radians { value.asin() } else { value.asin().to_degrees() }
} }
/// The inverse cosine trigonometric function (acos) calculates the angle whose cosine is the specified value. /// The inverse cosine trigonometric function (acos) calculates the angle whose cosine is the specified value.
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn cosine_inverse<U: num_traits::float::Float>( fn cosine_inverse<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The given value for which the angle will be calculated. Must be in the range [-1, 1] or else the result will be NaN. /// The given value for which the angle will be calculated. Must be in the range [-1, 1] or else the result will be NaN.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
/// Whether the resulting angle should be given in as radians instead of degrees. /// Whether the resulting angle should be given in as radians instead of degrees.
radians: bool, radians: bool,
) -> U { ) -> T {
if radians { value.acos() } else { value.acos().to_degrees() } if radians { value.acos() } else { value.acos().to_degrees() }
} }
@@ -289,16 +289,16 @@ fn cosine_inverse<U: num_traits::float::Float>(
/// atan: the angle whose tangent is the specified scalar number. /// atan: the angle whose tangent is the specified scalar number.
/// atan2: the angle of a ray from the origin to the specified vec2. /// atan2: the angle of a ray from the origin to the specified vec2.
/// ///
/// The resulting angle is always in the range [0°, 180°] or, in radians, [-π/2, π/2]. /// The resulting angle is always in the range [-90°, 90°] or, in radians, [-π/2, π/2].
#[node_macro::node(category("Math: Trig"))] #[node_macro::node(category("Math: Trig"))]
fn tangent_inverse<U: TangentInverse>( fn tangent_inverse<T: TangentInverse>(
_: impl Ctx, _: impl Ctx,
/// The given value for which the angle will be calculated. /// The given value for which the angle will be calculated.
#[implementations(f64, f32, DVec2)] #[implementations(f64, f32, DVec2)]
value: U, value: T,
/// Whether the resulting angle should be given in as radians instead of degrees. /// Whether the resulting angle should be given in as radians instead of degrees.
radians: bool, radians: bool,
) -> U::Output { ) -> T::Output {
value.atan(radians) value.atan(radians)
} }
@@ -325,90 +325,126 @@ impl TangentInverse for DVec2 {
} }
} }
#[node_macro::node(category("Math: Numeric"))]
fn remap<U: num_traits::float::Float>(
_: impl Ctx,
#[implementations(f64, f32)] value: U,
#[implementations(f64, f32)] input_min: U,
#[implementations(f64, f32)]
#[default(1.)]
input_max: U,
#[implementations(f64, f32)] output_min: U,
#[implementations(f64, f32)]
#[default(1.)]
output_max: U,
clamped: bool,
) -> U {
let input_range = input_max - input_min;
// Handle division by zero
if input_range.abs() < U::epsilon() {
return output_min;
}
let normalized = (value - input_min) / input_range;
let output_range = output_max - output_min;
let result = output_min + normalized * output_range;
if clamped {
// Handle both normal and inverted ranges, since we want to allow the user to use this node to also reverse a range.
if output_min <= output_max {
result.clamp(output_min, output_max)
} else {
result.clamp(output_max, output_min)
}
} else {
result
}
}
/// The random function (rand) converts a seed into a random number within the specified range, inclusive of the minimum and exclusive of the maximum. The minimum and maximum values are automatically swapped if they are reversed. /// The random function (rand) converts a seed into a random number within the specified range, inclusive of the minimum and exclusive of the maximum. The minimum and maximum values are automatically swapped if they are reversed.
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn random<U: num_traits::float::Float>( fn random(
_: impl Ctx, _: impl Ctx,
_primary: (), _primary: (),
/// Seed to determine the unique variation of which number will be generated. /// Seed to determine the unique variation of which number will be generated.
seed: u64, seed: u64,
/// The smaller end of the range within which the random number will be generated. /// The smaller end of the range within which the random number will be generated.
#[implementations(f64, f32)]
#[default(0.)] #[default(0.)]
min: U, min: f64,
/// The larger end of the range within which the random number will be generated. /// The larger end of the range within which the random number will be generated.
#[implementations(f64, f32)]
#[default(1.)] #[default(1.)]
max: U, max: f64,
) -> f64 { ) -> f64 {
let mut rng = rand::rngs::StdRng::seed_from_u64(seed); let mut rng = rand::rngs::StdRng::seed_from_u64(seed);
let result = rng.random::<f64>(); let result = rng.random::<f64>();
let (min, max) = if min < max { (min, max) } else { (max, min) }; let (min, max) = if min < max { (min, max) } else { (max, min) };
let (min, max) = (min.to_f64().unwrap(), max.to_f64().unwrap());
result * (max - min) + min result * (max - min) + min
} }
/// Convert a number to an integer of the type u32, which may be the required type for certain node inputs. This will be removed in the future when automatic type conversion is implemented. // TODO: Test that these are no longer needed in all circumstances, then remove them and add a migration to convert these into Passthrough nodes. Note: these act more as type annotations than as identity functions.
#[node_macro::node(name("To u32"), category("Type Conversion"))] /// Convert a number to an integer of the type u32, which may be the required type for certain node inputs.
fn to_u32<U: num_traits::float::Float>(_: impl Ctx, #[implementations(f64, f32)] value: U) -> u32 { #[node_macro::node(name("To u32"), category("Debug"))]
let value = U::clamp(value, U::from(0.).unwrap(), U::from(u32::MAX as f64).unwrap()); fn to_u32(_: impl Ctx, value: u32) -> u32 {
value.to_u32().unwrap() value
} }
/// Convert a number to an integer of the type u64, which may be the required type for certain node inputs. This will be removed in the future when automatic type conversion is implemented. // TODO: Test that these are no longer needed in all circumstances, then remove them and add a migration to convert these into Passthrough nodes. Note: these act more as type annotations than as identity functions.
#[node_macro::node(name("To u64"), category("Type Conversion"))] /// Convert a number to an integer of the type u64, which may be the required type for certain node inputs.
fn to_u64<U: num_traits::float::Float>(_: impl Ctx, #[implementations(f64, f32)] value: U) -> u64 { #[node_macro::node(name("To u64"), category("Debug"))]
let value = U::clamp(value, U::from(0.).unwrap(), U::from(u64::MAX as f64).unwrap()); fn to_u64(_: impl Ctx, value: u64) -> u64 {
value.to_u64().unwrap() value
} }
/// Convert an integer to a decimal number of the type f64, which may be the required type for certain node inputs. This will be removed in the future when automatic type conversion is implemented. // TODO: Test that these are no longer needed in all circumstances, then remove them and add a migration to convert these into Passthrough nodes. Note: these act more as type annotations than as identity functions.
#[node_macro::node(name("To f64"), category("Type Conversion"))] /// Convert an integer to a decimal number of the type f64, which may be the required type for certain node inputs.
fn to_f64<U: num_traits::int::PrimInt>(_: impl Ctx, #[implementations(u32, u64)] value: U) -> f64 { #[node_macro::node(name("To f64"), category("Debug"))]
value.to_f64().unwrap() fn to_f64(_: impl Ctx, value: f64) -> f64 {
value
} }
/// The rounding function (round) maps an input value to its nearest whole number. Halfway values are rounded away from zero. /// The rounding function (round) maps an input value to its nearest whole number. Halfway values are rounded away from zero.
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn round<U: num_traits::float::Float>( fn round<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The number which will be rounded. /// The number which will be rounded.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
) -> U { ) -> T {
value.round() value.round()
} }
/// The floor function (floor) rounds down an input value to the nearest whole number, unless the input number is already whole. /// The floor function (floor) rounds down an input value to the nearest whole number, unless the input number is already whole.
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn floor<U: num_traits::float::Float>( fn floor<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The number which will be rounded down. /// The number which will be rounded down.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
) -> U { ) -> T {
value.floor() value.floor()
} }
/// The ceiling function (ceil) rounds up an input value to the nearest whole number, unless the input number is already whole. /// The ceiling function (ceil) rounds up an input value to the nearest whole number, unless the input number is already whole.
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn ceiling<U: num_traits::float::Float>( fn ceiling<T: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The number which will be rounded up. /// The number which will be rounded up.
#[implementations(f64, f32)] #[implementations(f64, f32)]
value: U, value: T,
) -> U { ) -> T {
value.ceil() value.ceil()
} }
/// The absolute value function (abs) removes the negative sign from an input value, if present. /// The absolute value function (abs) removes the negative sign from an input value, if present.
#[node_macro::node(category("Math: Numeric"))] #[node_macro::node(category("Math: Numeric"))]
fn absolute_value<U: num_traits::float::Float>( fn absolute_value<T: num_traits::sign::Signed>(
_: impl Ctx, _: impl Ctx,
/// The number which will be made positive. /// The number which will be made positive.
#[implementations(f64, f32)] #[implementations(f64, f32, i32, i64)]
value: U, value: T,
) -> U { ) -> T {
value.abs() value.abs()
} }
@@ -540,28 +576,28 @@ fn binary_gcd<T: num_traits::int::PrimInt + std::ops::ShrAssign<i32> + std::ops:
/// The equality operation (==) compares two values and returns true if they are equal, or false if they are not. /// The equality operation (==) compares two values and returns true if they are equal, or false if they are not.
#[node_macro::node(category("Math: Logic"))] #[node_macro::node(category("Math: Logic"))]
fn equals<U: std::cmp::PartialEq<T>, T>( fn equals<T: std::cmp::PartialEq<T>>(
_: impl Ctx, _: impl Ctx,
/// One of the two numbers to compare for equality. /// One of the two numbers to compare for equality.
#[implementations(f64, f32, u32, DVec2, &str, String)] #[implementations(f64, f32, u32, DVec2, &str, String)]
value: T, value: T,
/// The other of the two numbers to compare for equality. /// The other of the two numbers to compare for equality.
#[implementations(f64, f32, u32, DVec2, &str, String)] #[implementations(f64, f32, u32, DVec2, &str, String)]
other_value: U, other_value: T,
) -> bool { ) -> bool {
other_value == value other_value == value
} }
/// The inequality operation (!=) compares two values and returns true if they are not equal, or false if they are. /// The inequality operation (!=) compares two values and returns true if they are not equal, or false if they are.
#[node_macro::node(category("Math: Logic"))] #[node_macro::node(category("Math: Logic"))]
fn not_equals<U: std::cmp::PartialEq<T>, T>( fn not_equals<T: std::cmp::PartialEq<T>>(
_: impl Ctx, _: impl Ctx,
/// One of the two numbers to compare for inequality. /// One of the two numbers to compare for inequality.
#[implementations(f64, f32, u32, DVec2, &str)] #[implementations(f64, f32, u32, DVec2, &str)]
value: T, value: T,
/// The other of the two numbers to compare for inequality. /// The other of the two numbers to compare for inequality.
#[implementations(f64, f32, u32, DVec2, &str)] #[implementations(f64, f32, u32, DVec2, &str)]
other_value: U, other_value: T,
) -> bool { ) -> bool {
other_value != value other_value != value
} }
+7 -1
View File
@@ -240,6 +240,7 @@ tagged_value! {
SelectiveColorChoice(graphene_raster_nodes::adjustments::SelectiveColorChoice), SelectiveColorChoice(graphene_raster_nodes::adjustments::SelectiveColorChoice),
GridType(graphene_core::vector::misc::GridType), GridType(graphene_core::vector::misc::GridType),
ArcType(graphene_core::vector::misc::ArcType), ArcType(graphene_core::vector::misc::ArcType),
// Add here
MergeByDistanceAlgorithm(graphene_core::vector::misc::MergeByDistanceAlgorithm), MergeByDistanceAlgorithm(graphene_core::vector::misc::MergeByDistanceAlgorithm),
PointSpacingType(graphene_core::vector::misc::PointSpacingType), PointSpacingType(graphene_core::vector::misc::PointSpacingType),
SpiralType(graphene_core::vector::misc::SpiralType), SpiralType(graphene_core::vector::misc::SpiralType),
@@ -441,11 +442,16 @@ pub enum RenderOutputType {
CanvasFrame(SurfaceFrame), CanvasFrame(SurfaceFrame),
#[serde(skip)] #[serde(skip)]
Texture(ImageTexture), Texture(ImageTexture),
#[serde(skip)]
Buffer {
data: Vec<u8>,
width: u32,
height: u32,
},
Svg { Svg {
svg: String, svg: String,
image_data: Vec<(u64, Image<Color>)>, image_data: Vec<(u64, Image<Color>)>,
}, },
Image(Vec<u8>),
} }
impl Hash for RenderOutput { impl Hash for RenderOutput {
@@ -143,7 +143,7 @@ impl WasmApplicationIo {
io io
} }
#[cfg(all(not(target_family = "wasm"), feature = "wgpu"))] #[cfg(all(not(target_family = "wasm"), feature = "wgpu"))]
pub fn new_with_context(context: wgpu_executor::Context) -> Self { pub fn new_with_context(context: wgpu_executor::WgpuContext) -> Self {
#[cfg(feature = "wgpu")] #[cfg(feature = "wgpu")]
let executor = WgpuExecutor::with_context(context); let executor = WgpuExecutor::with_context(context);
@@ -14,3 +14,4 @@ crate-type = ["rlib", "dylib"]
[build-dependencies] [build-dependencies]
cargo-gpu = { workspace = true } cargo-gpu = { workspace = true }
env_logger = { workspace = true } env_logger = { workspace = true }
log = { workspace = true }
+1 -1
View File
@@ -3,7 +3,7 @@ use cargo_gpu::spirv_builder::{MetadataPrintout, SpirvMetadata};
use std::path::PathBuf; use std::path::PathBuf;
pub fn main() -> Result<(), Box<dyn std::error::Error>> { pub fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::builder().init(); env_logger::builder().filter_level(log::LevelFilter::Debug).init();
// Skip building the shader if they are provided externally // Skip building the shader if they are provided externally
println!("cargo:rerun-if-env-changed=GRAPHENE_RASTER_NODES_SHADER_PATH"); println!("cargo:rerun-if-env-changed=GRAPHENE_RASTER_NODES_SHADER_PATH");
+19 -6
View File
@@ -44,7 +44,6 @@ async fn render_intermediate<'a: 'n, T: 'static + Render + WasmNotSend + Send +
data: impl Node<Context<'static>, Output = T>, data: impl Node<Context<'static>, Output = T>,
editor_api: impl Node<Context<'static>, Output = &'a WasmEditorApi>, editor_api: impl Node<Context<'static>, Output = &'a WasmEditorApi>,
) -> RenderIntermediate { ) -> RenderIntermediate {
let mut render = SvgRender::new();
let render_params = ctx let render_params = ctx
.vararg(0) .vararg(0)
.expect("Did not find var args") .expect("Did not find var args")
@@ -59,9 +58,20 @@ async fn render_intermediate<'a: 'n, T: 'static + Render + WasmNotSend + Send +
data.collect_metadata(&mut metadata, footprint, None); data.collect_metadata(&mut metadata, footprint, None);
let contains_artboard = data.contains_artboard(); let contains_artboard = data.contains_artboard();
let editor_api = editor_api.eval(None).await; let use_vello = {
#[cfg(target_family = "wasm")]
{
let editor_api = editor_api.eval(None).await;
!render_params.for_export && editor_api.editor_preferences.use_vello() && matches!(render_params.render_output_type, graphene_svg_renderer::RenderOutputType::Vello)
}
#[cfg(not(target_family = "wasm"))]
{
let _ = editor_api;
matches!(render_params.render_output_type, graphene_svg_renderer::RenderOutputType::Vello)
}
};
if !render_params.for_export && editor_api.editor_preferences.use_vello() && matches!(render_params.render_output_type, graphene_svg_renderer::RenderOutputType::Vello) { if use_vello {
let mut scene = vello::Scene::new(); let mut scene = vello::Scene::new();
let mut context = wgpu_executor::RenderContext::default(); let mut context = wgpu_executor::RenderContext::default();
@@ -73,6 +83,8 @@ async fn render_intermediate<'a: 'n, T: 'static + Render + WasmNotSend + Send +
contains_artboard, contains_artboard,
} }
} else { } else {
let mut render = SvgRender::new();
data.render_svg(&mut render, render_params); data.render_svg(&mut render, render_params);
RenderIntermediate { RenderIntermediate {
@@ -93,11 +105,10 @@ async fn create_context<'a: 'n>(
let render_output_type = match render_config.export_format { let render_output_type = match render_config.export_format {
ExportFormat::Svg => RenderOutputTypeRequest::Svg, ExportFormat::Svg => RenderOutputTypeRequest::Svg,
ExportFormat::Png { .. } => todo!(),
ExportFormat::Jpeg => todo!(),
ExportFormat::Canvas => RenderOutputTypeRequest::Vello,
ExportFormat::Texture => RenderOutputTypeRequest::Vello, ExportFormat::Texture => RenderOutputTypeRequest::Vello,
ExportFormat::Canvas => RenderOutputTypeRequest::Vello,
}; };
let render_params = RenderParams { let render_params = RenderParams {
render_mode: render_config.render_mode, render_mode: render_config.render_mode,
hide_artboards: render_config.hide_artboards, hide_artboards: render_config.hide_artboards,
@@ -106,6 +117,7 @@ async fn create_context<'a: 'n>(
footprint: Footprint::default(), footprint: Footprint::default(),
..Default::default() ..Default::default()
}; };
let ctx = OwnedContextImpl::default() let ctx = OwnedContextImpl::default()
.with_footprint(footprint) .with_footprint(footprint)
.with_real_time(render_config.time.time) .with_real_time(render_config.time.time)
@@ -198,6 +210,7 @@ async fn render<'a: 'n>(
if !contains_artboard && !render_params.hide_artboards { if !contains_artboard && !render_params.hide_artboards {
background = Color::WHITE; background = Color::WHITE;
} }
if let Some(surface_handle) = surface_handle { if let Some(surface_handle) = surface_handle {
exec.render_vello_scene(&scene, &surface_handle, footprint.resolution, context, background) exec.render_vello_scene(&scene, &surface_handle, footprint.resolution, context, background)
.await .await
+1 -3
View File
@@ -38,7 +38,5 @@ fn text<'i: 'n>(
align, align,
}; };
let font_data = editor.font_cache.get(&font_name).map(|f| load_font(f)); to_path(&text, &font_name, &editor.font_cache, typesetting, per_glyph_instances)
to_path(&text, font_data, typesetting, per_glyph_instances)
} }
@@ -29,6 +29,7 @@ serde = { workspace = true }
graph-craft = { workspace = true, features = ["loading"] } graph-craft = { workspace = true, features = ["loading"] }
criterion = { workspace = true } criterion = { workspace = true }
iai-callgrind = { workspace = true } iai-callgrind = { workspace = true }
preprocessor = { workspace = true }
# Benchmarks # Benchmarks
[[bench]] [[bench]]
@@ -8,8 +8,12 @@ use interpreted_executor::dynamic_executor::DynamicExecutor;
use interpreted_executor::util::wrap_network_in_scope; use interpreted_executor::util::wrap_network_in_scope;
pub fn setup_network(name: &str) -> (DynamicExecutor, ProtoNetwork) { pub fn setup_network(name: &str) -> (DynamicExecutor, ProtoNetwork) {
let network = load_from_name(name); let mut network = load_from_name(name);
let editor_api = std::sync::Arc::new(EditorApi::default()); let editor_api = std::sync::Arc::new(EditorApi::default());
println!("generating substitutions");
let substitutions = preprocessor::generate_node_substitutions();
println!("expanding network");
preprocessor::expand_network(&mut network, &substitutions);
let network = wrap_network_in_scope(network, editor_api); let network = wrap_network_in_scope(network, editor_api);
let proto_network = compile(network); let proto_network = compile(network);
let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap(); let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap();
@@ -10,7 +10,7 @@ fn subsequent_evaluations(c: &mut Criterion) {
bench_for_each_demo(&mut group, |name, g| { bench_for_each_demo(&mut group, |name, g| {
let (executor, _) = setup_network(name); let (executor, _) = setup_network(name);
g.bench_function(name, |b| { g.bench_function(name, |b| {
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context))).unwrap()) b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), std::hint::black_box(context))).unwrap())
}); });
}); });
group.finish(); group.finish();
@@ -1,5 +1,5 @@
use criterion::measurement::Measurement; use criterion::measurement::Measurement;
use criterion::{BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main}; use criterion::{BenchmarkGroup, Criterion, criterion_group, criterion_main};
use graph_craft::graphene_compiler::Executor; use graph_craft::graphene_compiler::Executor;
use graph_craft::proto::ProtoNetwork; use graph_craft::proto::ProtoNetwork;
use graph_craft::util::{DEMO_ART, compile, load_from_name}; use graph_craft::util::{DEMO_ART, compile, load_from_name};
@@ -16,7 +16,7 @@ fn update_executor<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
c.bench_function(name, |b| { c.bench_function(name, |b| {
b.iter_batched( b.iter_batched(
|| (executor.clone(), proto_network.clone()), || (executor.clone(), proto_network.clone()),
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network))), |(mut executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(network))),
criterion::BatchSize::SmallInput, criterion::BatchSize::SmallInput,
) )
}); });
@@ -11,7 +11,7 @@ fn run_once(c: &mut Criterion) {
g.bench_function(name, |b| { g.bench_function(name, |b| {
b.iter_batched( b.iter_batched(
|| setup_network(name), || setup_network(name),
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context))).unwrap(), |(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), std::hint::black_box(context))).unwrap(),
criterion::BatchSize::SmallInput, criterion::BatchSize::SmallInput,
) )
}); });
@@ -16,7 +16,7 @@ fn update_executor(c: &mut Criterion) {
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap(); let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
(executor, proto_network) (executor, proto_network)
}, },
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network))), |(mut executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(network))),
criterion::BatchSize::SmallInput, criterion::BatchSize::SmallInput,
) )
}); });
@@ -57,6 +57,18 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
#[cfg(feature = "gpu")] #[cfg(feature = "gpu")]
into_node!(from: &WasmEditorApi, to: &WgpuExecutor), into_node!(from: &WasmEditorApi, to: &WgpuExecutor),
convert_node!(from: String, to: String), convert_node!(from: String, to: String),
convert_node!(from: bool, to: String),
convert_node!(from: DVec2, to: String),
convert_node!(from: IVec2, to: String),
convert_node!(from: DAffine2, to: String),
#[cfg(feature = "gpu")]
convert_node!(from: Table<Raster<CPU>>, to: Table<Raster<CPU>>, converter: &WgpuExecutor),
#[cfg(feature = "gpu")]
convert_node!(from: Table<Raster<CPU>>, to: Table<Raster<GPU>>, converter: &WgpuExecutor),
#[cfg(feature = "gpu")]
convert_node!(from: Table<Raster<GPU>>, to: Table<Raster<GPU>>, converter: &WgpuExecutor),
#[cfg(feature = "gpu")]
convert_node!(from: Table<Raster<GPU>>, to: Table<Raster<CPU>>, converter: &WgpuExecutor),
// ============= // =============
// MONITOR NODES // MONITOR NODES
// ============= // =============
@@ -120,6 +132,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::raster::adjustments::SelectiveColorChoice]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::raster::adjustments::SelectiveColorChoice]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::GridType]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::GridType]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::ArcType]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::ArcType]),
// Add here
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::MergeByDistanceAlgorithm]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::MergeByDistanceAlgorithm]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::PointSpacingType]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::PointSpacingType]),
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::style::FillType]), async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::vector::style::FillType]),
@@ -205,6 +218,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::SelectiveColorChoice]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::SelectiveColorChoice]),
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::GridType]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::GridType]),
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::ArcType]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::ArcType]),
// add here
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::MergeByDistanceAlgorithm]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::MergeByDistanceAlgorithm]),
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::PointSpacingType]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::misc::PointSpacingType]),
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::style::StrokeCap]), async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_core::vector::style::StrokeCap]),
@@ -390,21 +404,30 @@ mod node_registry_macros {
x x
}}; }};
(from: $from:ty, to: $to:ty) => { (from: $from:ty, to: $to:ty) => {
convert_node!(from: $from, to: $to, converter: ())
};
(from: $from:ty, to: $to:ty, converter: $convert:ty) => {
( (
ProtoNodeIdentifier::new(concat!["graphene_core::ops::ConvertNode<", stringify!($to), ">"]), ProtoNodeIdentifier::new(concat!["graphene_core::ops::ConvertNode<", stringify!($to), ">"]),
|mut args| { |mut args| {
Box::pin(async move { Box::pin(async move {
let node = graphene_core::ops::ConvertNode::new(graphene_std::any::downcast_node::<Context, $from>(args.pop().unwrap()), let mut args = args.drain(..);
graphene_std::any::FutureWrapperNode::new(graphene_std::value::ClonedNode::new(std::marker::PhantomData::<$to>)) ); let node = graphene_core::ops::ConvertNode::new(
graphene_std::any::downcast_node::<Context, $from>(args.next().expect("Convert node did not get first argument")),
graphene_std::any::downcast_node::<Context, $convert>(args.next().expect("Convert node did not get converter argument")),
graphene_std::any::FutureWrapperNode::new(graphene_std::value::ClonedNode::new(std::marker::PhantomData::<$to>))
);
let any: DynAnyNode<Context, $to, _> = graphene_std::any::DynAnyNode::new(node); let any: DynAnyNode<Context, $to, _> = graphene_std::any::DynAnyNode::new(node);
Box::new(any) as TypeErasedBox Box::new(any) as TypeErasedBox
}) })
}, },
{ {
let node = graphene_core::ops::ConvertNode::new(graphene_std::any::PanicNode::<Context, core::pin::Pin<Box<dyn core::future::Future<Output = $from> + Send>>>::new(), let node = graphene_core::ops::ConvertNode::new(
graphene_std::any::PanicNode::<Context, core::pin::Pin<Box<dyn core::future::Future<Output = $from> + Send>>>::new(),
graphene_std::any::FutureWrapperNode::new(graphene_std::value::ClonedNode::new(std::marker::PhantomData::<$to>)) ); graphene_std::any::PanicNode::<Context, core::pin::Pin<Box<dyn core::future::Future<Output = $convert> + Send>>>::new(),
let params = vec![fn_type_fut!(Context, $from)]; graphene_std::any::FutureWrapperNode::new(graphene_std::value::ClonedNode::new(std::marker::PhantomData::<$to>))
);
let params = vec![fn_type_fut!(Context, $from), fn_type_fut!(Context, $convert)];
let node_io = NodeIO::<'_, Context>::to_async_node_io(&node, params); let node_io = NodeIO::<'_, Context>::to_async_node_io(&node, params);
node_io node_io
}, },
@@ -128,7 +128,7 @@ impl PerPixelAdjustCodegen<'_> {
#(pub #uniform_members),* #(pub #uniform_members),*
} }
}; };
let uniform_struct_shader_struct_derive = crate::buffer_struct::derive_buffer_struct_struct(&self.crate_ident, &uniform_struct)?; let uniform_struct_shader_struct_derive = crate::buffer_struct::derive_buffer_struct_struct(self.crate_ident, &uniform_struct)?;
let image_params = self let image_params = self
.params .params
+5 -3
View File
@@ -29,6 +29,8 @@ pub fn expand_network(network: &mut NodeNetwork, substitutions: &HashMap<ProtoNo
pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNode> { pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNode> {
let mut custom = HashMap::new(); let mut custom = HashMap::new();
// We pre initialize the node registry here to avoid a deadlock
let into_node_registry = &*interpreted_executor::node_registry::NODE_REGISTRY;
let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap(); let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap();
for (id, metadata) in graphene_core::registry::NODE_METADATA.lock().unwrap().iter() { for (id, metadata) in graphene_core::registry::NODE_METADATA.lock().unwrap().iter() {
let id = id.clone(); let id = id.clone();
@@ -54,8 +56,6 @@ pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNod
let identity_node = ops::identity::IDENTIFIER; let identity_node = ops::identity::IDENTIFIER;
let into_node_registry = &interpreted_executor::node_registry::NODE_REGISTRY;
let mut generated_nodes = 0; let mut generated_nodes = 0;
let mut nodes: HashMap<_, _, _> = node_io_types let mut nodes: HashMap<_, _, _> = node_io_types
.iter() .iter()
@@ -67,6 +67,7 @@ pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNod
1 => { 1 => {
let input = inputs.iter().next().unwrap(); let input = inputs.iter().next().unwrap();
let input_ty = input.nested_type(); let input_ty = input.nested_type();
let mut inputs = vec![NodeInput::import(input.clone(), i)];
let into_node_identifier = ProtoNodeIdentifier { let into_node_identifier = ProtoNodeIdentifier {
name: format!("graphene_core::ops::IntoNode<{}>", input_ty.clone()).into(), name: format!("graphene_core::ops::IntoNode<{}>", input_ty.clone()).into(),
@@ -80,13 +81,14 @@ pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNod
into_node_identifier into_node_identifier
} else if into_node_registry.keys().any(|ident| ident.name.as_ref() == convert_node_identifier.name.as_ref()) { } else if into_node_registry.keys().any(|ident| ident.name.as_ref() == convert_node_identifier.name.as_ref()) {
generated_nodes += 1; generated_nodes += 1;
inputs.push(NodeInput::value(TaggedValue::None, false));
convert_node_identifier convert_node_identifier
} else { } else {
identity_node.clone() identity_node.clone()
}; };
DocumentNode { DocumentNode {
inputs: vec![NodeInput::import(input.clone(), i)], inputs,
implementation: DocumentNodeImplementation::ProtoNode(proto_node), implementation: DocumentNodeImplementation::ProtoNode(proto_node),
visible: true, visible: true,
..Default::default() ..Default::default()
+132 -34
View File
@@ -1,49 +1,64 @@
use std::sync::Arc; use std::sync::Arc;
use wgpu::{Device, Instance, Queue}; use wgpu::{Adapter, Backends, Device, Features, Instance, Queue};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Context { pub struct Context {
pub device: Arc<Device>, pub device: Arc<Device>,
pub queue: Arc<Queue>, pub queue: Arc<Queue>,
pub instance: Arc<Instance>, pub instance: Arc<Instance>,
pub adapter: Arc<wgpu::Adapter>, pub adapter: Arc<Adapter>,
} }
impl Context { impl Context {
pub async fn new() -> Option<Self> { pub async fn new() -> Option<Self> {
// Instantiates instance of WebGPU ContextBuilder::new().build().await
let instance_descriptor = wgpu::InstanceDescriptor { }
backends: wgpu::Backends::all(), }
..Default::default()
};
let instance = Instance::new(&instance_descriptor);
let adapter_options = wgpu::RequestAdapterOptions { #[derive(Default)]
power_preference: wgpu::PowerPreference::HighPerformance, pub struct ContextBuilder {
compatible_surface: None, backends: Backends,
force_fallback_adapter: false, features: Features,
}; }
// `request_adapter` instantiates the general connection to the GPU impl ContextBuilder {
let adapter = instance.request_adapter(&adapter_options).await.ok()?; pub fn new() -> Self {
Self {
let required_limits = adapter.limits(); backends: Backends::all(),
// `request_device` instantiates the feature specific connection to the GPU, defining some parameters, features: Features::empty(),
// `features` being the available features. }
let (device, queue) = adapter }
.request_device(&wgpu::DeviceDescriptor { pub fn with_backends(mut self, backends: Backends) -> Self {
label: None, self.backends = backends;
#[cfg(target_family = "wasm")] self
required_features: wgpu::Features::empty(), }
#[cfg(not(target_family = "wasm"))] pub fn with_features(mut self, features: Features) -> Self {
required_features: wgpu::Features::PUSH_CONSTANTS, self.features = features;
required_limits, self
memory_hints: Default::default(), }
trace: wgpu::Trace::Off, }
}) #[cfg(not(target_family = "wasm"))]
.await impl ContextBuilder {
.ok()?; pub async fn build(self) -> Option<Context> {
self.build_with_adapter_selection_inner(None::<fn(&[Adapter]) -> Option<usize>>).await
Some(Self { }
pub async fn build_with_adapter_selection<S>(self, select: S) -> Option<Context>
where
S: Fn(&[Adapter]) -> Option<usize>,
{
self.build_with_adapter_selection_inner(Some(select)).await
}
pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display {
let instance = self.build_instance();
fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends))
}
}
#[cfg(target_family = "wasm")]
impl ContextBuilder {
pub async fn build(self) -> Option<Context> {
let instance = self.build_instance();
let adapter = self.request_adapter(&instance).await?;
let (device, queue) = self.request_device(&adapter).await?;
Some(Context {
device: Arc::new(device), device: Arc::new(device),
queue: Arc::new(queue), queue: Arc::new(queue),
adapter: Arc::new(adapter), adapter: Arc::new(adapter),
@@ -51,3 +66,86 @@ impl Context {
}) })
} }
} }
impl ContextBuilder {
fn build_instance(&self) -> Instance {
Instance::new(&wgpu::InstanceDescriptor {
backends: self.backends,
..Default::default()
})
}
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
let request_adapter_options = wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: None,
force_fallback_adapter: false,
};
instance.request_adapter(&request_adapter_options).await.ok()
}
async fn request_device(&self, adapter: &Adapter) -> Option<(Device, Queue)> {
let device_descriptor = wgpu::DeviceDescriptor {
label: None,
required_features: self.features,
required_limits: adapter.limits(),
memory_hints: Default::default(),
trace: wgpu::Trace::Off,
};
adapter.request_device(&device_descriptor).await.ok()
}
}
#[cfg(not(target_family = "wasm"))]
impl ContextBuilder {
async fn build_with_adapter_selection_inner<S>(self, select: Option<S>) -> Option<Context>
where
S: Fn(&[Adapter]) -> Option<usize>,
{
let instance = self.build_instance();
let selected_adapter = if let Some(select) = select {
self.select_adapter(&instance, select)
} else if cfg!(target_os = "windows") {
self.select_adapter(&instance, |adapters: &[Adapter]| adapters.iter().position(|a| a.get_info().backend == wgpu::Backend::Dx12))
} else {
None
};
let adapter = if let Some(adapter) = selected_adapter { adapter } else { self.request_adapter(&instance).await? };
let (device, queue) = self.request_device(&adapter).await?;
Some(Context {
device: Arc::new(device),
queue: Arc::new(queue),
adapter: Arc::new(adapter),
instance: Arc::new(instance),
})
}
fn select_adapter<S>(&self, instance: &Instance, select: S) -> Option<Adapter>
where
S: Fn(&[Adapter]) -> Option<usize>,
{
let mut adapters = instance.enumerate_adapters(self.backends);
let selected_index = select(&adapters)?;
if selected_index >= adapters.len() {
return None;
}
Some(adapters.remove(selected_index))
}
}
#[cfg(not(target_family = "wasm"))]
mod fmt {
use super::*;
pub(super) struct AvailableAdaptersFormatter(pub(super) Vec<Adapter>);
impl std::fmt::Display for AvailableAdaptersFormatter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for (i, adapter) in self.0.iter().enumerate() {
let info = adapter.get_info();
writeln!(
f,
"[{}] {:?} {:?} (Name: {}, Driver: {}, Device: {})",
i, info.backend, info.device_type, info.name, info.driver, info.device,
)?;
}
Ok(())
}
}
}
+10 -6
View File
@@ -1,10 +1,9 @@
mod context; mod context;
pub mod shader_runtime; pub mod shader_runtime;
pub mod texture_upload; pub mod texture_conversion;
use crate::shader_runtime::ShaderRuntime; use crate::shader_runtime::ShaderRuntime;
use anyhow::Result; use anyhow::Result;
pub use context::Context;
use dyn_any::StaticType; use dyn_any::StaticType;
use futures::lock::Mutex; use futures::lock::Mutex;
use glam::UVec2; use glam::UVec2;
@@ -16,9 +15,14 @@ use vello::{AaConfig, AaSupport, RenderParams, Renderer, RendererOptions, Scene}
use wgpu::util::TextureBlitter; use wgpu::util::TextureBlitter;
use wgpu::{Origin3d, SurfaceConfiguration, TextureAspect}; use wgpu::{Origin3d, SurfaceConfiguration, TextureAspect};
pub use context::Context as WgpuContext;
pub use context::ContextBuilder as WgpuContextBuilder;
pub use wgpu::Backends as WgpuBackends;
pub use wgpu::Features as WgpuFeatures;
#[derive(dyn_any::DynAny)] #[derive(dyn_any::DynAny)]
pub struct WgpuExecutor { pub struct WgpuExecutor {
pub context: Context, pub context: WgpuContext,
vello_renderer: Mutex<Renderer>, vello_renderer: Mutex<Renderer>,
pub shader_runtime: ShaderRuntime, pub shader_runtime: ShaderRuntime,
} }
@@ -120,7 +124,7 @@ impl WgpuExecutor {
mip_level_count: 1, mip_level_count: 1,
sample_count: 1, sample_count: 1,
dimension: wgpu::TextureDimension::D2, dimension: wgpu::TextureDimension::D2,
usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::TEXTURE_BINDING, usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_SRC,
format: VELLO_SURFACE_FORMAT, format: VELLO_SURFACE_FORMAT,
view_formats: &[], view_formats: &[],
}); });
@@ -182,10 +186,10 @@ impl WgpuExecutor {
impl WgpuExecutor { impl WgpuExecutor {
pub async fn new() -> Option<Self> { pub async fn new() -> Option<Self> {
Self::with_context(Context::new().await?) Self::with_context(WgpuContext::new().await?)
} }
pub fn with_context(context: Context) -> Option<Self> { pub fn with_context(context: WgpuContext) -> Option<Self> {
let vello_renderer = Renderer::new( let vello_renderer = Renderer::new(
&context.device, &context.device,
RendererOptions { RendererOptions {
@@ -1,4 +1,4 @@
use crate::Context; use crate::WgpuContext;
use crate::shader_runtime::per_pixel_adjust_runtime::PerPixelAdjustShaderRuntime; use crate::shader_runtime::per_pixel_adjust_runtime::PerPixelAdjustShaderRuntime;
pub mod per_pixel_adjust_runtime; pub mod per_pixel_adjust_runtime;
@@ -6,12 +6,12 @@ pub mod per_pixel_adjust_runtime;
pub const FULLSCREEN_VERTEX_SHADER_NAME: &str = "fullscreen_vertexfullscreen_vertex"; pub const FULLSCREEN_VERTEX_SHADER_NAME: &str = "fullscreen_vertexfullscreen_vertex";
pub struct ShaderRuntime { pub struct ShaderRuntime {
context: Context, context: WgpuContext,
per_pixel_adjust: PerPixelAdjustShaderRuntime, per_pixel_adjust: PerPixelAdjustShaderRuntime,
} }
impl ShaderRuntime { impl ShaderRuntime {
pub fn new(context: &Context) -> Self { pub fn new(context: &WgpuContext) -> Self {
Self { Self {
context: context.clone(), context: context.clone(),
per_pixel_adjust: PerPixelAdjustShaderRuntime::new(), per_pixel_adjust: PerPixelAdjustShaderRuntime::new(),
@@ -1,4 +1,4 @@
use crate::Context; use crate::WgpuContext;
use crate::shader_runtime::{FULLSCREEN_VERTEX_SHADER_NAME, ShaderRuntime}; use crate::shader_runtime::{FULLSCREEN_VERTEX_SHADER_NAME, ShaderRuntime};
use futures::lock::Mutex; use futures::lock::Mutex;
use graphene_core::raster_types::{GPU, Raster}; use graphene_core::raster_types::{GPU, Raster};
@@ -31,7 +31,7 @@ impl ShaderRuntime {
let mut cache = self.per_pixel_adjust.pipeline_cache.lock().await; let mut cache = self.per_pixel_adjust.pipeline_cache.lock().await;
let pipeline = cache let pipeline = cache
.entry(shaders.fragment_shader_name.to_owned()) .entry(shaders.fragment_shader_name.to_owned())
.or_insert_with(|| PerPixelAdjustGraphicsPipeline::new(&self.context, &shaders)); .or_insert_with(|| PerPixelAdjustGraphicsPipeline::new(&self.context, shaders));
let arg_buffer = args.map(|args| { let arg_buffer = args.map(|args| {
let device = &self.context.device; let device = &self.context.device;
@@ -58,7 +58,7 @@ pub struct PerPixelAdjustGraphicsPipeline {
} }
impl PerPixelAdjustGraphicsPipeline { impl PerPixelAdjustGraphicsPipeline {
pub fn new(context: &Context, info: &Shaders) -> Self { pub fn new(context: &WgpuContext, info: &Shaders) -> Self {
let device = &context.device; let device = &context.device;
let name = info.fragment_shader_name.to_owned(); let name = info.fragment_shader_name.to_owned();
@@ -67,7 +67,7 @@ impl PerPixelAdjustGraphicsPipeline {
// TODO workaround to naga removing `:` // TODO workaround to naga removing `:`
let fragment_name = fragment_name.replace(":", ""); let fragment_name = fragment_name.replace(":", "");
let shader_module = device.create_shader_module(ShaderModuleDescriptor { let shader_module = device.create_shader_module(ShaderModuleDescriptor {
label: Some(&format!("PerPixelAdjust {} wgsl shader", name)), label: Some(&format!("PerPixelAdjust {name} wgsl shader")),
source: ShaderSource::Wgsl(Cow::Borrowed(info.wgsl_shader)), source: ShaderSource::Wgsl(Cow::Borrowed(info.wgsl_shader)),
}); });
@@ -107,16 +107,16 @@ impl PerPixelAdjustGraphicsPipeline {
}] }]
}; };
let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor { let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: Some(&format!("PerPixelAdjust {} PipelineLayout", name)), label: Some(&format!("PerPixelAdjust {name} PipelineLayout")),
bind_group_layouts: &[&device.create_bind_group_layout(&BindGroupLayoutDescriptor { bind_group_layouts: &[&device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some(&format!("PerPixelAdjust {} BindGroupLayout 0", name)), label: Some(&format!("PerPixelAdjust {name} BindGroupLayout 0")),
entries, entries,
})], })],
push_constant_ranges: &[], push_constant_ranges: &[],
}); });
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor { let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
label: Some(&format!("PerPixelAdjust {} Pipeline", name)), label: Some(&format!("PerPixelAdjust {name} Pipeline")),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: VertexState { vertex: VertexState {
module: &shader_module, module: &shader_module,
@@ -155,7 +155,7 @@ impl PerPixelAdjustGraphicsPipeline {
} }
} }
pub fn dispatch(&self, context: &Context, textures: Table<Raster<GPU>>, arg_buffer: Option<Buffer>) -> Table<Raster<GPU>> { pub fn dispatch(&self, context: &WgpuContext, textures: Table<Raster<GPU>>, arg_buffer: Option<Buffer>) -> Table<Raster<GPU>> {
assert_eq!(self.has_uniform, arg_buffer.is_some()); assert_eq!(self.has_uniform, arg_buffer.is_some());
let device = &context.device; let device = &context.device;
let name = self.name.as_str(); let name = self.name.as_str();
@@ -0,0 +1,269 @@
use crate::WgpuExecutor;
use graphene_core::Color;
use graphene_core::Ctx;
use graphene_core::color::SRGBA8;
use graphene_core::ops::Convert;
use graphene_core::raster::Image;
use graphene_core::raster_types::{CPU, GPU, Raster};
use graphene_core::table::{Table, TableRow};
use graphene_core::transform::Footprint;
use wgpu::util::{DeviceExt, TextureDataOrder};
use wgpu::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages};
/// Uploads CPU image data to a GPU texture
///
/// Creates a new WGPU texture with RGBA8UnormSrgb format and uploads the provided
/// image data. The texture is configured for binding, copying, and source operations.
fn upload_to_texture(device: &std::sync::Arc<wgpu::Device>, queue: &std::sync::Arc<wgpu::Queue>, image: &Raster<CPU>) -> wgpu::Texture {
let rgba8_data: Vec<SRGBA8> = image.data.iter().map(|x| (*x).into()).collect();
device.create_texture_with_data(
queue,
&TextureDescriptor {
label: Some("upload_texture node texture"),
size: Extent3d {
width: image.width,
height: image.height,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: TextureDimension::D2,
format: TextureFormat::Rgba8UnormSrgb,
usage: TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_DST | TextureUsages::COPY_SRC,
view_formats: &[],
},
TextureDataOrder::LayerMajor,
bytemuck::cast_slice(rgba8_data.as_slice()),
)
}
/// Converts a Raster<GPU> texture to Raster<CPU> by downloading the underlying texture data.
///
/// Assumptions:
/// - 2D texture, mip level 0
/// - 4 bytes-per-pixel RGBA8
/// - Texture has COPY_SRC usage
struct RasterGpuToRasterCpuConverter {
buffer: wgpu::Buffer,
width: u32,
height: u32,
unpadded_bytes_per_row: u32,
padded_bytes_per_row: u32,
}
impl RasterGpuToRasterCpuConverter {
fn new(device: &std::sync::Arc<wgpu::Device>, encoder: &mut wgpu::CommandEncoder, data_gpu: Raster<GPU>) -> Self {
let texture = data_gpu.data();
let width = texture.width();
let height = texture.height();
let bytes_per_pixel = 4; // RGBA8
let unpadded_bytes_per_row = width * bytes_per_pixel;
let align = wgpu::COPY_BYTES_PER_ROW_ALIGNMENT;
let padded_bytes_per_row = unpadded_bytes_per_row.div_ceil(align) * align;
let buffer_size = padded_bytes_per_row as u64 * height as u64;
let buffer = device.create_buffer(&wgpu::BufferDescriptor {
label: Some("texture_download_buffer"),
size: buffer_size,
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
mapped_at_creation: false,
});
encoder.copy_texture_to_buffer(
wgpu::TexelCopyTextureInfo {
texture,
mip_level: 0,
origin: wgpu::Origin3d::ZERO,
aspect: wgpu::TextureAspect::All,
},
wgpu::TexelCopyBufferInfo {
buffer: &buffer,
layout: wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(padded_bytes_per_row),
rows_per_image: Some(height),
},
},
Extent3d {
width,
height,
depth_or_array_layers: 1,
},
);
Self {
buffer,
width,
height,
unpadded_bytes_per_row,
padded_bytes_per_row,
}
}
async fn convert(self) -> Result<Raster<CPU>, wgpu::BufferAsyncError> {
let buffer_slice = self.buffer.slice(..);
let (sender, receiver) = futures::channel::oneshot::channel();
buffer_slice.map_async(wgpu::MapMode::Read, move |result| {
let _ = sender.send(result);
});
receiver.await.expect("Failed to receive map result")?;
let view = buffer_slice.get_mapped_range();
let row_stride = self.padded_bytes_per_row as usize;
let row_bytes = self.unpadded_bytes_per_row as usize;
let mut cpu_data: Vec<Color> = Vec::with_capacity((self.width * self.height) as usize);
for row in 0..self.height as usize {
let start = row * row_stride;
let row_slice = &view[start..start + row_bytes];
for px in row_slice.chunks_exact(4) {
cpu_data.push(Color::from_rgba8_srgb(px[0], px[1], px[2], px[3]));
}
}
drop(view);
self.buffer.unmap();
let cpu_image = Image {
data: cpu_data,
width: self.width,
height: self.height,
base64_string: None,
};
Ok(Raster::new_cpu(cpu_image))
}
}
/// Passthrough conversion for GPU tables - no conversion needed
impl<'i> Convert<Table<Raster<GPU>>, &'i WgpuExecutor> for Table<Raster<GPU>> {
async fn convert(self, _: Footprint, _converter: &'i WgpuExecutor) -> Table<Raster<GPU>> {
self
}
}
/// Converts CPU raster table to GPU by uploading each image to a texture
impl<'i> Convert<Table<Raster<GPU>>, &'i WgpuExecutor> for Table<Raster<CPU>> {
async fn convert(self, _: Footprint, executor: &'i WgpuExecutor) -> Table<Raster<GPU>> {
let device = &executor.context.device;
let queue = &executor.context.queue;
let table = self
.iter()
.map(|row| {
let image = row.element;
let texture = upload_to_texture(device, queue, image);
TableRow {
element: Raster::new_gpu(texture),
transform: *row.transform,
alpha_blending: *row.alpha_blending,
source_node_id: *row.source_node_id,
}
})
.collect();
queue.submit([]);
table
}
}
/// Converts single CPU raster to GPU by uploading to texture
impl<'i> Convert<Raster<GPU>, &'i WgpuExecutor> for Raster<CPU> {
async fn convert(self, _: Footprint, executor: &'i WgpuExecutor) -> Raster<GPU> {
let device = &executor.context.device;
let queue = &executor.context.queue;
let texture = upload_to_texture(device, queue, &self);
queue.submit([]);
Raster::new_gpu(texture)
}
}
/// Passthrough conversion for CPU tables - no conversion needed
impl<'i> Convert<Table<Raster<CPU>>, &'i WgpuExecutor> for Table<Raster<CPU>> {
async fn convert(self, _: Footprint, _converter: &'i WgpuExecutor) -> Table<Raster<CPU>> {
self
}
}
/// Converts GPU raster table to CPU by downloading texture data in one go
///
/// then asynchronously maps all buffers and processes the results.
impl<'i> Convert<Table<Raster<CPU>>, &'i WgpuExecutor> for Table<Raster<GPU>> {
async fn convert(self, _: Footprint, executor: &'i WgpuExecutor) -> Table<Raster<CPU>> {
let device = &executor.context.device;
let queue = &executor.context.queue;
let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
label: Some("batch_texture_download_encoder"),
});
let mut converters = Vec::new();
let mut rows_meta = Vec::new();
for row in self {
let gpu_raster = row.element;
converters.push(RasterGpuToRasterCpuConverter::new(device, &mut encoder, gpu_raster));
rows_meta.push(TableRow {
element: (),
transform: row.transform,
alpha_blending: row.alpha_blending,
source_node_id: row.source_node_id,
});
}
queue.submit([encoder.finish()]);
let mut map_futures = Vec::new();
for converter in converters {
map_futures.push(converter.convert());
}
let map_results = futures::future::try_join_all(map_futures)
.await
.map_err(|_| "Failed to receive map result")
.expect("Buffer mapping communication failed");
map_results
.into_iter()
.zip(rows_meta.into_iter())
.map(|(element, row)| TableRow {
element,
transform: row.transform,
alpha_blending: row.alpha_blending,
source_node_id: row.source_node_id,
})
.collect()
}
}
/// Converts single GPU raster to CPU by downloading texture data
impl<'i> Convert<Raster<CPU>, &'i WgpuExecutor> for Raster<GPU> {
async fn convert(self, _: Footprint, executor: &'i WgpuExecutor) -> Raster<CPU> {
let device = &executor.context.device;
let queue = &executor.context.queue;
let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
label: Some("single_texture_download_encoder"),
});
let converter = RasterGpuToRasterCpuConverter::new(device, &mut encoder, self);
queue.submit([encoder.finish()]);
converter.convert().await.expect("Failed to download texture data")
}
}
/// Node for uploading textures from CPU to GPU. This Is now deprecated and
/// we should use the Convert node in the future.
///
/// Accepts either individual rasters or tables of rasters and converts them
/// to GPU format using the WgpuExecutor's device and queue.
#[node_macro::node(category(""))]
pub async fn upload_texture<'a: 'n, T: Convert<Table<Raster<GPU>>, &'a WgpuExecutor>>(
_: impl Ctx,
#[implementations(Table<Raster<CPU>>, Table<Raster<GPU>>)] input: T,
executor: &'a WgpuExecutor,
) -> Table<Raster<GPU>> {
input.convert(Footprint::DEFAULT, executor).await
}
@@ -1,52 +0,0 @@
use crate::WgpuExecutor;
use graphene_core::Ctx;
use graphene_core::color::SRGBA8;
use graphene_core::raster_types::{CPU, GPU, Raster};
use graphene_core::table::{Table, TableRow};
use wgpu::util::{DeviceExt, TextureDataOrder};
use wgpu::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages};
#[node_macro::node(category(""))]
pub async fn upload_texture<'a: 'n>(_: impl Ctx, input: Table<Raster<CPU>>, executor: &'a WgpuExecutor) -> Table<Raster<GPU>> {
let device = &executor.context.device;
let queue = &executor.context.queue;
let table = input
.iter()
.map(|row| {
let image = row.element;
let rgba8_data: Vec<SRGBA8> = image.data.iter().map(|x| (*x).into()).collect();
let texture = device.create_texture_with_data(
queue,
&TextureDescriptor {
label: Some("upload_texture node texture"),
size: Extent3d {
width: image.width,
height: image.height,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: TextureDimension::D2,
format: TextureFormat::Rgba8UnormSrgb,
// I don't know what usages are actually necessary
usage: TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_DST | TextureUsages::COPY_SRC,
view_formats: &[],
},
TextureDataOrder::LayerMajor,
bytemuck::cast_slice(rgba8_data.as_slice()),
);
TableRow {
element: Raster::new_gpu(texture),
transform: *row.transform,
alpha_blending: *row.alpha_blending,
source_node_id: *row.source_node_id,
}
})
.collect();
queue.submit([]);
table
}
+29 -7
View File
@@ -153,6 +153,28 @@ meta_description = "Open source free software. A vector graphics creativity suit
</div> </div>
</section> </section>
<!-- ▙ SCREENSHOTS ▟ --> <!-- ▙ SCREENSHOTS ▟ -->
<!-- -->
<!-- ▛ WHAT'S NEW ▜ -->
<section id="what-is-new" class="block">
<div class="block">
## What's new?
The latest major update is out now! See what the team has been cooking up recently:
<div class="block video-container">
<div>
<div class="youtube-embed aspect-16x9">
<img data-youtube-embed="Vl5BA4g3QXM" loading="lazy" src="https://static.graphite.rs/content/index/video-september-025-update.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="September Update - Graphite, the Open Source 2D Graphics Suite" />
</div>
</div>
</div>
</div>
</section>
<!-- ▙ WHAT'S NEW ▟ -->
<!-- --> <!-- -->
<!-- ▛ OVERVIEW ▜ --> <!-- ▛ OVERVIEW ▜ -->
<section id="overview" class="feature-box-outer"> <section id="overview" class="feature-box-outer">
@@ -167,7 +189,7 @@ meta_description = "Open source free software. A vector graphics creativity suit
<div class="diptych sizzle-video"> <div class="diptych sizzle-video">
<div class="block text"> <div class="block text">
Starting life as a vector editor, Graphite is evolving into a generalized, all-in-one graphics toolbox that's built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, animation, and beyond. Starting life as a vector editor, Graphite is evolving into a general-purpose, all-in-one graphics toolbox that is built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, animation, and beyond.
<a href="https://editor.graphite.rs" class="button arrow">Start creating</a> <a href="https://editor.graphite.rs" class="button arrow">Start creating</a>
@@ -277,7 +299,7 @@ Presently, Graphite is a lightweight offline web app with features primarily ori
## Desktop-first and web-ready ## Desktop-first and web-ready
Where's the download? The web app is [currently live](https://editor.graphite.rs) and desktop apps for Windows, Mac, and Linux should be available in 2025. Where's the download? The web app is [currently live](https://editor.graphite.rs) and desktop apps for Windows, Mac, and Linux will be available in Q4 2025.
Graphite is designed principally as a professional desktop application that is also accessible in a browser for quick access from anywhere. It's built for speed with (nearly) no JavaScript. And regardless of platform, it runs locally and privately on your own hardware— there is no server. Graphite is designed principally as a professional desktop application that is also accessible in a browser for quick access from anywhere. It's built for speed with (nearly) no JavaScript. And regardless of platform, it runs locally and privately on your own hardware— there is no server.
@@ -290,7 +312,7 @@ Graphite's code architecture is structured to deliver true native performance fo
</div> </div>
</section> </section>
<!-- ▙ OVERVIEW ▟ --> <!-- ▙ OVERVIEW ▟ -->
<!-- --> <!-- -->
<!-- ▛ DONATE ▜ --> <!-- ▛ DONATE ▜ -->
<section id="donate" class="block"> <section id="donate" class="block">
@@ -376,15 +398,15 @@ Graphite's representation of artwork as a node graph lets you customize, compose
<div class="feature-icons four-wide"> <div class="feature-icons four-wide">
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 9" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" /> <img class="atlas" style="--atlas-index: 9" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" />
<span class="balance-text">Infinitely pan and zoom, export any resolution with no pixelation</span> <span class="balance-text">Infinitely pan and zoom; export any resolution with no pixelation</span>
</div> </div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 2" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" /> <img class="atlas" style="--atlas-index: 2" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" />
<span class="balance-text">Modular node-based pipelines for generative AI <em>(future)</em></span> <span class="balance-text">Build workflows to mix AI and human-authored content <em>(future)</em></span>
</div> </div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 11" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" /> <img class="atlas" style="--atlas-index: 11" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" />
<span class="balance-text">Asset pipelines for studio production environments <em>(future)</em></span> <span class="balance-text">Deploy asset pipelines in studio production environments <em>(future)</em></span>
</div> </div>
</div> </div>
@@ -475,7 +497,7 @@ Get started with Graphite by following along to a hands-on quickstart tutorial.
<div class="block video-container"> <div class="block video-container">
<div> <div>
<div class="youtube-embed aspect-16x9"> <div class="youtube-embed aspect-16x9">
<img data-youtube-embed="7gjUhl_3X10" loading="lazy" src="https://static.graphite.rs/content/index/tutorial-1-youtube.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Graphite Tutorial 1 - Hands-On Quickstart" /> <img data-youtube-embed="7gjUhl_3X10" loading="lazy" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube__2.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Vector Art Quickstart - Graphite, the Open Source 2D Graphics Suite" />
</div> </div>
</div> </div>
</div> </div>
+9 -11
View File
@@ -31,16 +31,14 @@ The idea for Graphite began with a desire to create artwork and edit photos usin
Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all. Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all.
Mission success will come when Graphite is an industry standard. A cohesive product vision and focus on innovation over imitation is the strategy that will make that possible. Mission success will come when Graphite is an industry standard. A cohesive product vision and a focus on innovation over imitation is the strategy that will make that possible.
</div> </div>
<div class="block"> <div class="block">
## Funding ## Organization
Graphite has no investors to answer to and will always be free and open source. [Keavon](#keavon), the project founder, has been personally funding all expenses out-of-pocket and turning down a tech industry salary to work full-time bringing Graphite to life. He asks for [your support](/donate) bearing a small fraction of that cost. Graphite is fully funded by its community and beholden to no investors, ensuring it remains free and open source forever. The organization, *Graphite Labs, LLC*, is owned and controlled solely by the project's founder. Future nonprofit foundation status is being explored, but that administrative complexity is not yet justified. All revenue is being reinvested into the project, with aims to employ full-time developers once funding reaches sustainable levels.
Long-term, donations will be supplemented by revenue from optional cloud storage/sync and high-speed GPU render services.
</div> </div>
@@ -138,15 +136,15 @@ Dennis is a mix between a mathematician and a mad scientist. While still enjoyin
</div> </div>
<div class="diptych"> <div class="diptych">
<div class="block" id="hypercube"> <div class="block" id="timon">
<img src="https://static.graphite.rs/content/about/core-team-photo-hypercube__2.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Photo of Hypercube" /> <img src="https://static.graphite.rs/content/about/core-team-photo-timon-schelling.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Photo of Timon Schelling" />
## "Hypercube" <span class="handle">(@0Hypercube)</span> <img src="https://static.graphite.rs/icons/flags/gb.png" class="flag" title="British" /> ## Timon Schelling <span class="handle">(@timon-schelling)</span> <img src="https://static.graphite.rs/icons/flags/de.png" class="flag" title="German" />
***Editor systems, nodes, tools, architecture*** ***Desktop application engineering***
"Hypercube" is a light speed code monkey who excels at developing, refactoring, and maintaining the editor codebase. With an unmatched ability to comprehend intricate code, he delivers lasting and efficient solutions at an impressive pace. He takes ownership of many central editor systems including tools, typography, transforms, layers, and node graph integration. Timon believes open source tools are essential to grant digital artists freedom in access, creativity, and expression. He builds and maintains Graphite's native desktop app, ensuring its polish, reliability, and cross-platform consistency. Drawn to Graphite by its vision of procedural, nondestructive, expansive 2D art tools, he works to make that vision usable by as many people as possible.
</div> </div>
@@ -156,7 +154,7 @@ Dennis is a mix between a mathematician and a mad scientist. While still enjoyin
## Adam Gerhant <span class="handle">(@pendapia)</span> <img src="https://static.graphite.rs/icons/flags/us.png" class="flag" title="American" /> ## Adam Gerhant <span class="handle">(@pendapia)</span> <img src="https://static.graphite.rs/icons/flags/us.png" class="flag" title="American" />
***Editor graph tooling, node data formats*** ***Editor node graph tooling***
Adam is a pragmatic problem solver with a talent for simplifying complexity. He is responsible for various architectural decisions which provide future proof integrations between the Graphene engine and editor. His work has greatly improved the performance, stability and code quality of the project, while also setting the stage for additional features. Adam is a pragmatic problem solver with a talent for simplifying complexity. He is responsible for various architectural decisions which provide future proof integrations between the Graphene engine and editor. His work has greatly improved the performance, stability and code quality of the project, while also setting the stage for additional features.
@@ -94,7 +94,7 @@ The next big news of August was my formation of [Graphite Labs, LLC](https://www
I allocated my time at several points throughout the year into growing and evolving this website with a refreshed and more visually-appealing home page, dedicated pages for information [about](/about) the project and its [features](/features), an area providing resources and help for [volunteers](/volunteer) and [code contributors](/volunteer/guide), and just this month— a [user manual](/learn) complete with an introductory tutorial series. The first video went up yesterday: I allocated my time at several points throughout the year into growing and evolving this website with a refreshed and more visually-appealing home page, dedicated pages for information [about](/about) the project and its [features](/features), an area providing resources and help for [volunteers](/volunteer) and [code contributors](/volunteer/guide), and just this month— a [user manual](/learn) complete with an introductory tutorial series. The first video went up yesterday:
<div class="youtube-embed aspect-16x9"> <div class="youtube-embed aspect-16x9">
<img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Graphite Tutorial 1 - Hands-On Quickstart" /> <img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube__2.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Vector Art Quickstart - Graphite, the Open Source 2D Graphics Suite" />
</div> </div>
The user manual and tutorial series will continue expanding throughout the coming weeks. Additional website features including user accounts, forums, and other community features are being planned. The user manual and tutorial series will continue expanding throughout the coming weeks. Additional website features including user accounts, forums, and other community features are being planned.
@@ -0,0 +1,29 @@
+++
title = "Graphite community meetup in Germany"
date = 2025-09-19
[extra]
banner = "https://static.graphite.rs/content/blog/2025-09-19-graphite-community-meetup-in-germany.avif"
banner_png = "https://static.graphite.rs/content/blog/2025-09-19-graphite-community-meetup-in-germany.png"
author = "Keavon Chambers"
summary = "Join us for a Graphite community meetup on October 10th, 2025 in Karlsruhe, Germany. Meet the core team and connect with fellow enthusiasts."
reddit = "https://www.reddit.com/r/graphite/comments/1nlt64g/graphite_community_meetup_in_germany_october_10/"
twitter = "https://x.com/GraphiteEditor/status/1969324821205925934"
bluesky = "https://bsky.app/profile/graphiteeditor.bsky.social/post/3lzaz3uizkc2j"
+++
To our European community: mark your calendars for the first official Graphite community meetup on **Friday, October 10th, 2025** in **Karlsruhe, Germany**. Meet core members of the project team and make acquaintance with your fellow Graphite enthusiasts plus Rust developers, open source contributors, and FOSS digital content creation software users.
<!-- more -->
To ensure we are prepared with enough space and food, [**please RSVP as soon as possible**](https://luma.com/d0psfopk) and remember to return to update the registration if your plans change.
We are posting this early so you can plan your trip while we finalize the schedule and agenda. Check back here for updates in the coming weeks. We are planning to host a mix of short workshops, talks, open-ended design discussions, socializing, and show-and-tell demos (including a hands-on sneak peek of the upcoming desktop app). [Get in touch](/contact) if you would like to present a talk or demo of how you've been using Graphite. Likely ranging from ~16:00 until 22:00, the schedule will be broken into both afternoon and evening sessions to accommodate options for earlier availability and later arrivals, with more "unconference" style plans in the afternoon and structured "meetup" style events in the evening. You are invited to attend all sessions or drop in for the later parts as your schedule and travel plans allow.
In attendance will be:
- Keavon Chambers, Graphite founder, designer, and project lead
- Dennis Kobert, technical lead and core maintainer
- Timon Schelling, developer of the Graphite desktop app
- Sebastian Sydow, contributor to Graphite's GPU infrastructure and <a href="https://rust-gpu.github.io/" target="_blank">Rust GPU</a> maintainer
We look forward to seeing you there.
+36 -36
View File
@@ -136,10 +136,18 @@ Marrying vector and raster under one roof enables both art forms to complement e
<img class="atlas" style="--atlas-index: 48" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 48" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Robust vector mesh editing/rendering</span> <span>Robust vector mesh editing/rendering</span>
</div> </div>
<div class="feature-icon ongoing" title="Development Ongoing">
<img class="atlas" style="--atlas-index: 43; transform: rotate(90deg)" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Automatic image trace vectorization</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 41" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 41" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Timeline panel for animation curves</span> <span>Timeline panel for animation curves</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 40" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Simplified main properties panel</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 9" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 9" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Custom attributes for table data</span> <span>Custom attributes for table data</span>
@@ -148,29 +156,13 @@ Marrying vector and raster under one roof enables both art forms to complement e
<img class="atlas" style="--atlas-index: 57" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 57" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Signed distance field rendering</span> <span>Signed distance field rendering</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 40" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Simplified main properties panel</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 43; transform: rotate(90deg)" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Automatic image trace vectorization</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 5" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Brush tool rewrite</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 54" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Local file browser for saving/loading</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 53" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 53" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Local fonts access</span> <span>Local fonts access</span>
</div> </div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 56" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 54" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Variable color swatches</span> <span>Local file browser for saving/loading</span>
</div> </div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 18" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 18" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
@@ -188,10 +180,22 @@ Marrying vector and raster under one roof enables both art forms to complement e
<div class="feature-icon heading"> <div class="feature-icon heading">
<h3>— Beta —</h3> <h3>— Beta —</h3>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 56" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Variable color swatches</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 52" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 52" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Command palette and context menus</span> <span>Command palette and context menus</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 28" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Physical units of measure</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 5" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Brush tool rewrite</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 43" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 43" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Stylus and touch interaction</span> <span>Stylus and touch interaction</span>
@@ -220,6 +224,10 @@ Marrying vector and raster under one roof enables both art forms to complement e
<img class="atlas" style="--atlas-index: 39" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 39" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Offline edit resolution with CRDTs</span> <span>Offline edit resolution with CRDTs</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 22" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>History brush and clone stamp tools</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 34" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 34" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Asset libraries and node marketplace</span> <span>Asset libraries and node marketplace</span>
@@ -244,25 +252,21 @@ Marrying vector and raster under one roof enables both art forms to complement e
<img class="atlas" style="--atlas-index: 25" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 25" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Liquify and warp transforms</span> <span>Liquify and warp transforms</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 32" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>PDF, EPS, AI, DXF, PSD, and TIFF</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 33" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>HDR and WCG color handling</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 55" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>CMYK and other color spaces</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 31" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 31" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Advanced typography and typesetting</span> <span>Advanced typography and typesetting</span>
</div> </div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 22" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 32" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Frozen-in-time graph references</span> <span>PDF, EPS, AI, DXF, PSD, and TIFF</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 55" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>CMYK, spot color, and ICC profiles</span>
</div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 33" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>HDR and WCG color handling</span>
</div> </div>
<!-- 1.0 Release --> <!-- 1.0 Release -->
<div class="feature-icon heading"> <div class="feature-icon heading">
@@ -288,10 +292,6 @@ Marrying vector and raster under one roof enables both art forms to complement e
<img class="atlas" style="--atlas-index: 11" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" /> <img class="atlas" style="--atlas-index: 11" src="https://static.graphite.rs/icons/icon-atlas-features__2.png" alt="" />
<span>Infinite generative vector patterns</span> <span>Infinite generative vector patterns</span>
</div> </div>
<div class="feature-icon">
<img class="atlas" style="--atlas-index: 28" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>Construction geometry mode</span>
</div>
<div class="feature-icon"> <div class="feature-icon">
<img class="atlas" style="--atlas-index: 29" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" /> <img class="atlas" style="--atlas-index: 29" src="https://static.graphite.rs/icons/icon-atlas-roadmap__3.png" alt="" />
<span>CAD style constraint relationships</span> <span>CAD style constraint relationships</span>
+2 -2
View File
@@ -25,8 +25,8 @@ If you're ever stuck or confused, ask your questions in the `#🧭user-help` cha
<!-- If you're eager to skip the reading, head straight to the [hands-on quickstart video](./introduction) in the next chapter for a beginner project walkthrough you can follow along with. --> <!-- If you're eager to skip the reading, head straight to the [hands-on quickstart video](./introduction) in the next chapter for a beginner project walkthrough you can follow along with. -->
The fastest way to get started is to watch and follow along steps-by-step in the hands-on quickstart video: The fastest way to get started is to watch and follow along steps-by-step in the hands-on quickstart tutorial:
<div class="youtube-embed aspect-16x9"> <div class="youtube-embed aspect-16x9">
<img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Graphite Tutorial 1 - Hands-On Quickstart" /> <img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube__2.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Vector Art Quickstart - Graphite, the Open Source 2D Graphics Suite" />
</div> </div>
+1 -1
View File
@@ -22,7 +22,7 @@ One is available now, and more will be released on a regular basis throughout ea
<!-- You can follow along with this starter project either by watching the tutorial video or referencing the step-by-step breakdown. --> <!-- You can follow along with this starter project either by watching the tutorial video or referencing the step-by-step breakdown. -->
<div class="youtube-embed aspect-16x9"> <div class="youtube-embed aspect-16x9">
<img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Graphite Tutorial 1 - Hands-On Quickstart" /> <img data-youtube-embed="7gjUhl_3X10" src="https://static.graphite.rs/content/learn/introduction/tutorial-1-vector-art-quickstart-youtube__2.avif" onerror="this.onerror = null; this.src = this.src.replace('.avif', '.png')" alt="Vector Art Quickstart - Graphite, the Open Source 2D Graphics Suite" />
</div> </div>
### Video 2 ### Video 2
+3 -3
View File
@@ -12,11 +12,11 @@ css = ["/layout/reading-material.css"]
<article> <article>
Graphite is open source software built by the community. The application is free to use by anyone for any purpose, even commercially. The artwork you produce is solely yours. Graphite is open source software built by its community and distributed by *Graphite Labs, LLC*, the official [organization](/about#organization) that operates the project. Builds of the application are free to use by anyone for any purpose, even commercially. The artwork you produce is solely yours.
The source code [available on GitHub](https://github.com/GraphiteEditor/Graphite) (including the Graphite editor application, libraries, and other software materials) is provided under the Apache 2.0 license posted below, unless otherwise noted within the repository. The source code [available on GitHub](https://github.com/GraphiteEditor/Graphite) (including the Graphite editor application, libraries, and other software materials) is shared under the Apache 2.0 license posted below, unless otherwise noted within the repository.
Visual assets, including but not limited to brand graphics, logos, fonts, icon sets, SVG data, and sample artworks are excluded from this code license and held under copyright by their respective owners. Derivative works must substitute these assets before distributing modified releases of the software. This protects the integrity of the [brand](/logo) and encourages the community to [contribute](/volunteer) back to the official project instead of fragmenting the ecosystem. Visual assets, including but not limited to brand graphics, logos, fonts, icon sets, SVG files, and sample artworks are excluded from this code license and held under copyright by their respective owners. Derivative works must substitute these assets before distributing modified releases of the software. This protects the integrity of the [brand](/logo) and encourages the community to [contribute](/volunteer) back to the official project instead of fragmenting the ecosystem.
--- ---
+5 -4
View File
@@ -24,10 +24,11 @@ The Graphite logo is made available for community use, with some limitations. Wh
Please be advised that the logo is not part of the software's Apache 2.0 [license](/license). Users of the logo must adhere to the usage policy: Please be advised that the logo is not part of the software's Apache 2.0 [license](/license). Users of the logo must adhere to the usage policy:
1. Do not use the Graphite logo as your own. It should not be used as your primary, or most visually prominent, branding. Your usage should not imply that it's a part of the official Graphite project, nor that it's endorsed or affiliated. 1. Do not use the Graphite logo as your own. It should not be used as your primary—or most visually prominent—branding, and may never be incorporated into your own logo. Your usage should not imply that it's a part of the official Graphite project, nor that it's endorsed or affiliated.
2. Only use the logo when talking about, describing, referencing, or crediting the official Graphite project or software. If used as a hyperlink, it should point only to <https://graphite.rs>. 2. Your (product, service, website, company, channel, etc.) brand name should not begin with "Graphite", or use it as the most prominent word in the name. It may only be used as a secondary or descriptive word that comes after your own unique name. For example: "XYZ for Graphite" is acceptable, but "Graphite XYZ" is not since it implies affiliation.
3. Do not modify the logo. The solid-colored version may only be recolored with another substitute solid color if doing so is necessary for visual consistency when presented alongside other logos of the same color. Sufficient blank space should be preserved around the logo so it does not compete with impinging design elements. 3. Only use the logo when talking about, describing, referencing, or crediting the official Graphite project or software. If used as a hyperlink, it should point only to <https://graphite.rs>.
4. Commercial use of the logo (for example, merchandise sales) is not allowed without express written permission. 4. Do not modify the logo. The solid-colored version may only be recolored with another substitute solid color if doing so is necessary for visual consistency when presented alongside other logos of the same color. Sufficient blank space should be preserved around the logo so it does not overlap or compete with impinging design elements.
5. Commercial use of the logo (for example, merchandise sales) is not allowed without express written permission.
If in doubt, please <a href="/contact">get in touch</a> by email to request clarification or permission. If in doubt, please <a href="/contact">get in touch</a> by email to request clarification or permission.
@@ -192,7 +192,7 @@ Several of these require a good understanding of computer graphics rendering tec
*Graphite's raster editing features requires the implementation of Select mode, where users can draw a mask which becomes a marquee (marching ants) selection.* *Graphite's raster editing features requires the implementation of Select mode, where users can draw a mask which becomes a marquee (marching ants) selection.*
- **Possible Mentors:** [Keavon](/about#keavon), [Hypercube](/about#hypercube) - **Possible Mentors:** [Keavon](/about#keavon)
- **Needed Skills:** Rust, computer graphics - **Needed Skills:** Rust, computer graphics
- **Project Size:** Large *(GSoC: 350 hours)* - **Project Size:** Large *(GSoC: 350 hours)*
- **Difficulty:** Medium - **Difficulty:** Medium
@@ -229,7 +229,7 @@ The present system is very row-centric, which makes it challenging to create mul
*Graphite has many areas that could benefit from better automated testing for bugs and performance regressions.* *Graphite has many areas that could benefit from better automated testing for bugs and performance regressions.*
- **Possible Mentors:** [Dennis](/about#dennis), [Hypercube](/about#hypercube) - **Possible Mentors:** [Dennis](/about#dennis)
- **Needed Skills:** Rust, unit testing - **Needed Skills:** Rust, unit testing
- **Project Size:** Small *(GSoC: 90 hours)* or larger if proposed - **Project Size:** Small *(GSoC: 90 hours)* or larger if proposed
- **Difficulty:** Easy - **Difficulty:** Easy
+2 -1
View File
@@ -390,7 +390,8 @@
// ▙ NEWSLETTER ▟ // ▙ NEWSLETTER ▟
// ▛ DIVE IN ▜ // ▛ DIVE IN ▜
#dive-in { #dive-in,
#what-is-new {
.video-container { .video-container {
background: var(--color-fog); background: var(--color-fog);
margin-top: calc(40 * var(--variable-px)); margin-top: calc(40 * var(--variable-px));