Commit Graph

64 Commits

Author SHA1 Message Date
Keavon Chambers 4df780391c Fix Bezier-rs web demos failing to run wasm-opt in CI 2024-10-27 15:06:22 -07:00
Keavon Chambers a395fbf063 Fix/suppress new Clippy warnings introduced in Rust 1.82 2024-10-25 11:14:51 -07:00
Keavon Chambers 0b0169a415 Remove serde from Bezier-rs web demos to reduce Wasm size 2024-09-24 01:33:15 -07:00
James Lindsay fa1535d0bb
Update dependencies and lock files (#1841)
* Bump lock files

* Fix glam mismatch version

* Add tokio feature

* Update all deps

* Fix gpu-compiler not able to reference the root workspace

* Bump a few more deps

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-07-22 02:56:29 -07:00
Dennis Kobert 212f08c6c8
Restore functionality of GPU infrastructure (#1797)
* Update gpu nodes to compile again

Restructure `gpu-executor` and `wgpu-executor`

And libssl to nix shell

Fix graphene-cli and add half percision color format

Fix texture scaling

Remove vulkan executor

Fix compile errors

Improve execution request deduplication

* Fix warnings

* Fix graph compile issues

* Code review

* Remove test file

* Fix lint

* Wip make node futures send

* Make futures Send on non wasm targets

* Fix warnings

* Fix nested use of block_on

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-07-15 13:14:48 +00:00
Dennis Kobert 3657b37574
Deprecate LetNodes in favor of new scope API (#1814)
* WIP

* Start deprecating let nodes

* Replace WasmEditorApi network imports with new Scope input

* Add missing unwrap

* Add #[serde(default)] to scope_injections

* Restructure WasmEditorApi definition to be available as a TaggedValue

* Fix text node

* Use stable toolchain in nix shell again

* Code review

* FIx text node and remove all remaining warnings

* Require executor input to be 'static

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-07-10 14:18:21 +02:00
Raminder Singh 62f73df048
Fix a lot of Clippy warnings (#1808)
* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* bump msrv to 1.70.0 to silence warnings

* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* fix a few more warnings

* fix a clippy warning

* remove a commented out line

* silense too many arguments error

* fix more clippy warnings

* prefix underscore to unused vars/functions to fix warnings

* use filter instead of map

* move raw-rs-tests feature flat to module level to fix unused imports warnings

* fix a couple of unused result warnings

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-07-09 05:02:52 -07:00
Keavon Chambers f7ada701e5
Reorganize cargo dependencies and upgrade most of them (#1815)
* Reorganize cargo dependencies and upgrade most

* cargo update

* Attempt 2

* Polishing changes

* Comment out specta typescript flag-dependent code

* Fix test
2024-07-09 04:08:28 -07:00
Elbert Ronnie 5a1c171fc3
Add Area and Centroid nodes (#1749)
* initial attempt for area node

* allow node preview for more types

* make AreaNode sync and add CentroidNode

* cargo fmt

* preview of DVec2

* make the nodes async again

* use segment domain instead of region domain

* modify the check for linearity

* create a limit for area in centroid calculation

* cargo fmt

* reverse unnecessary changes

* add threshold to area calculation too.

* handle zero area edge case

* add todo comment

* implement 1D centroid and use it as fallback

* formatting floats to skip last zero

* add Centroid Type radio button to Centroid Node

* rename docs to use area and perimeter centroid

* add web demos for perimeter centroid

* add tests for perimeter centroid

* add fallback to use average of points

* Fix for broken area

* missing fixes

* Code review and rename Perimeter Centroid to Length Centroid

* Use dummy footprint in Area and Centroid nodes

* add doc and todo to clarify when `is_linear` fails

* use epsilon instead of zero

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2024-05-22 13:11:11 -07:00
Elbert Ronnie beb88d280c
Bezier-rs: Add calculations for area and centroid of subpaths (#1729)
* add code to calculate area and centroid of subpath

* change library to poly_it

* add a demo of area and centroid

* modify algorithm to consider negetive area as positive

* add code for manipulating polynomials in bezier-rs

* remove `poly_it` dependency and use custom Polynomial

* formatting floats to skip last zero

* add debug mechanism

* collect both intersection points instead of one

* fix test and cargo fmt

* apply minimum separation filtering in self_intersection and use better endpoint filtering algorithm

* remove debug mechanism and cargo fmt

* consider the subpath as closed for intersection calculation

* add documentation for polynomial.rs

* impl display for Polynomial

* make area always positive

* add missing docs

* fix test and cargo fmt

* Naming/formatting code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-29 19:19:12 -07:00
Keavon Chambers 0a9bd41be1
Code cleanup and refactoring to enhance consistency (#1695)
- Move message handler payload data into structs
- Organize the file structure used by `editor/src/messages/portfolio/document` `/node_graph` and `/graph_operation`
- Make derive attributes use `serde::Serialize, serde::Deserialize` consistently instead of `use serde::{Deserialize, Serialize};` imports
- Various other code cleanup and refactoring
2024-03-20 21:28:51 -07:00
0HyperCube 218e9675fd
Attribute-based vector format refactor (#1624)
* Initial vector format structure

* Click targets

* Code review pass

* Remove subpaths from vector data

* Morph node & vector node tests

* Insignificant change

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-09 10:27:30 -08:00
Keavon Chambers 6b6accfb91
Add Poisson-disk sampling node and Bezier-rs 0.4 release (#1586)
* Add Poisson-disk sampling node and Bezier-rs 0.4 release

* Additional optimizations

* More performance optimizations with help from 0Hypercube

* Add comments
2024-01-28 02:25:46 -08:00
0HyperCube 456ca170a4
Layer and grid snapping systems (#1521)
* Grid overlays

* Rectangle tool basic snapping

* Fix bezier demos

* Fix bézier crate tests

* Constrained snapping for circle & shape tool

* Line tool snapping

* Pen tool snapping

* Path tool snapping

* Snapping whilst dragging layers (not constrained)

* Constrained drag

* Resize snapping

* Normal and tangent

* Cleanup

* Grid snapping

* Grid snapping

* Fix imports

* Fix bug in artboard tool

* Fix hang on 0 size grid spacing

* Fix NaN when scaling

* Polishing

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-01-13 14:32:10 +00:00
0HyperCube 6a10bcc3fc Bezier-rs: add Tangents/Normals to Point functions (#1547)
* Add tangent/normal to point to bézier-rs

* Add license information and general cleanup

* Bump version

* Add iframe demos

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-01-07 06:33:06 -08:00
Keavon Chambers d268afb7fb Fix Bezier-rs interactive demos and migrate its Webpack bundler to Vite 2024-01-04 23:13:40 -08:00
Dennis Kobert d2450b4d61
Refactor Graphite dependency management (#1455)
* Refactor Graphite dependency management

* Remove deprecated future executor

* Code review nits

* Remove unused dependencies

* Update dependencies and make compile with all features

* Replace use of future_executor with wasm-bindgen-futures

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-04 12:39:55 +01:00
Yuri Astrakhan 3d4e3a74e5
A few minor lints and docs (#1436)
* A few minor lints and docs

* Added required packages to compile on Debian-style linux
* Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline)
* a few spelling mistakes

* fix fmt
2023-10-18 23:33:10 -07:00
0HyperCube b881385e3b
Update wasm-bindgen, syn and wgpu (#1398) 2023-08-23 14:53:56 +00:00
nat-rix dc4b16aead
Curves image adjustment node (#1214)
* Create ValueMapperNode and use it for brightness/contrast

* move spline code into seperate module

* Add GenerateCurvesNode

* add a `LuminanceMut`-trait
* add `lerp` to `Channel`

* Add frontend code to handle the curves widget's inputs

* Rename spline module to curve

* Make messages in CurveInput pass

* Improve curves widget design and fix sizing issue

* Implement proper bezier handling

* Use bezier_rs's intersections function instead of own cubic root solver

* Debounce CurveInput events and change how debouncer works

the first event issued to the debouncer was unneccessarily delayed.
Instead now the debouncer fires it instantaneously but blocks events
that come in until a timeout was reached.

* Make curve editing more user friendly

* Change code to use project terminology

* sample -> manipulator group or manipulator
* marker -> handle

* Fix small documentation mistake in bezier-rs

* Add find_tvalues_for_x function to bezier-rs

also integrate the function into curves node

* Add tests for find_tvalues_for_x in bezier-rs

* Fix formatting

* Revert BrightnessContrastNode changes

* Frontend cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-13 01:07:11 -07:00
0HyperCube 80cc5bee73 Fix clippy lints (#1327)
* Fix clippy lints

* Update formatting

* Remove unsafe send impls

* New type for Rc<NodeContainer>
2023-07-19 16:38:23 +01:00
Prikshit Gautam 70fcb35444 Remove warnings from build and satisfied clippy (#1288)
* Prefixed unused functions with underscore

* Applied clippy lints

* Fixed some warnings and removed some `allow` statements
2023-06-07 14:46:47 +05:30
Dennis Kobert 2887ba2aa4 Add logging for bezier-rs web demos (#1286) 2023-06-04 12:29:00 +02:00
Dennis Kobert 1020eb6835 Implement the Brush without relying on a stamp texture
Test Plan: Test the BrushNode in the editor

Reviewers: Keavon

Reviewed By: Keavon

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1184
2023-04-29 01:31:14 +02:00
Keavon Chambers c770cd906e Bezier-rs: Fix visualizing negative curvature on demo site 2023-03-28 17:54:11 -07:00
Hannah Li 97be83c404 Bezier-rs: Implement miter-limit (#1096)
* Implement miter-limit approximation

* Refactor to use Join enum and address other comments

* Rustdocs improvements

* Tweaks

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-27 22:58:35 -04:00
Linda Zheng 3733804d18 Bezier-rs: Add lookup table function for subpath and make it support euclidean parameterization (#1082)
* Add euclidean option for lut

* Add lut for subpath

* Fix rust formatting

* Fixed breakages caused by UI updates

* Code cleanup

* Make ProjectionOptions optional

---------

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-27 21:05:00 -04:00
Linda Zheng d0ac86b713 Bezier-rs: Add curvature and rotate functions to subpath (#1081)
* Add rotate and curvature

* Fix comments

* Fix case where curve is linear

* Address comments

* Fixed breakages caused by UI updates

* Scootch rotation point to center in frame

* Code review

* Visualize t value point when segment is linear

---------

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-27 19:35:57 -04:00
Hannah Li c0576ab4e0 Bezier-rs: Add joins and caps to offsets and outlines (#1083)
* Intial work

* Improve miter and add round join

* Get arcs to go opposite direction

* Add cap and other refactors

* Rename joint to join, fix some bugs

* Fix single point issue

* Clean up

* Fix iframe sizes and update UI

* Address comments and handle single point outline

* Rename variables, fix branches in outline

* Address comments
2023-03-27 16:25:08 -04:00
Rob Nadal 834cb1a227 Bezier-rs: Update interactive demo site UI/UX (#1085)
* wip - change demo iframe styling

* fix typo

* change tVariant select from radio buttons to dropdown

* Added iframe styling

* fix linting errors

* Integrated tvariant picker as input options

* Updated points in demos

* Lint

* Clean up CSS

---------

Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-21 01:23:02 -04:00
Rob Nadal ccb698ffa8 Bezier-rs: Subpath offset and bezier offset improvements (#1039)
* Added subpath offset

* Enhanced offset to produce smooth curves

* Lots of outline bugfixes

* Fixed failing unit tests

* Added subpath outline

* Refactor bezier offset and outline to return Subpaths

* Fix outline bug due to smooth joining and removed reduce optimization that causes jumping approximations

* Bugfix when subpath angle is acute but doesn't intersect

* Stylistic changes per review

* Stylistic changes per review and updated doc comments

---------

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-03 14:21:21 -05:00
0HyperCube 66ec85a3c9 Bézier-rs: Add utils to subpath (#1058)
* Add utils to bezier-rs subpath

* Apply code review changes

* Remove tan from constant

* Fix compile

* Fix tests
2023-03-02 16:48:09 +00:00
Rob Nadal 8bc290fde9 Bezier-rs: Add function to smoothly join bezier curves (#1037)
* Added bezier join

* Stylistic changes per review
2023-02-28 18:59:06 -05:00
Hannah Li 8d3daeae78 Bezier-rs: Add trim for Subpath (#1006)
* Move compare.rs

* Update traits for Subpath and ManipulatorGroup

* Implement trim

* UI adjustments and more tests

* Add reverse, refactor code, rename variables

* Improve comments

* Comment nits

* Address comments

* Update trim behavior

* Update doc comment for trim

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-26 18:41:11 -05:00
0HyperCube 08b2782917 Bézier-rs: Add ids to manipulator groups (#1054)
* Add ids to manipulator groups

* Fix tests

* Rename trait from ManipulatorGroupId to Identifier

* Rename EmptyManipulatorGroupId to EmptyId
2023-02-25 16:23:58 +00:00
Thomas Cheng f2d35f50de Bezier-rs: Add self_intersection to subpath (#1035)
* add self-intersection to subpath, rebased old work onto master

* fix interactive website after rebase

* fix rustdoc iframe placement

* remove double comment

* address comments

* revert evaluate change

* address comment + fix assert statement bug

* update function comments
2023-02-21 17:08:55 -05:00
Linda Zheng 37775eb9e9 Bezier-rs: Add bounding box, extrema, and inflection functions for subpath (#953)
* Create bbox function for subpath

* Create extrema and inflection function for subpath

* Address comments

* Prevent selecting text in SVG demo boxes

* Address Keavon's comments

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-20 13:40:38 -05:00
Rob Nadal 9a52cae9b9 Bezier-rs: Add SubpathTValue and euclidean parameterization for subpaths (#1027)
* Added SubpathTValue and euclidean parameterization for subpaths

* Small fix

* Added bounds checking to get_segment

* Code review

* code review nit for clarity

---------

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-17 15:33:52 -05:00
Rob Nadal a64c856ec4 Bezier-rs: Updated Bezier function signatures to accept TValue (#967)
* Create helper for converting d to t values

* Add euclidean option for tangent and normal

* Modified bezier functions signatures to accept ComputeType

* Stylistic changes per review

* Added ComputeType documentation

* Renamed ComputeType to TValue

* Fixed comments

* Fixed failing unit tests

* Code review

* Fix comments in code review

* Renamed compute_type_to_parametric to t_value_to_parametric

---------

Co-authored-by: Linda Zheng <thelindazheng@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-13 12:31:51 -05:00
Hannah Li a328e7d3ef Bezier-rs: Add split for Subpath (#988)
* Add subpath split

* Update comment and colors

* Address comments

* Improve visualization clarity

* Code review

---------

Co-authored-by: Rob Nadal <Robnadal44@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-01-31 03:17:20 -05:00
Jackie Chen 511a8aa164 Bezier-rs: Add normal and tangent to subpath (#1003)
tangent and normal for subpath

Co-authored-by: Rob Nadal <Robnadal44@gmail.com>
2023-01-31 00:15:37 -05:00
Keavon Chambers 66e8325362 Update project readme and MSRV 2023-01-24 01:33:30 -08:00
Hannah Li 758f757783 Bezier-rs: Insert function for subpath (#876)
* Add manipulator

* Add manipulator group

* Add UI

* Address comments and rebase

* Renamed add_manipulator_group to insert

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
2023-01-12 18:26:25 -08:00
Rob Nadal 72cd204c64 Bezier-rs: Add project function for Subpaths (#914)
* Added subpath project function

* Set appropriate project default in single manipulator group case

* Lint

* Return optional from subpath project + stylistic changes per review

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-12-29 18:32:22 -05:00
0HyperCube 11401f8692 Avoid deprecated into_serde() (#906) 2022-12-23 19:16:23 +00:00
Rob Nadal ef99c91226 Bezier-rs: Added function to find intersections between a bezier and a rectangle (#897)
* added function to find intersections for a rectangle

* Added is_contained_within function
2022-12-21 14:44:11 -08:00
TrueDoctor 7d8f94462a Bundle Graphite using Tauri (#873)
* Setup tauri component for graphite editor

Integrate graphite into tauri app

Split interpreted-executor out of graph-craft

* Add gpu execution node

* General Cleanup
2022-12-07 12:49:34 +01:00
Thomas Cheng 52cc770a1e Bezier-rs: Add parametric evaluate and line intersect to subpath (#852)
* add slider to subpath component + change evaluate to take an enum

Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com>

wip - add intersect to subpath, TODO fix bug

Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com>

add unit tests to subpath intersections

stress, testing

Co-authored-by: Hannah Li <hannahli2010@gmail.com>

* add parametric eval impl to subpath

* add line intersection to subpath

* Uncomment and #[ignore] disabled tests

* Reorder a few imports

* change subpath:eval slider to radio button

* fixed bug with solve_cubic, fixed unit tests, improved intersection accuracy

* fix failing test

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-12-11 00:41:02 -05:00
Hannah Li 01a9724389 Bezier-rs: Add Euclidean parameterization to Bezier::evaluate (#828)
* Add enum to evaluate for differenciating compute type

* Add euclidean parameterization and update styling in the UI

Co-authored-by: Rob Nadal <robnadal44@gmail.com>

* Update usage of evaluate in graphite

* Add description

* Code review changes

* Update tests

* Improve ComputeType ergonomics

* Large code review/cleanup pass

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-11-18 20:37:52 -08:00
Rob Nadal a220bfa759 Bezier-rs: Remove unused legacy drawing components and structs (#853)
* Removed unused legacy drawing components

* Removed Point abstraction from frontend code

* Code review fixes

* Helper lambdas to functions

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-11-18 00:34:52 -08:00