mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 01:58:12 +08:00
Integrate Vello for vector rendering (#1802)
* Start integrating vello into render pipeline Cache vello render creation Implement viewport navigation Close vello path Add transform parameter to vello render pass * Fix render node types * Fix a bunch of bugs in the path translation * Avoid panic on empty document * Fix rendering of holes * Implement image rendering * Implement graph recompilation afer editor api change * Implement preferences toggle for using vello as the renderer * Make surface creation optional * Feature gate vello usages * Implement skeleton for radial gradient * Rename vello preference * Fix some gradients * Only update monitor nodes on graph recompile * Fix warnings + remove dead code * Update everything except for thumbnails after a node graph evaluation * Fix missing click targets for Image frames * Improve perfamance by removing unecessary widget updates * Fix node graph paning * Fix thumbnail loading * Implement proper hash for vector modification * Fix test and warnings * Code review * Fix dep * Remove warning --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
8e774efe9d
commit
ab71d26d84
@@ -21,5 +21,6 @@ glam = { version = "0.25", features = ["serde"] }
|
||||
dyn-any = { version = "0.3.0", path = "../dyn-any", optional = true }
|
||||
|
||||
# Optional workspace dependencies
|
||||
kurbo = { workspace = true, optional = true }
|
||||
serde = { workspace = true, optional = true }
|
||||
log = { workspace = true, optional = true }
|
||||
|
||||
@@ -124,7 +124,7 @@ unsafe impl dyn_any::StaticType for BezierHandles {
|
||||
pub struct Bezier {
|
||||
/// Start point of the bezier curve.
|
||||
pub start: DVec2,
|
||||
/// Start point of the bezier curve.
|
||||
/// End point of the bezier curve.
|
||||
pub end: DVec2,
|
||||
/// Handles of the bezier curve.
|
||||
pub handles: BezierHandles,
|
||||
|
||||
@@ -343,6 +343,27 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
|
||||
subpath
|
||||
}
|
||||
|
||||
#[cfg(feature = "kurbo")]
|
||||
pub fn to_vello_path(&self, transform: glam::DAffine2, path: &mut kurbo::BezPath) {
|
||||
use crate::BezierHandles;
|
||||
|
||||
let to_point = |p: DVec2| {
|
||||
let p = transform.transform_point2(p);
|
||||
kurbo::Point::new(p.x, p.y)
|
||||
};
|
||||
path.move_to(to_point(self.iter().next().unwrap().start));
|
||||
for segment in self.iter() {
|
||||
match segment.handles {
|
||||
BezierHandles::Linear => path.line_to(to_point(segment.end)),
|
||||
BezierHandles::Quadratic { handle } => path.quad_to(to_point(handle), to_point(segment.end)),
|
||||
BezierHandles::Cubic { handle_start, handle_end } => path.curve_to(to_point(handle_start), to_point(handle_end), to_point(segment.end)),
|
||||
}
|
||||
}
|
||||
if self.closed {
|
||||
path.close_path();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn solve_spline_first_handle(points: &[DVec2]) -> Vec<DVec2> {
|
||||
|
||||
Reference in New Issue
Block a user