From aa902efb563d66c30beec2b087e51a6c1cd4224f Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 14 Jul 2024 01:50:25 -0700 Subject: [PATCH] Finish removing GraphicElement::Artboard started in #1824 (#1830) --- node-graph/gcore/src/graphic_element.rs | 4 ---- node-graph/gcore/src/graphic_element/renderer.rs | 5 ----- node-graph/gcore/src/transform.rs | 4 ---- node-graph/gstd/src/vector.rs | 12 ------------ 4 files changed, 25 deletions(-) diff --git a/node-graph/gcore/src/graphic_element.rs b/node-graph/gcore/src/graphic_element.rs index 0b04dafa..fd3fc012 100644 --- a/node-graph/gcore/src/graphic_element.rs +++ b/node-graph/gcore/src/graphic_element.rs @@ -67,8 +67,6 @@ pub enum GraphicElement { VectorData(Box), /// A bitmap image with a finite position and extent, equivalent to the SVG tag: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image ImageFrame(ImageFrame), - /// The bounds for displaying a page of contained content - Artboard(Artboard), } // TODO: Can this be removed? It doesn't necessarily make that much sense to have a default when, instead, the entire GraphicElement just shouldn't exist if there's no specific content to assign it. @@ -355,8 +353,6 @@ impl GraphicElement { } usvg::Node::Group(Box::new(group_element)) } - // TODO - GraphicElement::Artboard(_board) => usvg::Node::Group(Box::default()), } } } diff --git a/node-graph/gcore/src/graphic_element/renderer.rs b/node-graph/gcore/src/graphic_element/renderer.rs index 7540bb23..c5a9255a 100644 --- a/node-graph/gcore/src/graphic_element/renderer.rs +++ b/node-graph/gcore/src/graphic_element/renderer.rs @@ -559,7 +559,6 @@ impl GraphicElementRendered for GraphicElement { GraphicElement::VectorData(vector_data) => vector_data.render_svg(render, render_params), GraphicElement::ImageFrame(image_frame) => image_frame.render_svg(render, render_params), GraphicElement::GraphicGroup(graphic_group) => graphic_group.render_svg(render, render_params), - GraphicElement::Artboard(artboard) => artboard.render_svg(render, render_params), } } @@ -568,7 +567,6 @@ impl GraphicElementRendered for GraphicElement { GraphicElement::VectorData(vector_data) => GraphicElementRendered::bounding_box(&**vector_data, transform), GraphicElement::ImageFrame(image_frame) => image_frame.bounding_box(transform), GraphicElement::GraphicGroup(graphic_group) => graphic_group.bounding_box(transform), - GraphicElement::Artboard(artboard) => artboard.bounding_box(transform), } } @@ -577,7 +575,6 @@ impl GraphicElementRendered for GraphicElement { GraphicElement::VectorData(vector_data) => vector_data.add_click_targets(click_targets), GraphicElement::ImageFrame(image_frame) => image_frame.add_click_targets(click_targets), GraphicElement::GraphicGroup(graphic_group) => graphic_group.add_click_targets(click_targets), - GraphicElement::Artboard(artboard) => artboard.add_click_targets(click_targets), } } @@ -586,7 +583,6 @@ impl GraphicElementRendered for GraphicElement { GraphicElement::VectorData(vector_data) => vector_data.to_usvg_node(), GraphicElement::ImageFrame(image_frame) => image_frame.to_usvg_node(), GraphicElement::GraphicGroup(graphic_group) => graphic_group.to_usvg_node(), - GraphicElement::Artboard(artboard) => artboard.to_usvg_node(), } } @@ -595,7 +591,6 @@ impl GraphicElementRendered for GraphicElement { GraphicElement::VectorData(vector_data) => vector_data.contains_artboard(), GraphicElement::ImageFrame(image_frame) => image_frame.contains_artboard(), GraphicElement::GraphicGroup(graphic_group) => graphic_group.contains_artboard(), - GraphicElement::Artboard(artboard) => artboard.contains_artboard(), } } } diff --git a/node-graph/gcore/src/transform.rs b/node-graph/gcore/src/transform.rs index 32a06551..ec56b19d 100644 --- a/node-graph/gcore/src/transform.rs +++ b/node-graph/gcore/src/transform.rs @@ -76,7 +76,6 @@ impl Transform for GraphicElement { GraphicElement::VectorData(vector_shape) => vector_shape.transform(), GraphicElement::ImageFrame(image_frame) => image_frame.transform(), GraphicElement::GraphicGroup(graphic_group) => graphic_group.transform(), - GraphicElement::Artboard(artboard) => artboard.transform(), } } fn local_pivot(&self, pivot: DVec2) -> DVec2 { @@ -84,7 +83,6 @@ impl Transform for GraphicElement { GraphicElement::VectorData(vector_shape) => vector_shape.local_pivot(pivot), GraphicElement::ImageFrame(image_frame) => image_frame.local_pivot(pivot), GraphicElement::GraphicGroup(graphic_group) => graphic_group.local_pivot(pivot), - GraphicElement::Artboard(artboard) => artboard.local_pivot(pivot), } } fn decompose_scale(&self) -> DVec2 { @@ -92,7 +90,6 @@ impl Transform for GraphicElement { GraphicElement::VectorData(vector_shape) => vector_shape.decompose_scale(), GraphicElement::ImageFrame(image_frame) => image_frame.decompose_scale(), GraphicElement::GraphicGroup(graphic_group) => graphic_group.decompose_scale(), - GraphicElement::Artboard(artboard) => artboard.decompose_scale(), } } } @@ -102,7 +99,6 @@ impl TransformMut for GraphicElement { GraphicElement::VectorData(vector_shape) => vector_shape.transform_mut(), GraphicElement::ImageFrame(image_frame) => image_frame.transform_mut(), GraphicElement::GraphicGroup(graphic_group) => graphic_group.transform_mut(), - GraphicElement::Artboard(_) => todo!("Transform of artboard"), } } } diff --git a/node-graph/gstd/src/vector.rs b/node-graph/gstd/src/vector.rs index d28fdc11..ceede8a0 100644 --- a/node-graph/gstd/src/vector.rs +++ b/node-graph/gstd/src/vector.rs @@ -79,18 +79,6 @@ fn boolean_operation_node(graphic_group: GraphicGroup, boolean_operation: Boolea boolean_operation_on_vector_data(&vector_data, BooleanOperation::Union) } GraphicElement::ImageFrame(image) => vector_from_image(image), - // Union all vector data in the artboard into a single vector - GraphicElement::Artboard(artboard) => { - let artboard_subpath = Subpath::new_rect(artboard.location.as_dvec2(), artboard.location.as_dvec2() + artboard.dimensions.as_dvec2()); - - let mut artboard_vector = VectorData::from_subpath(artboard_subpath); - artboard_vector.style.set_fill(graphene_core::vector::style::Fill::Solid(artboard.background)); - - let mut vector_data = vec![artboard_vector]; - vector_data.extend(collect_vector_data(&artboard.graphic_group).into_iter()); - - boolean_operation_on_vector_data(&vector_data, BooleanOperation::Union) - } } }