2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow. https://graphite.rs
Find a file
caleb f9f66db5a2 Boolean shape operations (#470)
* added BooleanUnion message for select tool, which is sent by the BooleanUnion button

* select to dispatches a BooleanUnion message
   - as far as I can tell the selected layers aren't stored anywhere

* Added neccesary messages and functions for boolean operation

* Intersection code, as yet untested
does not compile

* Updated intersection algorithm

* Fixed shapes_as_seen
   - should not be effected by root transform, should be effected by the shape transform
Working line intercepts

* updated intersection algorithm

* added SubCurve struct, to reduce creation of new PathSegs and more efficiently calculate bounding boxes

* intersection algorithm modifications

* changed sub_curve to do less copying

* intersection algorithm working for ellipses
   - idk why though, the algorithm isn't finding close, but nearby intersections

* Code for the sub-shape identification pieces of boolean operation algorithm

* cycle direction calculations
boolean_operation code

* final touches (a.k.a. the very begining touches before the debugging)

* removed intersection testing code to draw intersects
added code to add new shapes to document

* Bug Fix: Cycle needs to track egde origin
Bug Fix: vertex markers
Working for simple shapes

* Bug Fix: multiple intersections in same PathSeg

* Bug Fix: compare the absolute value of area magnitudes

* Bug Fix: subdivision algorithm

* cargo fmt

* comments

* Bug Fix: Difference and Subtraction operations

* simplified overlap

* changed shapes_as_seen to transformed_shapes
    - modified function to use existing code for multiplying transforms and traversing layer tree

removed shape_as_seen, helper function to shapes_as_seen

* Bug Fix: selected layers must be sorted

* Changed SubFront to SubtractFront and SubBack to SubtractBack

* moved F64PRECISION to graphene::consts

* Best practices changes
intersection algorithm changes

* Added BooleanOperationError

* modified intersection algorithm to use more dynamic thresholds

* intersection algorithm modification

* Added "do_if"

* Bug Fix: properly subdivide segments with multiple intersections

* Added tests for intersection algorithm

* restructured flow control in intersection algorithm
restructured intersection algorithm to modify single vector
    - should have done this yeeeaars ago

* Shapes will have the pathstyle of alpha

* collect_shapes now uses closure

* BugFix: fixed PathGraph:get_cycles, prevent multicounting cycles

* Added boolean_ops::reverse_path function

* Curves are now reversed before intersections are found

* cleanup

* BugFix: subfront and subback chose wrong shape pathstyle
BugFix: path concat should remove internal movetos and closepaths

* BugFix: prevent movetos from being added due to intersect imprecision

* Changed intersection quality threshhold to CURVE_FIDELITY

* Added functions for cubic/quadratic roots
!Does not compile!

* Added special case algorithms for line-curve intersections
Added tests for cubic root algorithm

* changed line_curve_intersections structure

* Handle intersecting shape without curve intersection case

* Behavior for SubtratFront, SubtractBack, Union, and Intersection for the no-intersect cases

* reformatted PathGraph::add_edges_from_path
Fixed bugs involving closepaths and subpaths

* Bug fix: fix refactoring error

* Bug fix: don't consider 0 length cycles
Bug Fix: dummy vertices are not intersections

* the function document_message_handler::sort_layers sorts the layers from bottom to top
    - we want the reverse

* Bug Fix: ClosePath must be appended to shapes constructed from cycle
    - By default PathGraph edges are not closed.
    - When the input shape was not closed there would be multiple unclosed paths in the resulting shape, causing bugs

* close_path now closes all subpaths in a path
    - if a shape has any subpath which is not closed boolean operations are undefined
        (Also PathGraph::add_edges_from_path breaks when the path isn't closed)

* clean up

* removed unused function "intersectoin_candidates"

* comments

* removed duplicate check for valid intersection in horizontal_ray_cast

* Temporary fix for ray casting

* it wouldn't build cause one of these ->' pesky things was hanging around in the wrong neighborhood

* ignoring intersection test cases because they do exact fp comparison

* Some spelling fixes and abbreviation burnination (more needed)

* spelling fixes
close_path bug

* Fixed: local extrema were not being properly filtered out for subcurves
Fixed: reversing PathSeg removes any closepaths

* spelling

* Code review pass

* partial implementation overlapping identical curves

* Untested implementation for test for overlapping curves
    - Test is not yet used in intersection algorithm

* -Removed PathGraph::intersect()

* readability improvements
changed line_t_value to be more forgiving to error

* Bug Fix: match_control_polygon didn't properly compare different degree polygons

* Added colinear() function
Added projection_on_line() function

* BugFix project_onto_line

* removed extra log

* rust fmt

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: TrueDoctor <dennis@kobert.dev>
2022-02-12 09:30:08 -08:00
.deploy Rename deployment script 2022-02-03 18:29:02 -08:00
.github Skip cargo-about in CI to save 5 minutes (#409) 2021-12-20 02:22:19 -08:00
.vscode Switch VS Code's Vue extension from Vetur to Volar 2022-01-12 05:17:56 -08:00
docs Remove Charcoal references from the code for now 2022-01-12 03:56:28 -08:00
editor Boolean shape operations (#470) 2022-02-12 09:30:08 -08:00
frontend Implement the Properties panel with a transform section for layers (#527) 2022-02-12 08:22:57 -08:00
graphene Boolean shape operations (#470) 2022-02-12 09:30:08 -08:00
proc-macros Implement the Crop Tool for artboard resizing (#519) 2022-02-09 23:22:23 +00:00
.editorconfig Move .editorconfig to root for GitHub tab rendering 2021-03-24 14:02:26 -07:00
.gitattributes Add npm start script alias for npm run serve 2022-01-12 06:14:32 -08:00
.gitignore Define the js wasm-editor interface (#31) 2021-03-21 19:32:56 +01:00
.nvmrc Switch to Node.js 16 LTS, upgrade TypeScript, ESLint, and other dependencies (#395) 2021-11-29 03:32:09 -08:00
about.hbs Do not silently install cargo-about. (#377) 2021-09-19 16:58:04 +02:00
about.toml Auto-generate third-party license notices (#370) 2021-09-06 06:57:35 -07:00
Cargo.lock Layout system implementation and applied to tool options bar (#499) 2022-01-30 17:53:37 -08:00
Cargo.toml Remove Charcoal references from the code for now 2022-01-12 03:56:28 -08:00
deny.toml Set up cargo-deny (#358) 2021-08-26 11:01:56 +02:00
graphite_splash.png Overhaul main readme with recent project updates 2021-03-22 01:19:16 -07:00
LICENSE.txt Add Apache 2 license 2020-07-12 13:58:50 -07:00
package.json Add npm start script alias for npm run serve 2022-01-12 06:14:32 -08:00
README.md Update the project readme 2021-12-06 16:51:58 -08:00
rustfmt.toml Upgrade rustfmt to 2021 edition 2021-11-02 20:08:39 -07:00

Graphite Logo

Powerful 2D vector and raster editing. Procedural and nondestructive.

Graphite is a digital content creation software package for 2D graphics, merging traditional tool-based interactive editing workflows with a powerful node-based approach to procedural, non-destructive editing and compositing. The application strives to be the most user-friendly and versatile tool for vector and raster illustration, graphic design, photo editing, procedural texturing, data-driven visualization, and technical art.

While the project is still in early development, implementation progress has been moving forward at a swift pace. The Graphite Alpha release is launching soon and focuses on vector art for SVG creation. The next major milestone will introduce a nondestructive backend for vector graphics with a powerful node graph system. Later releases will provide better vector rendering capabilities and then resolution-agnostic raster editing and compositing.

Play around with Graphite right now in your browser at editor.graphite.design. Windows, Mac, and Linux will additionally be supported with a native (not web-based) desktop client later in the development roadmap.

Contributing

We need Rust and web developers! See instructions here for getting started.

We are also in search of a new logo and brand style system. If you are an experienced designer, please get in touch for more details.

Discord

If the Graphite project strikes your fancy, join our Discord community to chat with the community and development team. You're invited to stop by just to lurk, ask questions, offer suggestions, or get involved in the project. We are seeking collaborators to help design and develop the software and this is where we communicate. Paste https://di----scord.gg/uMjBz----5N68W into your browser and delete the dashes. (To prevent spam bots, please don't share the link on any website without the dashes.)

Vision

Graphite is an open source, cross-platform digital content creation desktop and web application for 2D graphics editing, photo processing, vector art, digital painting, illustration, data visualization, compositing, and more. Inspired by the open source success of Blender in the 3D domain, it aims to bring 2D content creation to new heights with efficient workflows influenced by Photoshop/Gimp and Illustrator/Inkscape and backed by a powerful node-based, nondestructive approach proven by Houdini and Substance.

The user experience of Graphite is of central importance, offering a meticulously-designed UI catering towards an intuitive and efficient artistic process. Users may draw and edit in the traditional interactive (WYSIWYG) viewport with the Layer Tree panel or jump in or out of the node graph at any time to tweak previous work and construct powerful procedural image generators that seamlessly sync with the interactive viewport. A core principle of the application is its 100% nondestructive workflow that is resolution-agnostic, meaning that raster-style image editing can be infinitely zoomed and scaled to arbitrary resolutions at a later time because editing is done by recording brush strokes, vector shapes, and other manipulations parametrically.

One might use the painting tools on a small laptop display, zoom into specific areas to add detail to finish the artwork, then perhaps try changing the simulated brush style from a blunt pencil to a soft acrylic paintbrush after-the-fact, and finally export the complete drawing at ultra high resolution for printing on a large poster.

On the surface, Graphite is an artistic medium for drawing anything imaginable— under the hood, the node graph in Graphite powers procedural graphics and parametric rendering to produce unique artwork and automated data-driven visualizations. Graphite brings together artistic workflows and empowers your creativity in a free, open source package that feels familiar but lets you delve further.

This UI mockup illustrates a future concept for the raster-based workflow in a photo editing example.

Demo UI mockup

Roadmap

The Graphite team is focusing initial feature development on a simple vector graphics editor for the Alpha release.

Following this MVP release, the layer system will be extended into a fleshed-out node graph system, called Graphene, to offer innovative nondestructive vector editing capabilities in the next milestone release.

The following major releases will add a purpose-built render engine to support node-based raster editing, thereby providing a seamless combined raster and vector workflow.

The interim web-based frontend will be replaced by an identical native desktop client for Windows, Mac, and Linux plus the web. This new frontend will mark the release of Graphite 1.0 when complete.

Development is broken into monthly sprints culminating in a presentation at the Rust Gamedev Meetup and a post in the Rust Gamedev Newsletter. Check out the Task Board to see the current features being built and prioritized.

Technology stack

Rust is the language of choice for many compelling reasons. It is low-level and highly efficient which is important because the nondestructive, resolution-agnostic editing approach will already be challenging to render quickly for interactive, real-time editing. Furthermore, Rust makes multithreading easy to implement and its safety guarantees will eliminate the inclusion of many bugs and crashes in the software. It is also simple to compile Rust code natively to Windows, Mac, Linux, and web browsers via WebAssembly, with the possibility of deploying Graphite to mobile devices down the road as well.

Vue.js is the web frontend framework initially used for building Graphite's user interface. This means, for the moment, Graphite will only run in a browser using Rust code compiled to WebAssembly (via wasm-bindgen). This web-based GUI is intended to be rewritten in a native Rust GUI framework once that ecosystem matures or the project has engineering resources to write a tailor-made GUI framework for Graphite's needs. Development initially began by writing a custom GUI system throughout 2020, but slow progress led to the decision of shelving it in lieu of a temporary web-based GUI.

WebGPU (via the WGPU Rust library) will be used as the graphics API for GPU-accelerated rendering because it is modern, portable, and safe. It makes deployment on the web and native platforms easy while ensuring consistent cross-platform behavior. Shaders will be written in Rust GPU to keep the codebase in a consistent language. Early Graphite releases are relying on web browsers' built-in SVG rendering capabilities before work begins building Graphite's sophisticated render engine.