mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Replace the image layer type with an Image node (#948)
* Use builder pattern for widgets * Arguments to new function * Add node graph when dragging in image * Fix duplicate import * Skip processing under node graph frame if unused * Reduce node graph rerenders * DUPLICATE ALL frontend changes into other frontend * DUPLICATE more changes to another frontend * Code review * Allow importing SVG files as bitmaps Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
parent
66e8325362
commit
64e62699fc
@@ -459,6 +459,11 @@ mod image {
|
||||
data: self.data.as_slice(),
|
||||
}
|
||||
}
|
||||
/// Generate Image from some frontend image data (the canvas pixels as u8s in a flat array)
|
||||
pub fn from_image_data(image_data: &[u8], width: u32, height: u32) -> Self {
|
||||
let data = image_data.chunks_exact(4).map(|v| Color::from_rgba8(v[0], v[1], v[2], v[3])).collect();
|
||||
Image { width, height, data }
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for Image {
|
||||
|
||||
@@ -47,8 +47,8 @@ fn bilt_subpath(base_image: Image, path_data: Subpath) -> Image {
|
||||
let composition = Composition::new();
|
||||
let mut renderer = cpu::Renderer::new();
|
||||
let mut path_builder = PathBuilder::new();
|
||||
for path_segement in path_data.bezier_iter() {
|
||||
let points = path_segement.internal.get_points().collect::<Vec<_>>();
|
||||
for path_segment in path_data.bezier_iter() {
|
||||
let points = path_segment.internal.get_points().collect::<Vec<_>>();
|
||||
match points.len() {
|
||||
2 => path_builder.line_to(points[1].into()),
|
||||
3 => path_builder.quad_to(points[1].into(), points[2].into()),
|
||||
|
||||
Reference in New Issue
Block a user