mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Instance tables refactor part 7: Rename "ImageFrame" -> "RasterData", "ImageFrameTable" -> "RasterDataType", and "RasterFrame" -> "RasterDataType"
This commit is contained in:
parent
2696abc6b3
commit
5cacab2e39
34 changed files with 285 additions and 281 deletions
2
demo-artwork/changing-seasons.graphite
generated
2
demo-artwork/changing-seasons.graphite
generated
File diff suppressed because one or more lines are too long
|
|
@ -30,7 +30,7 @@ use glam::{DAffine2, DVec2, IVec2};
|
|||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{NodeId, NodeInput, NodeNetwork, OldNodeNetwork};
|
||||
use graphene_core::raster::BlendMode;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::vector::style::ViewMode;
|
||||
use graphene_std::renderer::{ClickTarget, Quad};
|
||||
use graphene_std::vector::{PointId, path_bool_lib};
|
||||
|
|
@ -864,7 +864,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
|
|||
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
let layer = graph_modification_utils::new_image_layer(ImageFrameTable::new(image), layer_node_id, self.new_layer_parent(true), responses);
|
||||
let layer = graph_modification_utils::new_image_layer(RasterDataTable::new(image), layer_node_id, self.new_layer_parent(true), responses);
|
||||
|
||||
if let Some(name) = name {
|
||||
responses.add(NodeGraphMessage::SetDisplayName {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use bezier_rs::Subpath;
|
|||
use glam::{DAffine2, DVec2, IVec2};
|
||||
use graph_craft::document::NodeId;
|
||||
use graphene_core::raster::BlendMode;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::text::{Font, TypesettingConfig};
|
||||
use graphene_core::vector::PointId;
|
||||
use graphene_core::vector::VectorModificationType;
|
||||
|
|
@ -66,7 +66,7 @@ pub enum GraphOperationMessage {
|
|||
},
|
||||
NewBitmapLayer {
|
||||
id: NodeId,
|
||||
image_frame: ImageFrameTable<Color>,
|
||||
image_frame: RasterDataTable<Color>,
|
||||
parent: LayerNodeIdentifier,
|
||||
insert_index: usize,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use graph_craft::concrete;
|
|||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{NodeId, NodeInput};
|
||||
use graphene_core::raster::BlendMode;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::text::{Font, TypesettingConfig};
|
||||
use graphene_core::vector::brush_stroke::BrushStroke;
|
||||
use graphene_core::vector::style::{Fill, Stroke};
|
||||
|
|
@ -209,11 +209,11 @@ impl<'a> ModifyInputsContext<'a> {
|
|||
self.network_interface.move_node_to_chain_start(&stroke_id, layer, &[]);
|
||||
}
|
||||
|
||||
pub fn insert_image_data(&mut self, image_frame: ImageFrameTable<Color>, layer: LayerNodeIdentifier) {
|
||||
pub fn insert_image_data(&mut self, image_frame: RasterDataTable<Color>, layer: LayerNodeIdentifier) {
|
||||
let transform = resolve_document_node_type("Transform").expect("Transform node does not exist").default_node_template();
|
||||
let image = resolve_document_node_type("Image")
|
||||
.expect("Image node does not exist")
|
||||
.node_template_input_override([Some(NodeInput::value(TaggedValue::None, false)), Some(NodeInput::value(TaggedValue::ImageFrame(image_frame), false))]);
|
||||
.node_template_input_override([Some(NodeInput::value(TaggedValue::None, false)), Some(NodeInput::value(TaggedValue::RasterData(image_frame), false))]);
|
||||
|
||||
let image_id = NodeId::new();
|
||||
self.network_interface.insert_node(image_id, image, &[]);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use graph_craft::concrete;
|
|||
use graph_craft::document::value::*;
|
||||
use graph_craft::document::*;
|
||||
use graphene_core::raster::brush_cache::BrushCache;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::raster::{CellularDistanceFunction, CellularReturnType, Color, DomainWarpType, FractalType, NoiseType, RedGreenBlueAlpha};
|
||||
use graphene_core::text::{Font, TypesettingConfig};
|
||||
use graphene_core::transform::Footprint;
|
||||
|
|
@ -608,8 +608,8 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
exports: vec![NodeInput::node(NodeId(3), 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::ops::IntoNode<_, ImageFrameTable<SRGBA8>>")),
|
||||
inputs: vec![NodeInput::network(concrete!(RasterDataTable<Color>), 0)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::ops::IntoNode<_, RasterDataTable<SRGBA8>>")),
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
|
|
@ -636,7 +636,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
.collect(),
|
||||
..Default::default()
|
||||
}),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
..Default::default()
|
||||
},
|
||||
persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
|
|
@ -852,7 +852,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
nodes: [
|
||||
DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::network(concrete!(ImageFrameTable<Color>), 0),
|
||||
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
|
||||
NodeInput::value(TaggedValue::RedGreenBlueAlpha(RedGreenBlueAlpha::Red), false),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::raster::adjustments::ExtractChannelNode")),
|
||||
|
|
@ -861,7 +861,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
},
|
||||
DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::network(concrete!(ImageFrameTable<Color>), 0),
|
||||
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
|
||||
NodeInput::value(TaggedValue::RedGreenBlueAlpha(RedGreenBlueAlpha::Green), false),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::raster::adjustments::ExtractChannelNode")),
|
||||
|
|
@ -870,7 +870,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
},
|
||||
DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::network(concrete!(ImageFrameTable<Color>), 0),
|
||||
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
|
||||
NodeInput::value(TaggedValue::RedGreenBlueAlpha(RedGreenBlueAlpha::Blue), false),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::raster::adjustments::ExtractChannelNode")),
|
||||
|
|
@ -879,7 +879,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
},
|
||||
DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::network(concrete!(ImageFrameTable<Color>), 0),
|
||||
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
|
||||
NodeInput::value(TaggedValue::RedGreenBlueAlpha(RedGreenBlueAlpha::Alpha), false),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::raster::adjustments::ExtractChannelNode")),
|
||||
|
|
@ -893,7 +893,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
.collect(),
|
||||
..Default::default()
|
||||
}),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
..Default::default()
|
||||
},
|
||||
persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
|
|
@ -959,13 +959,13 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
exports: vec![NodeInput::node(NodeId(0), 0), NodeInput::node(NodeId(1), 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0), NodeInput::value(TaggedValue::XY(XY::X), false)],
|
||||
inputs: vec![NodeInput::network(concrete!(RasterDataTable<Color>), 0), NodeInput::value(TaggedValue::XY(XY::X), false)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::ops::ExtractXyNode")),
|
||||
manual_composition: Some(generic!(T)),
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0), NodeInput::value(TaggedValue::XY(XY::Y), false)],
|
||||
inputs: vec![NodeInput::network(concrete!(RasterDataTable<Color>), 0), NodeInput::value(TaggedValue::XY(XY::Y), false)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::ops::ExtractXyNode")),
|
||||
manual_composition: Some(generic!(T)),
|
||||
..Default::default()
|
||||
|
|
@ -978,7 +978,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
|
||||
..Default::default()
|
||||
}),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
..Default::default()
|
||||
},
|
||||
persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
|
|
@ -1029,7 +1029,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
exports: vec![NodeInput::node(NodeId(0), 0)],
|
||||
nodes: vec![DocumentNode {
|
||||
inputs: vec![
|
||||
NodeInput::network(concrete!(ImageFrameTable<Color>), 0),
|
||||
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
|
||||
NodeInput::network(concrete!(Vec<graphene_core::vector::brush_stroke::BrushStroke>), 1),
|
||||
NodeInput::network(concrete!(BrushCache), 2),
|
||||
],
|
||||
|
|
@ -1044,7 +1044,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
..Default::default()
|
||||
}),
|
||||
inputs: vec![
|
||||
NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true),
|
||||
NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true),
|
||||
NodeInput::value(TaggedValue::BrushStrokes(Vec::new()), false),
|
||||
NodeInput::value(TaggedValue::BrushCache(BrushCache::new_proto()), false),
|
||||
],
|
||||
|
|
@ -1083,7 +1083,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
node_template: NodeTemplate {
|
||||
document_node: DocumentNode {
|
||||
implementation: DocumentNodeImplementation::proto("graphene_core::memo::MemoNode"),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
manual_composition: Some(concrete!(Context)),
|
||||
..Default::default()
|
||||
},
|
||||
|
|
@ -1102,7 +1102,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
node_template: NodeTemplate {
|
||||
document_node: DocumentNode {
|
||||
implementation: DocumentNodeImplementation::proto("graphene_core::memo::ImpureMemoNode"),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
manual_composition: Some(concrete!(Context)),
|
||||
..Default::default()
|
||||
},
|
||||
|
|
@ -1784,7 +1784,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0), NodeInput::node(NodeId(0), 0)],
|
||||
inputs: vec![NodeInput::network(concrete!(RasterDataTable<Color>), 0), NodeInput::node(NodeId(0), 0)],
|
||||
manual_composition: Some(generic!(T)),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("wgpu_executor::UploadTextureNode")),
|
||||
..Default::default()
|
||||
|
|
@ -1802,7 +1802,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
.collect(),
|
||||
..Default::default()
|
||||
}),
|
||||
inputs: vec![NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true)],
|
||||
inputs: vec![NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true)],
|
||||
..Default::default()
|
||||
},
|
||||
persistent_node_metadata: DocumentNodePersistentMetadata {
|
||||
|
|
@ -1882,7 +1882,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
// document_node: DocumentNode {
|
||||
// implementation: DocumentNodeImplementation::proto("graphene_core::raster::CurvesNode"),
|
||||
// inputs: vec![
|
||||
// NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true),
|
||||
// NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true),
|
||||
// NodeInput::value(TaggedValue::Curve(Default::default()), false),
|
||||
// ],
|
||||
// ..Default::default()
|
||||
|
|
@ -2646,7 +2646,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
// exports: vec![NodeInput::node(NodeId(1), 0)],
|
||||
// nodes: [
|
||||
// DocumentNode {
|
||||
// inputs: vec![NodeInput::network(concrete!(ImageFrameTable<Color>), 0)],
|
||||
// inputs: vec![NodeInput::network(concrete!(RasterDataTable<Color>), 0)],
|
||||
// implementation: DocumentNodeImplementation::proto("graphene_core::memo::MonitorNode"),
|
||||
// manual_composition: Some(concrete!(Context)),
|
||||
// skip_deduplication: true,
|
||||
|
|
@ -2684,7 +2684,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
|||
// ..Default::default()
|
||||
// }),
|
||||
// inputs: vec![
|
||||
// NodeInput::value(TaggedValue::ImageFrame(ImageFrameTable::default()), true),
|
||||
// NodeInput::value(TaggedValue::RasterData(RasterDataTable::default()), true),
|
||||
// NodeInput::scope("editor-api"),
|
||||
// NodeInput::value(TaggedValue::ImaginateController(Default::default()), false),
|
||||
// NodeInput::value(TaggedValue::F64(0.), false), // Remember to keep index used in `ImaginateRandom` updated with this entry's index
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use graph_craft::Type;
|
|||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput};
|
||||
use graphene_core::raster::curve::Curve;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::raster::{
|
||||
BlendMode, CellularDistanceFunction, CellularReturnType, Color, DomainWarpType, FractalType, LuminanceCalculation, NoiseType, RedGreenBlue, RedGreenBlueAlpha, RelativeAbsolute,
|
||||
SelectiveColorChoice,
|
||||
|
|
@ -22,14 +22,14 @@ use graphene_core::vector::generator_nodes::grid;
|
|||
use graphene_core::vector::misc::CentroidType;
|
||||
use graphene_core::vector::style::{GradientType, LineCap, LineJoin};
|
||||
use graphene_std::animation::RealTimeMode;
|
||||
use graphene_std::application_io::TextureFrameTable;
|
||||
use graphene_std::application_io::TextureDataTable;
|
||||
use graphene_std::ops::XY;
|
||||
use graphene_std::transform::{Footprint, ReferencePoint};
|
||||
use graphene_std::vector::VectorDataTable;
|
||||
use graphene_std::vector::misc::ArcType;
|
||||
use graphene_std::vector::misc::{BooleanOperation, GridType};
|
||||
use graphene_std::vector::style::{Fill, FillChoice, FillType, GradientStops};
|
||||
use graphene_std::{GraphicGroupTable, NodeInputDecleration, RasterFrame};
|
||||
use graphene_std::{GraphicGroupTable, NodeInputDecleration, RasterDataType};
|
||||
|
||||
pub(crate) fn string_properties(text: &str) -> Vec<LayoutGroup> {
|
||||
let widget = TextLabel::new(text).widget_holder();
|
||||
|
|
@ -190,7 +190,7 @@ pub(crate) fn property_from_type(
|
|||
// GRAPHICAL DATA TYPES
|
||||
// ====================
|
||||
Some(x) if x == TypeId::of::<VectorDataTable>() => vector_data_widget(default_info).into(),
|
||||
Some(x) if x == TypeId::of::<RasterFrame>() || x == TypeId::of::<ImageFrameTable<Color>>() || x == TypeId::of::<TextureFrameTable>() => raster_widget(default_info).into(),
|
||||
Some(x) if x == TypeId::of::<RasterDataType>() || x == TypeId::of::<RasterDataTable<Color>>() || x == TypeId::of::<TextureDataTable>() => raster_widget(default_info).into(),
|
||||
Some(x) if x == TypeId::of::<GraphicGroupTable>() => group_widget(default_info).into(),
|
||||
// ============
|
||||
// STRUCT TYPES
|
||||
|
|
@ -198,7 +198,7 @@ pub(crate) fn property_from_type(
|
|||
Some(x) if x == TypeId::of::<Color>() => color_widget(default_info, ColorInput::default().allow_none(false)),
|
||||
Some(x) if x == TypeId::of::<Option<Color>>() => color_widget(default_info, ColorInput::default().allow_none(true)),
|
||||
Some(x) if x == TypeId::of::<GradientStops>() => color_widget(default_info, ColorInput::default().allow_none(false)),
|
||||
Some(x) if x == TypeId::of::<Font>() => font_widget(default_info).into(),
|
||||
Some(x) if x == TypeId::of::<Font>() => font_widget(default_info),
|
||||
Some(x) if x == TypeId::of::<Curve>() => curve_widget(default_info),
|
||||
Some(x) if x == TypeId::of::<Footprint>() => footprint_widget(default_info, &mut extra_widgets),
|
||||
// ===============================
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@
|
|||
|
||||
// // let transform = context
|
||||
// // .executor
|
||||
// // .introspect_node_in_network(context.network, &imaginate_node, |network| network.inputs.first().copied(), |frame: &ImageFrame<Color>| frame.transform)
|
||||
// // .introspect_node_in_network(context.network, &imaginate_node, |network| network.inputs.first().copied(), |frame: &RasterData<Color>| frame.transform)
|
||||
// // .unwrap_or_default();
|
||||
// let image_size = context
|
||||
// .executor
|
||||
|
|
@ -283,7 +283,7 @@
|
|||
// .map(|(node_id, _)| node_id)
|
||||
// .copied()
|
||||
// },
|
||||
// |frame: &IORecord<(), ImageFrame<Color>>| (frame.output.image.width, frame.output.image.height),
|
||||
// |frame: &IORecord<(), RasterData<Color>>| (frame.output.image.width, frame.output.image.height),
|
||||
// )
|
||||
// .unwrap_or_default();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub enum FrontendGraphDataType {
|
|||
impl FrontendGraphDataType {
|
||||
fn with_type(input: &Type) -> Self {
|
||||
match TaggedValue::from_type_or_none(input) {
|
||||
TaggedValue::Image(_) | TaggedValue::ImageFrame(_) => Self::Raster,
|
||||
TaggedValue::Image(_) | TaggedValue::RasterData(_) => Self::Raster,
|
||||
TaggedValue::Subpaths(_) | TaggedValue::VectorData(_) => Self::VectorData,
|
||||
TaggedValue::U32(_)
|
||||
| TaggedValue::U64(_)
|
||||
|
|
|
|||
|
|
@ -485,7 +485,6 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
|
|||
("graphene_core::raster::GradientMapNode", "graphene_core::raster::adjustments::GradientMapNode"),
|
||||
("graphene_core::raster::HueSaturationNode", "graphene_core::raster::adjustments::HueSaturationNode"),
|
||||
("graphene_core::raster::InvertNode", "graphene_core::raster::adjustments::InvertNode"),
|
||||
// ("graphene_core::raster::IndexNode", "graphene_core::raster::adjustments::IndexNode"),
|
||||
("graphene_core::raster::InvertRGBNode", "graphene_core::raster::adjustments::InvertNode"),
|
||||
("graphene_core::raster::LevelsNode", "graphene_core::raster::adjustments::LevelsNode"),
|
||||
("graphene_core::raster::LuminanceNode", "graphene_core::raster::adjustments::LuminanceNode"),
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ use graphene_core::Context;
|
|||
use graphene_core::GraphicGroupTable;
|
||||
use graphene_core::instances::Instances;
|
||||
use graphene_core::memo::IORecord;
|
||||
use graphene_core::raster::Image;
|
||||
use graphene_core::vector::{VectorData, VectorDataTable};
|
||||
use graphene_core::{Artboard, ArtboardGroupTable, GraphicElement};
|
||||
use graphene_std::Color;
|
||||
use std::any::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
@ -154,7 +156,7 @@ impl InstanceLayout for GraphicElement {
|
|||
match self {
|
||||
Self::GraphicGroup(instances) => instances.identifier(),
|
||||
Self::VectorData(instances) => instances.identifier(),
|
||||
Self::RasterFrame(_) => "RasterFrame".to_string(),
|
||||
Self::RasterDataType(_) => "RasterDataType".to_string(),
|
||||
}
|
||||
}
|
||||
// Don't put a breadcrumb for GraphicElement
|
||||
|
|
@ -165,7 +167,7 @@ impl InstanceLayout for GraphicElement {
|
|||
match self {
|
||||
Self::GraphicGroup(instances) => instances.layout_with_breadcrumb(data),
|
||||
Self::VectorData(instances) => instances.layout_with_breadcrumb(data),
|
||||
Self::RasterFrame(_) => label("Raster frame not supported"),
|
||||
Self::RasterDataType(_) => label("Raster frame not supported"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -225,6 +227,19 @@ impl InstanceLayout for VectorData {
|
|||
}
|
||||
}
|
||||
|
||||
impl InstanceLayout for Image<Color> {
|
||||
fn type_name() -> &'static str {
|
||||
"Image"
|
||||
}
|
||||
fn identifier(&self) -> String {
|
||||
format!("Image (width={}, height={})", self.width, self.height)
|
||||
}
|
||||
fn compute_layout(&self, _data: &mut LayoutData) -> Vec<LayoutGroup> {
|
||||
let rows = vec![vec![TextLabel::new(format!("Image (width={}, height={})", self.width, self.height)).widget_holder()]];
|
||||
vec![LayoutGroup::Table { rows }]
|
||||
}
|
||||
}
|
||||
|
||||
impl InstanceLayout for Artboard {
|
||||
fn type_name() -> &'static str {
|
||||
"Artboard"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use graph_craft::document::value::TaggedValue;
|
|||
use graph_craft::document::{NodeId, NodeInput};
|
||||
use graphene_core::Color;
|
||||
use graphene_core::raster::BlendMode;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::text::{Font, TypesettingConfig};
|
||||
use graphene_core::vector::style::Gradient;
|
||||
use graphene_std::vector::{ManipulatorPointId, PointId, SegmentId, VectorModificationType};
|
||||
|
|
@ -207,7 +207,7 @@ pub fn new_vector_layer(subpaths: Vec<Subpath<PointId>>, id: NodeId, parent: Lay
|
|||
}
|
||||
|
||||
/// Create a new bitmap layer.
|
||||
pub fn new_image_layer(image_frame: ImageFrameTable<Color>, id: NodeId, parent: LayerNodeIdentifier, responses: &mut VecDeque<Message>) -> LayerNodeIdentifier {
|
||||
pub fn new_image_layer(image_frame: RasterDataTable<Color>, id: NodeId, parent: LayerNodeIdentifier, responses: &mut VecDeque<Message>) -> LayerNodeIdentifier {
|
||||
let insert_index = 0;
|
||||
responses.add(GraphOperationMessage::NewBitmapLayer {
|
||||
id,
|
||||
|
|
@ -424,12 +424,9 @@ impl<'a> NodeGraphLayer<'a> {
|
|||
/// Check if a layer is a raster layer
|
||||
pub fn is_raster_layer(layer: LayerNodeIdentifier, network_interface: &mut NodeNetworkInterface) -> bool {
|
||||
let layer_input_type = network_interface.input_type(&InputConnector::node(layer.to_node(), 1), &[]).0.nested_type().clone();
|
||||
if layer_input_type == concrete!(graphene_core::raster::image::ImageFrameTable<graphene_core::Color>)
|
||||
|| layer_input_type == concrete!(graphene_core::application_io::TextureFrameTable)
|
||||
|| layer_input_type == concrete!(graphene_std::RasterFrame)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
false
|
||||
|
||||
layer_input_type == concrete!(graphene_std::RasterDataType)
|
||||
|| layer_input_type == concrete!(graphene_core::raster::image::RasterDataTable<graphene_core::Color>)
|
||||
|| layer_input_type == concrete!(graphene_core::application_io::TextureDataTable)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ impl NodeGraphExecutor {
|
|||
TaggedValue::OptionalColor(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
TaggedValue::VectorData(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
TaggedValue::GraphicGroup(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
TaggedValue::ImageFrame(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
TaggedValue::RasterData(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
TaggedValue::Palette(render_object) => Self::debug_render(render_object, transform, responses),
|
||||
_ => {
|
||||
return Err(format!("Invalid node graph output type: {node_graph_output:#?}"));
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@ impl Size for web_sys::HtmlCanvasElement {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Rename to ImageTextureTable
|
||||
pub type TextureFrameTable = Instances<ImageTexture>;
|
||||
pub type TextureDataTable = Instances<ImageTexture>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ImageTexture {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::application_io::{ImageTexture, TextureFrameTable};
|
||||
use crate::application_io::{ImageTexture, TextureDataTable};
|
||||
use crate::instances::{Instance, Instances};
|
||||
use crate::raster::BlendMode;
|
||||
use crate::raster::image::{Image, ImageFrameTable};
|
||||
use crate::raster::image::{Image, RasterDataTable};
|
||||
use crate::transform::TransformMut;
|
||||
use crate::uuid::NodeId;
|
||||
use crate::vector::{VectorData, VectorDataTable};
|
||||
|
|
@ -124,22 +124,22 @@ impl From<VectorDataTable> for GraphicGroupTable {
|
|||
}
|
||||
impl From<Image<Color>> for GraphicGroupTable {
|
||||
fn from(image: Image<Color>) -> Self {
|
||||
Self::new(GraphicElement::RasterFrame(RasterFrame::ImageFrame(ImageFrameTable::new(image))))
|
||||
Self::new(GraphicElement::RasterDataType(RasterDataType::RasterData(RasterDataTable::new(image))))
|
||||
}
|
||||
}
|
||||
impl From<ImageFrameTable<Color>> for GraphicGroupTable {
|
||||
fn from(image_frame: ImageFrameTable<Color>) -> Self {
|
||||
Self::new(GraphicElement::RasterFrame(RasterFrame::ImageFrame(image_frame)))
|
||||
impl From<RasterDataTable<Color>> for GraphicGroupTable {
|
||||
fn from(image_frame: RasterDataTable<Color>) -> Self {
|
||||
Self::new(GraphicElement::RasterDataType(RasterDataType::RasterData(image_frame)))
|
||||
}
|
||||
}
|
||||
impl From<ImageTexture> for GraphicGroupTable {
|
||||
fn from(image_texture: ImageTexture) -> Self {
|
||||
Self::new(GraphicElement::RasterFrame(RasterFrame::TextureFrame(TextureFrameTable::new(image_texture))))
|
||||
Self::new(GraphicElement::RasterDataType(RasterDataType::TextureData(TextureDataTable::new(image_texture))))
|
||||
}
|
||||
}
|
||||
impl From<TextureFrameTable> for GraphicGroupTable {
|
||||
fn from(texture_frame: TextureFrameTable) -> Self {
|
||||
Self::new(GraphicElement::RasterFrame(RasterFrame::TextureFrame(texture_frame)))
|
||||
impl From<TextureDataTable> for GraphicGroupTable {
|
||||
fn from(texture_frame: TextureDataTable) -> Self {
|
||||
Self::new(GraphicElement::RasterDataType(RasterDataType::TextureData(texture_frame)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ pub enum GraphicElement {
|
|||
GraphicGroup(GraphicGroupTable),
|
||||
/// A vector shape, equivalent to the SVG <path> tag: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path
|
||||
VectorData(VectorDataTable),
|
||||
RasterFrame(RasterFrame),
|
||||
RasterDataType(RasterDataType),
|
||||
}
|
||||
|
||||
impl Default for GraphicElement {
|
||||
|
|
@ -189,16 +189,16 @@ impl GraphicElement {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn as_raster(&self) -> Option<&RasterFrame> {
|
||||
pub fn as_raster(&self) -> Option<&RasterDataType> {
|
||||
match self {
|
||||
GraphicElement::RasterFrame(raster) => Some(raster),
|
||||
GraphicElement::RasterDataType(raster) => Some(raster),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_raster_mut(&mut self) -> Option<&mut RasterFrame> {
|
||||
pub fn as_raster_mut(&mut self) -> Option<&mut RasterDataType> {
|
||||
match self {
|
||||
GraphicElement::RasterFrame(raster) => Some(raster),
|
||||
GraphicElement::RasterDataType(raster) => Some(raster),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -206,32 +206,32 @@ impl GraphicElement {
|
|||
|
||||
// TODO: Rename to Raster
|
||||
#[derive(Clone, Debug, Hash, PartialEq, DynAny)]
|
||||
pub enum RasterFrame {
|
||||
pub enum RasterDataType {
|
||||
/// A CPU-based bitmap image with a finite position and extent, equivalent to the SVG <image> tag: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image
|
||||
// TODO: Rename to ImageTable
|
||||
ImageFrame(ImageFrameTable<Color>),
|
||||
RasterData(RasterDataTable<Color>),
|
||||
/// A GPU texture with a finite position and extent
|
||||
// TODO: Rename to ImageTextureTable
|
||||
TextureFrame(TextureFrameTable),
|
||||
TextureData(TextureDataTable),
|
||||
}
|
||||
|
||||
impl<'de> serde::Deserialize<'de> for RasterFrame {
|
||||
impl<'de> serde::Deserialize<'de> for RasterDataType {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
Ok(RasterFrame::ImageFrame(ImageFrameTable::new(Image::deserialize(deserializer)?)))
|
||||
Ok(RasterDataType::RasterData(RasterDataTable::new(Image::deserialize(deserializer)?)))
|
||||
}
|
||||
}
|
||||
|
||||
impl serde::Serialize for RasterFrame {
|
||||
impl serde::Serialize for RasterDataType {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
match self {
|
||||
RasterFrame::ImageFrame(_) => self.serialize(serializer),
|
||||
RasterFrame::TextureFrame(_) => todo!(),
|
||||
RasterDataType::RasterData(_) => self.serialize(serializer),
|
||||
RasterDataType::TextureData(_) => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -324,8 +324,8 @@ async fn to_element<Data: Into<GraphicElement> + 'n>(
|
|||
#[implementations(
|
||||
GraphicGroupTable,
|
||||
VectorDataTable,
|
||||
ImageFrameTable<Color>,
|
||||
TextureFrameTable,
|
||||
RasterDataTable<Color>,
|
||||
TextureDataTable,
|
||||
)]
|
||||
data: Data,
|
||||
) -> GraphicElement {
|
||||
|
|
@ -338,8 +338,8 @@ async fn to_group<Data: Into<GraphicGroupTable> + 'n>(
|
|||
#[implementations(
|
||||
GraphicGroupTable,
|
||||
VectorDataTable,
|
||||
ImageFrameTable<Color>,
|
||||
TextureFrameTable,
|
||||
RasterDataTable<Color>,
|
||||
TextureDataTable,
|
||||
)]
|
||||
element: Data,
|
||||
) -> GraphicGroupTable {
|
||||
|
|
@ -391,8 +391,8 @@ async fn to_artboard<Data: Into<GraphicGroupTable> + 'n>(
|
|||
#[implementations(
|
||||
Context -> GraphicGroupTable,
|
||||
Context -> VectorDataTable,
|
||||
Context -> ImageFrameTable<Color>,
|
||||
Context -> TextureFrameTable,
|
||||
Context -> RasterDataTable<Color>,
|
||||
Context -> TextureDataTable,
|
||||
)]
|
||||
contents: impl Node<Context<'static>, Output = Data>,
|
||||
label: String,
|
||||
|
|
@ -438,23 +438,23 @@ async fn append_artboard(_ctx: impl Ctx, mut artboards: ArtboardGroupTable, artb
|
|||
// TODO: Remove this one
|
||||
impl From<Image<Color>> for GraphicElement {
|
||||
fn from(image_frame: Image<Color>) -> Self {
|
||||
GraphicElement::RasterFrame(RasterFrame::ImageFrame(ImageFrameTable::new(image_frame)))
|
||||
GraphicElement::RasterDataType(RasterDataType::RasterData(RasterDataTable::new(image_frame)))
|
||||
}
|
||||
}
|
||||
impl From<ImageFrameTable<Color>> for GraphicElement {
|
||||
fn from(image_frame: ImageFrameTable<Color>) -> Self {
|
||||
GraphicElement::RasterFrame(RasterFrame::ImageFrame(image_frame))
|
||||
impl From<RasterDataTable<Color>> for GraphicElement {
|
||||
fn from(image_frame: RasterDataTable<Color>) -> Self {
|
||||
GraphicElement::RasterDataType(RasterDataType::RasterData(image_frame))
|
||||
}
|
||||
}
|
||||
// TODO: Remove this one
|
||||
impl From<ImageTexture> for GraphicElement {
|
||||
fn from(texture: ImageTexture) -> Self {
|
||||
GraphicElement::RasterFrame(RasterFrame::TextureFrame(TextureFrameTable::new(texture)))
|
||||
fn from(image_texture: ImageTexture) -> Self {
|
||||
GraphicElement::RasterDataType(RasterDataType::TextureData(TextureDataTable::new(image_texture)))
|
||||
}
|
||||
}
|
||||
impl From<TextureFrameTable> for GraphicElement {
|
||||
fn from(texture: TextureFrameTable) -> Self {
|
||||
GraphicElement::RasterFrame(RasterFrame::TextureFrame(texture))
|
||||
impl From<TextureDataTable> for GraphicElement {
|
||||
fn from(texture_data: TextureDataTable) -> Self {
|
||||
GraphicElement::RasterDataType(RasterDataType::TextureData(texture_data))
|
||||
}
|
||||
}
|
||||
// TODO: Remove this one
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
mod quad;
|
||||
mod rect;
|
||||
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::raster::{BlendMode, Image};
|
||||
use crate::transform::{Footprint, Transform};
|
||||
use crate::uuid::{NodeId, generate_uuid};
|
||||
use crate::vector::style::{Fill, Stroke, ViewMode};
|
||||
use crate::vector::{PointId, VectorDataTable};
|
||||
use crate::{Artboard, ArtboardGroupTable, Color, GraphicElement, GraphicGroupTable, RasterFrame};
|
||||
use crate::{Artboard, ArtboardGroupTable, Color, GraphicElement, GraphicGroupTable, RasterDataType};
|
||||
use base64::Engine;
|
||||
use bezier_rs::Subpath;
|
||||
use dyn_any::DynAny;
|
||||
|
|
@ -843,7 +843,7 @@ impl GraphicElementRendered for ArtboardGroupTable {
|
|||
}
|
||||
}
|
||||
|
||||
impl GraphicElementRendered for ImageFrameTable<Color> {
|
||||
impl GraphicElementRendered for RasterDataTable<Color> {
|
||||
fn render_svg(&self, render: &mut SvgRender, _render_params: &RenderParams) {
|
||||
for instance in self.instance_ref_iter() {
|
||||
let transform = *instance.transform * render.transform;
|
||||
|
|
@ -923,11 +923,11 @@ impl GraphicElementRendered for ImageFrameTable<Color> {
|
|||
}
|
||||
}
|
||||
|
||||
impl GraphicElementRendered for RasterFrame {
|
||||
impl GraphicElementRendered for RasterDataType {
|
||||
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
|
||||
match self {
|
||||
RasterFrame::ImageFrame(image) => image.render_svg(render, render_params),
|
||||
RasterFrame::TextureFrame(_) => log::warn!("tried to render texture as an svg"),
|
||||
RasterDataType::RasterData(image) => image.render_svg(render, render_params),
|
||||
RasterDataType::TextureData(_) => log::warn!("tried to render texture as an svg"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -953,7 +953,7 @@ impl GraphicElementRendered for RasterFrame {
|
|||
};
|
||||
|
||||
match self {
|
||||
RasterFrame::ImageFrame(image) => {
|
||||
RasterDataType::RasterData(image) => {
|
||||
for instance in image.instance_ref_iter() {
|
||||
let image = &instance.instance;
|
||||
if image.data.is_empty() {
|
||||
|
|
@ -965,7 +965,7 @@ impl GraphicElementRendered for RasterFrame {
|
|||
render_stuff(image, *instance.transform, *instance.alpha_blending);
|
||||
}
|
||||
}
|
||||
RasterFrame::TextureFrame(image_texture) => {
|
||||
RasterDataType::TextureData(image_texture) => {
|
||||
for instance in image_texture.instance_ref_iter() {
|
||||
let image =
|
||||
vello::peniko::Image::new(vec![].into(), peniko::Format::Rgba8, instance.instance.texture.width(), instance.instance.texture.height()).with_extend(peniko::Extend::Repeat);
|
||||
|
|
@ -986,8 +986,8 @@ impl GraphicElementRendered for RasterFrame {
|
|||
};
|
||||
|
||||
match self {
|
||||
RasterFrame::ImageFrame(instances) => instances.instance_ref_iter().flat_map(|instance| calculate_transform(*instance.transform)).reduce(Quad::combine_bounds),
|
||||
RasterFrame::TextureFrame(instances) => instances.instance_ref_iter().flat_map(|instance| calculate_transform(*instance.transform)).reduce(Quad::combine_bounds),
|
||||
RasterDataType::RasterData(instances) => instances.instance_ref_iter().flat_map(|instance| calculate_transform(*instance.transform)).reduce(Quad::combine_bounds),
|
||||
RasterDataType::TextureData(instances) => instances.instance_ref_iter().flat_map(|instance| calculate_transform(*instance.transform)).reduce(Quad::combine_bounds),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -999,13 +999,13 @@ impl GraphicElementRendered for RasterFrame {
|
|||
metadata.upstream_footprints.insert(element_id, footprint);
|
||||
|
||||
match self {
|
||||
RasterFrame::ImageFrame(instances) => {
|
||||
RasterDataType::RasterData(instances) => {
|
||||
// TODO: Find a way to handle more than one row of the graphical data table
|
||||
if let Some(image) = instances.instance_ref_iter().next() {
|
||||
metadata.local_transforms.insert(element_id, *image.transform);
|
||||
}
|
||||
}
|
||||
RasterFrame::TextureFrame(instances) => {
|
||||
RasterDataType::TextureData(instances) => {
|
||||
// TODO: Find a way to handle more than one row of the graphical data table
|
||||
if let Some(image_texture) = instances.instance_ref_iter().next() {
|
||||
metadata.local_transforms.insert(element_id, *image_texture.transform);
|
||||
|
|
@ -1024,7 +1024,7 @@ impl GraphicElementRendered for GraphicElement {
|
|||
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
|
||||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.render_svg(render, render_params),
|
||||
GraphicElement::RasterFrame(raster) => raster.render_svg(render, render_params),
|
||||
GraphicElement::RasterDataType(raster) => raster.render_svg(render, render_params),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.render_svg(render, render_params),
|
||||
}
|
||||
}
|
||||
|
|
@ -1034,14 +1034,14 @@ impl GraphicElementRendered for GraphicElement {
|
|||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.render_to_vello(scene, transform, context, render_params),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.render_to_vello(scene, transform, context, render_params),
|
||||
GraphicElement::RasterFrame(raster) => raster.render_to_vello(scene, transform, context, render_params),
|
||||
GraphicElement::RasterDataType(raster) => raster.render_to_vello(scene, transform, context, render_params),
|
||||
}
|
||||
}
|
||||
|
||||
fn bounding_box(&self, transform: DAffine2, include_stroke: bool) -> Option<[DVec2; 2]> {
|
||||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.bounding_box(transform, include_stroke),
|
||||
GraphicElement::RasterFrame(raster) => raster.bounding_box(transform, include_stroke),
|
||||
GraphicElement::RasterDataType(raster) => raster.bounding_box(transform, include_stroke),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.bounding_box(transform, include_stroke),
|
||||
}
|
||||
}
|
||||
|
|
@ -1059,16 +1059,16 @@ impl GraphicElementRendered for GraphicElement {
|
|||
metadata.local_transforms.insert(element_id, *vector_data.transform);
|
||||
}
|
||||
}
|
||||
GraphicElement::RasterFrame(raster_frame) => {
|
||||
GraphicElement::RasterDataType(raster_frame) => {
|
||||
metadata.upstream_footprints.insert(element_id, footprint);
|
||||
match raster_frame {
|
||||
RasterFrame::ImageFrame(instances) => {
|
||||
RasterDataType::RasterData(instances) => {
|
||||
// TODO: Find a way to handle more than one row of images
|
||||
if let Some(image) = instances.instance_ref_iter().next() {
|
||||
metadata.local_transforms.insert(element_id, *image.transform);
|
||||
}
|
||||
}
|
||||
RasterFrame::TextureFrame(instances) => {
|
||||
RasterDataType::TextureData(instances) => {
|
||||
// TODO: Find a way to handle more than one row of image textures
|
||||
if let Some(image_texture) = instances.instance_ref_iter().next() {
|
||||
metadata.local_transforms.insert(element_id, *image_texture.transform);
|
||||
|
|
@ -1081,7 +1081,7 @@ impl GraphicElementRendered for GraphicElement {
|
|||
|
||||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.collect_metadata(metadata, footprint, element_id),
|
||||
GraphicElement::RasterFrame(raster) => raster.collect_metadata(metadata, footprint, element_id),
|
||||
GraphicElement::RasterDataType(raster) => raster.collect_metadata(metadata, footprint, element_id),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.collect_metadata(metadata, footprint, element_id),
|
||||
}
|
||||
}
|
||||
|
|
@ -1089,7 +1089,7 @@ impl GraphicElementRendered for GraphicElement {
|
|||
fn add_upstream_click_targets(&self, click_targets: &mut Vec<ClickTarget>) {
|
||||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.add_upstream_click_targets(click_targets),
|
||||
GraphicElement::RasterFrame(raster) => raster.add_upstream_click_targets(click_targets),
|
||||
GraphicElement::RasterDataType(raster) => raster.add_upstream_click_targets(click_targets),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.add_upstream_click_targets(click_targets),
|
||||
}
|
||||
}
|
||||
|
|
@ -1098,7 +1098,7 @@ impl GraphicElementRendered for GraphicElement {
|
|||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.contains_artboard(),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.contains_artboard(),
|
||||
GraphicElement::RasterFrame(raster) => raster.contains_artboard(),
|
||||
GraphicElement::RasterDataType(raster) => raster.contains_artboard(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1106,7 +1106,7 @@ impl GraphicElementRendered for GraphicElement {
|
|||
match self {
|
||||
GraphicElement::VectorData(vector_data) => vector_data.new_ids_from_hash(reference),
|
||||
GraphicElement::GraphicGroup(graphic_group) => graphic_group.new_ids_from_hash(reference),
|
||||
GraphicElement::RasterFrame(_) => (),
|
||||
GraphicElement::RasterDataType(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::Ctx;
|
||||
use crate::raster::BlendMode;
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::registry::types::{Fraction, Percentage};
|
||||
use crate::vector::style::GradientStops;
|
||||
use crate::{Color, Node};
|
||||
|
|
@ -453,7 +453,7 @@ fn color_value(_: impl Ctx, _primary: (), #[default(Color::BLACK)] color: Option
|
|||
// _: impl Ctx,
|
||||
// #[implementations(
|
||||
// Color,
|
||||
// ImageFrameTable<Color>,
|
||||
// RasterDataTable<Color>,
|
||||
// GradientStops,
|
||||
// )]
|
||||
// mut image: T,
|
||||
|
|
@ -515,7 +515,7 @@ fn unwrap<T: Default>(_: impl Ctx, #[implementations(Option<f64>, Option<f32>, O
|
|||
|
||||
/// Meant for debugging purposes, not general use. Clones the input value.
|
||||
#[node_macro::node(category("Debug"))]
|
||||
fn clone<'i, T: Clone + 'i>(_: impl Ctx, #[implementations(&ImageFrameTable<Color>)] value: &'i T) -> T {
|
||||
fn clone<'i, T: Clone + 'i>(_: impl Ctx, #[implementations(&RasterDataTable<Color>)] value: &'i T) -> T {
|
||||
value.clone()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
pub use self::color::{Color, Luma, SRGBA8};
|
||||
use crate::Ctx;
|
||||
use crate::GraphicGroupTable;
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::registry::types::Percentage;
|
||||
use crate::vector::VectorDataTable;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
|
|
@ -310,7 +310,7 @@ impl SetBlendMode for GraphicGroupTable {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl SetBlendMode for ImageFrameTable<Color> {
|
||||
impl SetBlendMode for RasterDataTable<Color> {
|
||||
fn set_blend_mode(&mut self, blend_mode: BlendMode) {
|
||||
for instance in self.instance_mut_iter() {
|
||||
instance.alpha_blending.blend_mode = blend_mode;
|
||||
|
|
@ -324,7 +324,7 @@ fn blend_mode<T: SetBlendMode>(
|
|||
#[implementations(
|
||||
GraphicGroupTable,
|
||||
VectorDataTable,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
)]
|
||||
mut value: T,
|
||||
blend_mode: BlendMode,
|
||||
|
|
@ -340,7 +340,7 @@ fn opacity<T: MultiplyAlpha>(
|
|||
#[implementations(
|
||||
GraphicGroupTable,
|
||||
VectorDataTable,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
)]
|
||||
mut value: T,
|
||||
#[default(100.)] factor: Percentage,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::raster::curve::{CubicSplines, CurveManipulatorGroup};
|
|||
#[cfg(feature = "alloc")]
|
||||
use crate::raster::curve::{Curve, ValueMapperNode};
|
||||
#[cfg(feature = "alloc")]
|
||||
use crate::raster::image::{Image, ImageFrameTable};
|
||||
use crate::raster::image::{Image, RasterDataTable};
|
||||
use crate::raster::{Channel, Color, Pixel};
|
||||
use crate::registry::types::{Angle, Percentage, SignedPercentage};
|
||||
use crate::vector::VectorDataTable;
|
||||
|
|
@ -265,7 +265,7 @@ fn luminance<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -289,7 +289,7 @@ fn extract_channel<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -312,7 +312,7 @@ fn make_opaque<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -337,7 +337,7 @@ fn brightness_contrast<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -426,7 +426,7 @@ fn levels<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -493,7 +493,7 @@ async fn black_and_white<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -565,7 +565,7 @@ async fn hue_saturation<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -599,7 +599,7 @@ async fn invert<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -621,7 +621,7 @@ async fn threshold<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -663,7 +663,7 @@ impl Blend<Color> for Option<Color> {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl Blend<Color> for ImageFrameTable<Color> {
|
||||
impl Blend<Color> for RasterDataTable<Color> {
|
||||
fn blend(&self, under: &Self, blend_fn: impl Fn(Color, Color) -> Color) -> Self {
|
||||
let mut result_table = self.clone();
|
||||
|
||||
|
|
@ -706,14 +706,14 @@ async fn blend<T: Blend<Color> + Send>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
over: T,
|
||||
#[expose]
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
under: T,
|
||||
|
|
@ -795,7 +795,7 @@ impl Adjust<Color> for GradientStops {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl<P: Pixel> Adjust<P> for ImageFrameTable<P>
|
||||
impl<P: Pixel> Adjust<P> for RasterDataTable<P>
|
||||
where
|
||||
GraphicElement: From<Image<P>>,
|
||||
{
|
||||
|
|
@ -829,7 +829,7 @@ async fn gradient_map<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -865,7 +865,7 @@ async fn vibrance<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -1037,7 +1037,7 @@ async fn channel_mixer<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -1166,7 +1166,7 @@ async fn selective_color<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -1309,7 +1309,7 @@ impl MultiplyAlpha for GraphicGroupTable {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl<P: Pixel> MultiplyAlpha for ImageFrameTable<P>
|
||||
impl<P: Pixel> MultiplyAlpha for RasterDataTable<P>
|
||||
where
|
||||
GraphicElement: From<Image<P>>,
|
||||
{
|
||||
|
|
@ -1331,7 +1331,7 @@ async fn posterize<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -1364,7 +1364,7 @@ async fn exposure<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut input: T,
|
||||
|
|
@ -1438,7 +1438,7 @@ fn color_overlay<T: Adjust<Color>>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
Color,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GradientStops,
|
||||
)]
|
||||
mut image: T,
|
||||
|
|
@ -1488,7 +1488,7 @@ fn color_overlay<T: Adjust<Color>>(
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::raster::adjustments::BlendMode;
|
||||
use crate::raster::image::{Image, ImageFrameTable};
|
||||
use crate::raster::image::{Image, RasterDataTable};
|
||||
use crate::{Color, Node};
|
||||
use std::pin::Pin;
|
||||
|
||||
|
|
@ -1514,7 +1514,7 @@ mod test {
|
|||
// 100% of the output should come from the multiplied value
|
||||
let opacity = 100_f64;
|
||||
|
||||
let result = super::color_overlay((), ImageFrameTable::new(image.clone()), overlay_color, BlendMode::Multiply, opacity);
|
||||
let result = super::color_overlay((), RasterDataTable::new(image.clone()), overlay_color, BlendMode::Multiply, opacity);
|
||||
let result = result.instance_ref_iter().next().unwrap().instance;
|
||||
|
||||
// The output should just be the original green and alpha channels (as we multiply them by 1 and other channels by 0)
|
||||
|
|
|
|||
|
|
@ -16,19 +16,13 @@ mod base64_serde {
|
|||
use base64::Engine;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
pub fn as_base64<S, P: Pixel>(key: &[P], serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
pub fn as_base64<S: Serializer, P: Pixel>(key: &[P], serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let u8_data = bytemuck::cast_slice(key);
|
||||
let string = base64::engine::general_purpose::STANDARD.encode(u8_data);
|
||||
(key.len() as u64, string).serialize(serializer)
|
||||
}
|
||||
|
||||
pub fn from_base64<'a, D, P: Pixel>(deserializer: D) -> Result<Vec<P>, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
pub fn from_base64<'a, D: Deserializer<'a>, P: Pixel>(deserializer: D) -> Result<Vec<P>, D::Error> {
|
||||
use serde::de::Error;
|
||||
<(u64, &[u8])>::deserialize(deserializer)
|
||||
.and_then(|(len, str)| {
|
||||
|
|
@ -214,7 +208,7 @@ impl<P: Pixel> IntoIterator for Image<P> {
|
|||
}
|
||||
|
||||
// TODO: Eventually remove this migration document upgrade code
|
||||
pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<ImageFrameTable<Color>, D::Error> {
|
||||
pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<RasterDataTable<Color>, D::Error> {
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, specta::Type)]
|
||||
|
|
@ -224,13 +218,13 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
|
|||
}
|
||||
impl From<ImageFrame<Color>> for GraphicElement {
|
||||
fn from(image_frame: ImageFrame<Color>) -> Self {
|
||||
GraphicElement::RasterFrame(crate::RasterFrame::ImageFrame(ImageFrameTable::new(image_frame.image)))
|
||||
GraphicElement::RasterDataType(crate::RasterDataType::RasterData(RasterDataTable::new(image_frame.image)))
|
||||
}
|
||||
}
|
||||
impl From<GraphicElement> for ImageFrame<Color> {
|
||||
fn from(element: GraphicElement) -> Self {
|
||||
match element {
|
||||
GraphicElement::RasterFrame(crate::RasterFrame::ImageFrame(image)) => Self {
|
||||
GraphicElement::RasterDataType(crate::RasterDataType::RasterData(image)) => Self {
|
||||
image: image.instance_ref_iter().next().unwrap().instance.clone(),
|
||||
},
|
||||
_ => panic!("Expected Image, found {:?}", element),
|
||||
|
|
@ -261,20 +255,20 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
|
|||
Image(Image<Color>),
|
||||
OldImageFrame(OldImageFrame<Color>),
|
||||
ImageFrame(Instances<ImageFrame<Color>>),
|
||||
ImageFrameTable(ImageFrameTable<Color>),
|
||||
RasterDataTable(RasterDataTable<Color>),
|
||||
}
|
||||
|
||||
Ok(match FormatVersions::deserialize(deserializer)? {
|
||||
FormatVersions::Image(image) => ImageFrameTable::new(image),
|
||||
FormatVersions::Image(image) => RasterDataTable::new(image),
|
||||
FormatVersions::OldImageFrame(image_frame_with_transform_and_blending) => {
|
||||
let OldImageFrame { image, transform, alpha_blending } = image_frame_with_transform_and_blending;
|
||||
let mut image_frame_table = ImageFrameTable::new(image);
|
||||
let mut image_frame_table = RasterDataTable::new(image);
|
||||
*image_frame_table.instance_mut_iter().next().unwrap().transform = transform;
|
||||
*image_frame_table.instance_mut_iter().next().unwrap().alpha_blending = alpha_blending;
|
||||
image_frame_table
|
||||
}
|
||||
FormatVersions::ImageFrame(image_frame) => ImageFrameTable::new(image_frame.instance_ref_iter().next().unwrap().instance.image.clone()),
|
||||
FormatVersions::ImageFrameTable(image_frame_table) => image_frame_table,
|
||||
FormatVersions::ImageFrame(image_frame) => RasterDataTable::new(image_frame.instance_ref_iter().next().unwrap().instance.image.clone()),
|
||||
FormatVersions::RasterDataTable(image_frame_table) => image_frame_table,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -289,13 +283,13 @@ pub fn migrate_image_frame_instance<'de, D: serde::Deserializer<'de>>(deserializ
|
|||
}
|
||||
impl From<ImageFrame<Color>> for GraphicElement {
|
||||
fn from(image_frame: ImageFrame<Color>) -> Self {
|
||||
GraphicElement::RasterFrame(crate::RasterFrame::ImageFrame(ImageFrameTable::new(image_frame.image)))
|
||||
GraphicElement::RasterDataType(crate::RasterDataType::RasterData(RasterDataTable::new(image_frame.image)))
|
||||
}
|
||||
}
|
||||
impl From<GraphicElement> for ImageFrame<Color> {
|
||||
fn from(element: GraphicElement) -> Self {
|
||||
match element {
|
||||
GraphicElement::RasterFrame(crate::RasterFrame::ImageFrame(image)) => Self {
|
||||
GraphicElement::RasterDataType(crate::RasterDataType::RasterData(image)) => Self {
|
||||
image: image.instance_ref_iter().next().unwrap().instance.clone(),
|
||||
},
|
||||
_ => panic!("Expected Image, found {:?}", element),
|
||||
|
|
@ -326,7 +320,7 @@ pub fn migrate_image_frame_instance<'de, D: serde::Deserializer<'de>>(deserializ
|
|||
Image(Image<Color>),
|
||||
OldImageFrame(OldImageFrame<Color>),
|
||||
ImageFrame(Instances<ImageFrame<Color>>),
|
||||
ImageFrameTable(ImageFrameTable<Color>),
|
||||
RasterDataTable(RasterDataTable<Color>),
|
||||
ImageInstance(Instance<Image<Color>>),
|
||||
}
|
||||
|
||||
|
|
@ -345,13 +339,13 @@ pub fn migrate_image_frame_instance<'de, D: serde::Deserializer<'de>>(deserializ
|
|||
instance: image_frame.instance_ref_iter().next().unwrap().instance.image.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
FormatVersions::ImageFrameTable(image_frame_table) => image_frame_table.instance_iter().next().unwrap_or_default(),
|
||||
FormatVersions::RasterDataTable(image_frame_table) => image_frame_table.instance_iter().next().unwrap_or_default(),
|
||||
FormatVersions::ImageInstance(image_instance) => image_instance,
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Rename to ImageTable
|
||||
pub type ImageFrameTable<P> = Instances<Image<P>>;
|
||||
pub type RasterDataTable<P> = Instances<Image<P>>;
|
||||
|
||||
impl<P: Debug + Copy + Pixel> Sample for Image<P> {
|
||||
type Pixel = P;
|
||||
|
|
@ -399,9 +393,9 @@ impl From<Image<Color>> for Image<SRGBA8> {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ImageFrameTable<Color>> for ImageFrameTable<SRGBA8> {
|
||||
fn from(image_frame_table: ImageFrameTable<Color>) -> Self {
|
||||
let mut result_table = ImageFrameTable::<SRGBA8>::default();
|
||||
impl From<RasterDataTable<Color>> for RasterDataTable<SRGBA8> {
|
||||
fn from(image_frame_table: RasterDataTable<Color>) -> Self {
|
||||
let mut result_table = RasterDataTable::<SRGBA8>::default();
|
||||
|
||||
for image_frame_instance in image_frame_table.instance_iter() {
|
||||
result_table.push(Instance {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::application_io::TextureFrameTable;
|
||||
use crate::application_io::TextureDataTable;
|
||||
use crate::instances::Instances;
|
||||
use crate::raster::bbox::AxisAlignedBbox;
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::vector::VectorDataTable;
|
||||
use crate::{Artboard, CloneVarArgs, Color, Context, Ctx, ExtractAll, GraphicGroupTable, OwnedContextImpl};
|
||||
use core::f64;
|
||||
|
|
@ -162,8 +162,8 @@ async fn transform<T: 'n + 'static>(
|
|||
#[implementations(
|
||||
Context -> VectorDataTable,
|
||||
Context -> GraphicGroupTable,
|
||||
Context -> ImageFrameTable<Color>,
|
||||
Context -> TextureFrameTable,
|
||||
Context -> RasterDataTable<Color>,
|
||||
Context -> TextureDataTable,
|
||||
)]
|
||||
transform_target: impl Node<Context<'static>, Output = Instances<T>>,
|
||||
translate: DVec2,
|
||||
|
|
@ -194,7 +194,7 @@ async fn transform<T: 'n + 'static>(
|
|||
#[node_macro::node(category(""))]
|
||||
fn replace_transform<Data, TransformInput: Transform>(
|
||||
_: impl Ctx,
|
||||
#[implementations(VectorDataTable, ImageFrameTable<Color>, GraphicGroupTable)] mut data: Instances<Data>,
|
||||
#[implementations(VectorDataTable, RasterDataTable<Color>, GraphicGroupTable)] mut data: Instances<Data>,
|
||||
#[implementations(DAffine2)] transform: TransformInput,
|
||||
) -> Instances<Data> {
|
||||
for data_transform in data.instance_mut_iter() {
|
||||
|
|
@ -209,8 +209,8 @@ async fn boundless_footprint<T: 'n + 'static>(
|
|||
#[implementations(
|
||||
Context -> VectorDataTable,
|
||||
Context -> GraphicGroupTable,
|
||||
Context -> ImageFrameTable<Color>,
|
||||
Context -> TextureFrameTable,
|
||||
Context -> RasterDataTable<Color>,
|
||||
Context -> TextureDataTable,
|
||||
Context -> String,
|
||||
Context -> f64,
|
||||
)]
|
||||
|
|
@ -226,8 +226,8 @@ async fn freeze_real_time<T: 'n + 'static>(
|
|||
#[implementations(
|
||||
Context -> VectorDataTable,
|
||||
Context -> GraphicGroupTable,
|
||||
Context -> ImageFrameTable<Color>,
|
||||
Context -> TextureFrameTable,
|
||||
Context -> RasterDataTable<Color>,
|
||||
Context -> TextureDataTable,
|
||||
Context -> String,
|
||||
Context -> f64,
|
||||
)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::instances::{InstanceRef, Instances};
|
||||
use crate::raster::Color;
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::transform::TransformMut;
|
||||
use crate::vector::VectorDataTable;
|
||||
use crate::{CloneVarArgs, Context, Ctx, ExtractAll, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, OwnedContextImpl};
|
||||
|
|
@ -10,7 +10,7 @@ use glam::DVec2;
|
|||
async fn instance_on_points<T: Into<GraphicElement> + Default + Clone + 'static>(
|
||||
ctx: impl ExtractAll + CloneVarArgs + Sync + Ctx,
|
||||
points: VectorDataTable,
|
||||
#[implementations(Context -> GraphicGroupTable, Context -> VectorDataTable, Context -> ImageFrameTable<Color>)] instance: impl Node<'n, Context<'static>, Output = Instances<T>>,
|
||||
#[implementations(Context -> GraphicGroupTable, Context -> VectorDataTable, Context -> RasterDataTable<Color>)] instance: impl Node<'n, Context<'static>, Output = Instances<T>>,
|
||||
reverse: bool,
|
||||
) -> GraphicGroupTable {
|
||||
let mut result_table = GraphicGroupTable::default();
|
||||
|
|
@ -46,7 +46,7 @@ async fn instance_on_points<T: Into<GraphicElement> + Default + Clone + 'static>
|
|||
#[node_macro::node(category("Instancing"), path(graphene_core::vector))]
|
||||
async fn instance_repeat<T: Into<GraphicElement> + Default + Clone + 'static>(
|
||||
ctx: impl ExtractAll + CloneVarArgs + Ctx,
|
||||
#[implementations(Context -> GraphicGroupTable, Context -> VectorDataTable, Context -> ImageFrameTable<Color>)] instance: impl Node<'n, Context<'static>, Output = Instances<T>>,
|
||||
#[implementations(Context -> GraphicGroupTable, Context -> VectorDataTable, Context -> RasterDataTable<Color>)] instance: impl Node<'n, Context<'static>, Output = Instances<T>>,
|
||||
#[default(1)] count: u64,
|
||||
reverse: bool,
|
||||
) -> GraphicGroupTable {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use super::misc::{CentroidType, point_to_dvec2};
|
|||
use super::style::{Fill, Gradient, GradientStops, Stroke};
|
||||
use super::{PointId, SegmentDomain, SegmentId, StrokeId, VectorData, VectorDataTable};
|
||||
use crate::instances::{Instance, InstanceMut, Instances};
|
||||
use crate::raster::image::ImageFrameTable;
|
||||
use crate::raster::image::RasterDataTable;
|
||||
use crate::registry::types::{Angle, Fraction, IntegerCount, Length, Multiplier, Percentage, PixelLength, PixelSize, SeedValue};
|
||||
use crate::renderer::GraphicElementRendered;
|
||||
use crate::transform::{Footprint, ReferencePoint, Transform};
|
||||
|
|
@ -204,7 +204,7 @@ where
|
|||
async fn repeat<I: 'n + Send>(
|
||||
_: impl Ctx,
|
||||
// TODO: Implement other GraphicElementRendered types.
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, ImageFrameTable<Color>)] instance: Instances<I>,
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<Color>)] instance: Instances<I>,
|
||||
#[default(100., 100.)]
|
||||
// TODO: When using a custom Properties panel layout in document_node_definitions.rs and this default is set, the widget weirdly doesn't show up in the Properties panel. Investigation is needed.
|
||||
direction: PixelSize,
|
||||
|
|
@ -246,7 +246,7 @@ where
|
|||
async fn circular_repeat<I: 'n + Send>(
|
||||
_: impl Ctx,
|
||||
// TODO: Implement other GraphicElementRendered types.
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, ImageFrameTable<Color>)] instance: Instances<I>,
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<Color>)] instance: Instances<I>,
|
||||
angle_offset: Angle,
|
||||
#[default(5)] radius: f64,
|
||||
#[default(5)] instances: IntegerCount,
|
||||
|
|
@ -286,7 +286,7 @@ async fn copy_to_points<I: 'n + Send>(
|
|||
points: VectorDataTable,
|
||||
#[expose]
|
||||
/// Artwork to be copied and placed at each point.
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, ImageFrameTable<Color>)]
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<Color>)]
|
||||
instance: Instances<I>,
|
||||
/// Minimum range of randomized sizes given to each instance.
|
||||
#[default(1)]
|
||||
|
|
@ -370,7 +370,7 @@ where
|
|||
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
|
||||
async fn mirror<I: 'n + Send>(
|
||||
_: impl Ctx,
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, ImageFrameTable<Color>)] instance: Instances<I>,
|
||||
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<Color>)] instance: Instances<I>,
|
||||
#[default(ReferencePoint::Center)] reference_point: ReferencePoint,
|
||||
offset: f64,
|
||||
#[range((-90., 90.))] angle: Angle,
|
||||
|
|
|
|||
|
|
@ -187,8 +187,8 @@ tagged_value! {
|
|||
GraphicElement(graphene_core::GraphicElement),
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(deserialize_with = "graphene_core::vector::migrate_vector_data"))] // TODO: Eventually remove this migration document upgrade code
|
||||
VectorData(graphene_core::vector::VectorDataTable),
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(deserialize_with = "graphene_core::raster::image::migrate_image_frame"))] // TODO: Eventually remove this migration document upgrade code
|
||||
ImageFrame(graphene_core::raster::image::ImageFrameTable<Color>),
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(alias = "ImageFrame", deserialize_with = "graphene_core::raster::image::migrate_image_frame"))] // TODO: Eventually remove this migration document upgrade code
|
||||
RasterData(graphene_core::raster::image::RasterDataTable<Color>),
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(deserialize_with = "graphene_core::migrate_graphic_group"))] // TODO: Eventually remove this migration document upgrade code
|
||||
GraphicGroup(graphene_core::GraphicGroupTable),
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(deserialize_with = "graphene_core::migrate_artboard_group"))] // TODO: Eventually remove this migration document upgrade code
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use graphene_core::instances::Instance;
|
|||
use graphene_core::raster::adjustments::blend_colors;
|
||||
use graphene_core::raster::bbox::{AxisAlignedBbox, Bbox};
|
||||
use graphene_core::raster::brush_cache::BrushCache;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::raster::{Alpha, BitmapMut, BlendMode, Color, Pixel, Sample};
|
||||
use graphene_core::renderer::GraphicElementRendered;
|
||||
use graphene_core::transform::Transform;
|
||||
|
|
@ -80,7 +80,7 @@ fn brush_stamp_generator(diameter: f64, color: Color, hardness: f64, flow: f64)
|
|||
}
|
||||
|
||||
#[node_macro::node(skip_impl)]
|
||||
fn blit<P, BlendFn>(mut target: ImageFrameTable<P>, texture: Image<P>, positions: Vec<DVec2>, blend_mode: BlendFn) -> ImageFrameTable<P>
|
||||
fn blit<P, BlendFn>(mut target: RasterDataTable<P>, texture: Image<P>, positions: Vec<DVec2>, blend_mode: BlendFn) -> RasterDataTable<P>
|
||||
where
|
||||
P: Pixel + Alpha + std::fmt::Debug,
|
||||
BlendFn: for<'any_input> Node<'any_input, (P, P), Output = P>,
|
||||
|
|
@ -184,10 +184,10 @@ pub fn blend_with_mode(background: Instance<Image<Color>>, foreground: Instance<
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
async fn brush(_: impl Ctx, mut image_frame_table: ImageFrameTable<Color>, strokes: Vec<BrushStroke>, cache: BrushCache) -> ImageFrameTable<Color> {
|
||||
async fn brush(_: impl Ctx, mut image_frame_table: RasterDataTable<Color>, strokes: Vec<BrushStroke>, cache: BrushCache) -> RasterDataTable<Color> {
|
||||
// TODO: Find a way to handle more than one instance
|
||||
let Some(image_frame_instance) = image_frame_table.instance_ref_iter().next() else {
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
};
|
||||
let image_frame_instance = image_frame_instance.to_instance_cloned();
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ async fn brush(_: impl Ctx, mut image_frame_table: ImageFrameTable<Color>, strok
|
|||
|
||||
// TODO: Find a way to handle more than one instance
|
||||
let Some(mut actual_image) = extend_image_to_bounds((), brush_plan.background.to_table(), background_bounds).instance_iter().next() else {
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
};
|
||||
|
||||
let final_stroke_idx = brush_plan.strokes.len().saturating_sub(1);
|
||||
|
|
@ -397,7 +397,7 @@ mod test {
|
|||
async fn test_brush_output_size() {
|
||||
let image = brush(
|
||||
(),
|
||||
ImageFrameTable::<Color>::new(Image::<Color>::default()),
|
||||
RasterDataTable::<Color>::new(Image::<Color>::default()),
|
||||
vec![BrushStroke {
|
||||
trace: vec![crate::vector::brush_stroke::BrushInputSample { position: DVec2::ZERO }],
|
||||
style: BrushStyle {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use graph_craft::proto::types::Percentage;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::{Color, Ctx};
|
||||
use image::{DynamicImage, GenericImage, GenericImageView, GrayImage, ImageBuffer, Luma, Rgba, RgbaImage};
|
||||
use ndarray::{Array2, ArrayBase, Dim, OwnedRepr};
|
||||
use std::cmp::{max, min};
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
async fn dehaze(_: impl Ctx, image_frame: ImageFrameTable<Color>, strength: Percentage) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
async fn dehaze(_: impl Ctx, image_frame: RasterDataTable<Color>, strength: Percentage) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for mut image_frame_instance in image_frame.instance_iter() {
|
||||
let image = image_frame_instance.instance;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use graph_craft::proto::types::PixelLength;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::raster::{Bitmap, BitmapMut};
|
||||
use graphene_core::{Color, Ctx};
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ use graphene_core::{Color, Ctx};
|
|||
async fn blur(
|
||||
_: impl Ctx,
|
||||
/// The image to be blurred.
|
||||
image_frame: ImageFrameTable<Color>,
|
||||
image_frame: RasterDataTable<Color>,
|
||||
/// The radius of the blur kernel.
|
||||
#[range((0., 100.))]
|
||||
#[hard_min(0.)]
|
||||
|
|
@ -17,8 +17,8 @@ async fn blur(
|
|||
box_blur: bool,
|
||||
/// Opt to incorrectly apply the filter with color calculations in gamma space for compatibility with the results from other software.
|
||||
gamma: bool,
|
||||
) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for mut image_instance in image_frame.instance_iter() {
|
||||
let image = image_instance.instance.clone();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use graph_craft::document::value::TaggedValue;
|
|||
use graph_craft::document::*;
|
||||
use graph_craft::proto::*;
|
||||
use graphene_core::raster::BlendMode;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::*;
|
||||
use std::sync::Arc;
|
||||
use wgpu_executor::{Bindgroup, PipelineLayout, Shader, ShaderIO, ShaderInput, WgpuExecutor};
|
||||
|
|
@ -34,8 +34,8 @@ async fn compile_gpu<'a: 'n>(_: impl Ctx, node: &'a DocumentNode, typing_context
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Debug: GPU"))]
|
||||
async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, background: ImageFrameTable<Color>, blend_mode: BlendMode, opacity: f64) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
async fn blend_gpu_image(_: impl Ctx, foreground: RasterDataTable<Color>, background: RasterDataTable<Color>, blend_mode: BlendMode, opacity: f64) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for (foreground_instance, mut background_instance) in foreground.instance_iter().zip(background.instance_iter()) {
|
||||
let foreground_transform = foreground_instance.transform;
|
||||
|
|
@ -95,7 +95,7 @@ async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, backgr
|
|||
let proto_networks: Result<Vec<_>, _> = compiler.compile(network.clone()).collect();
|
||||
let Ok(proto_networks_result) = proto_networks else {
|
||||
log::error!("Error compiling network in 'blend_gpu_image()");
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
};
|
||||
let proto_networks = proto_networks_result;
|
||||
log::debug!("compiling shader");
|
||||
|
|
@ -241,7 +241,7 @@ async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, backgr
|
|||
// }
|
||||
|
||||
// #[node_macro::old_node_impl(MapGpuNode)]
|
||||
// async fn map_gpu<'a: 'input>(image: ImageFrameTable<Color>, node: DocumentNode, editor_api: &'a graphene_core::application_io::EditorApi<WasmApplicationIo>) -> ImageFrameTable<Color> {
|
||||
// async fn map_gpu<'a: 'input>(image: RasterDataTable<Color>, node: DocumentNode, editor_api: &'a graphene_core::application_io::EditorApi<WasmApplicationIo>) -> RasterDataTable<Color> {
|
||||
// let image_frame_table = ℑ
|
||||
// let image = image.instance_ref_iter().next().unwrap().instance;
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, backgr
|
|||
// let name = "placeholder".to_string();
|
||||
// let Ok(compute_pass_descriptor) = create_compute_pass_descriptor(node, image_frame_table, executor).await else {
|
||||
// log::error!("Error creating compute pass descriptor in 'map_gpu()");
|
||||
// return ImageFrameTable::default();
|
||||
// return RasterDataTable::default();
|
||||
// };
|
||||
// self.cache.lock().as_mut().unwrap().insert(name, compute_pass_descriptor.clone());
|
||||
// log::error!("created compute pass");
|
||||
|
|
@ -292,7 +292,7 @@ async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, backgr
|
|||
// height: image.height,
|
||||
// ..Default::default()
|
||||
// };
|
||||
// let mut result = ImageFrameTable::new(new_image);
|
||||
// let mut result = RasterDataTable::new(new_image);
|
||||
// *result.transform_mut() = image_frame_table.transform();
|
||||
// *result.instance_mut_iter().next().unwrap().alpha_blending = *image_frame_table.instance_ref_iter().next().unwrap().alpha_blending;
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ async fn blend_gpu_image(_: impl Ctx, foreground: ImageFrameTable<Color>, backgr
|
|||
// }
|
||||
// }
|
||||
|
||||
// async fn create_compute_pass_descriptor<T: Clone + Pixel + StaticTypeSized>(node: DocumentNode, image: &ImageFrameTable<T>, executor: &&WgpuExecutor) -> Result<ComputePass, String>
|
||||
// async fn create_compute_pass_descriptor<T: Clone + Pixel + StaticTypeSized>(node: DocumentNode, image: &RasterDataTable<T>, executor: &&WgpuExecutor) -> Result<ComputePass, String>
|
||||
// where
|
||||
// GraphicElement: From<Image<T>>,
|
||||
// T::Static: Pixel,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::{Color, Ctx};
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
async fn image_color_palette(
|
||||
_: impl Ctx,
|
||||
image: ImageFrameTable<Color>,
|
||||
image: RasterDataTable<Color>,
|
||||
#[hard_min(1.)]
|
||||
#[soft_max(28.)]
|
||||
max_size: u32,
|
||||
|
|
@ -64,13 +64,13 @@ async fn image_color_palette(
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
|
||||
#[test]
|
||||
fn test_image_color_palette() {
|
||||
let result = image_color_palette(
|
||||
(),
|
||||
ImageFrameTable::new(Image {
|
||||
RasterDataTable::new(Image {
|
||||
width: 100,
|
||||
height: 100,
|
||||
data: vec![Color::from_rgbaf32(0., 0., 0., 1.).unwrap(); 10000],
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use fastnoise_lite;
|
|||
use glam::{DAffine2, DVec2, Vec2};
|
||||
use graphene_core::instances::Instance;
|
||||
use graphene_core::raster::bbox::Bbox;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::raster::{Alpha, AlphaMut, Bitmap, BitmapMut, CellularDistanceFunction, CellularReturnType, Channel, DomainWarpType, FractalType, LinearChannel, Luminance, NoiseType, RGBMut};
|
||||
use graphene_core::transform::Transform;
|
||||
use graphene_core::{AlphaBlending, Color, Ctx, ExtractFootprint};
|
||||
|
|
@ -25,8 +25,8 @@ impl From<std::io::Error> for Error {
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Debug: Raster"))]
|
||||
fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: ImageFrameTable<Color>) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: RasterDataTable<Color>) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for mut image_frame_instance in image_frame.instance_iter() {
|
||||
let image_frame_transform = image_frame_instance.transform;
|
||||
|
|
@ -95,12 +95,12 @@ fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: ImageFra
|
|||
fn combine_channels(
|
||||
_: impl Ctx,
|
||||
_primary: (),
|
||||
#[expose] red: ImageFrameTable<Color>,
|
||||
#[expose] green: ImageFrameTable<Color>,
|
||||
#[expose] blue: ImageFrameTable<Color>,
|
||||
#[expose] alpha: ImageFrameTable<Color>,
|
||||
) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
#[expose] red: RasterDataTable<Color>,
|
||||
#[expose] green: RasterDataTable<Color>,
|
||||
#[expose] blue: RasterDataTable<Color>,
|
||||
#[expose] alpha: RasterDataTable<Color>,
|
||||
) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
let max_len = red.len().max(green.len()).max(blue.len()).max(alpha.len());
|
||||
let red = red.instance_iter().map(Some).chain(std::iter::repeat(None)).take(max_len);
|
||||
|
|
@ -184,11 +184,11 @@ fn combine_channels(
|
|||
fn mask(
|
||||
_: impl Ctx,
|
||||
/// The image to be masked.
|
||||
image: ImageFrameTable<Color>,
|
||||
image: RasterDataTable<Color>,
|
||||
/// The stencil to be used for masking.
|
||||
#[expose]
|
||||
stencil: ImageFrameTable<Color>,
|
||||
) -> ImageFrameTable<Color> {
|
||||
stencil: RasterDataTable<Color>,
|
||||
) -> RasterDataTable<Color> {
|
||||
// TODO: Support multiple stencil instances
|
||||
let Some(stencil_instance) = stencil.instance_iter().next() else {
|
||||
// No stencil provided so we return the original image
|
||||
|
|
@ -196,7 +196,7 @@ fn mask(
|
|||
};
|
||||
let stencil_size = DVec2::new(stencil_instance.instance.width as f64, stencil_instance.instance.height as f64);
|
||||
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for mut image_instance in image.instance_iter() {
|
||||
let image_size = DVec2::new(image_instance.instance.width as f64, image_instance.instance.height as f64);
|
||||
|
|
@ -231,8 +231,8 @@ fn mask(
|
|||
}
|
||||
|
||||
#[node_macro::node(category(""))]
|
||||
fn extend_image_to_bounds(_: impl Ctx, image: ImageFrameTable<Color>, bounds: DAffine2) -> ImageFrameTable<Color> {
|
||||
let mut result_table = ImageFrameTable::default();
|
||||
fn extend_image_to_bounds(_: impl Ctx, image: RasterDataTable<Color>, bounds: DAffine2) -> RasterDataTable<Color> {
|
||||
let mut result_table = RasterDataTable::default();
|
||||
|
||||
for mut image_instance in image.instance_iter() {
|
||||
let image_aabb = Bbox::unit().affine_transform(image_instance.transform).to_axis_aligned_bbox();
|
||||
|
|
@ -284,13 +284,13 @@ fn extend_image_to_bounds(_: impl Ctx, image: ImageFrameTable<Color>, bounds: DA
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Debug: Raster"))]
|
||||
fn empty_image(_: impl Ctx, transform: DAffine2, color: Color) -> ImageFrameTable<Color> {
|
||||
fn empty_image(_: impl Ctx, transform: DAffine2, color: Color) -> RasterDataTable<Color> {
|
||||
let width = transform.transform_vector2(DVec2::new(1., 0.)).length() as u32;
|
||||
let height = transform.transform_vector2(DVec2::new(0., 1.)).length() as u32;
|
||||
|
||||
let image = Image::new(width, height, color);
|
||||
|
||||
let mut result_table = ImageFrameTable::new(image);
|
||||
let mut result_table = RasterDataTable::new(image);
|
||||
let image_instance = result_table.get_mut(0).unwrap();
|
||||
*image_instance.transform = transform;
|
||||
*image_instance.alpha_blending = AlphaBlending::default();
|
||||
|
|
@ -301,7 +301,7 @@ fn empty_image(_: impl Ctx, transform: DAffine2, color: Color) -> ImageFrameTabl
|
|||
|
||||
/// Constructs a raster image.
|
||||
#[node_macro::node(category(""))]
|
||||
fn image(_: impl Ctx, _primary: (), image: ImageFrameTable<Color>) -> ImageFrameTable<Color> {
|
||||
fn image(_: impl Ctx, _primary: (), image: RasterDataTable<Color>) -> RasterDataTable<Color> {
|
||||
image
|
||||
}
|
||||
|
||||
|
|
@ -329,15 +329,15 @@ fn image(_: impl Ctx, _primary: (), image: ImageFrameTable<Color>) -> ImageFrame
|
|||
// }
|
||||
// }
|
||||
|
||||
// impl<'i, 'e: 'i, P: Pixel + 'i + Hash + Default + Send, E: 'i, C: 'i, G: 'i, $($t: 'i,)*> Node<'i, ImageFrame<P>> for ImaginateNode<P, E, C, G, $($t,)*>
|
||||
// impl<'i, 'e: 'i, P: Pixel + 'i + Hash + Default + Send, E: 'i, C: 'i, G: 'i, $($t: 'i,)*> Node<'i, RasterData<P>> for ImaginateNode<P, E, C, G, $($t,)*>
|
||||
// where $($t: for<'any_input> Node<'any_input, (), Output = DynFuture<'any_input, $o>>,)*
|
||||
// E: for<'any_input> Node<'any_input, (), Output = DynFuture<'any_input, &'e WasmEditorApi>>,
|
||||
// C: for<'any_input> Node<'any_input, (), Output = DynFuture<'any_input, ImaginateController>>,
|
||||
// G: for<'any_input> Node<'any_input, (), Output = DynFuture<'any_input, u64>>,
|
||||
// {
|
||||
// type Output = DynFuture<'i, ImageFrame<P>>;
|
||||
// type Output = DynFuture<'i, RasterData<P>>;
|
||||
|
||||
// fn eval(&'i self, frame: ImageFrame<P>) -> Self::Output {
|
||||
// fn eval(&'i self, frame: RasterData<P>) -> Self::Output {
|
||||
// let controller = self.controller.eval(());
|
||||
// $(let $val = self.$val.eval(());)*
|
||||
|
||||
|
|
@ -369,16 +369,16 @@ fn image(_: impl Ctx, _primary: (), image: ImageFrameTable<Color>) -> ImageFrame
|
|||
// }
|
||||
// }
|
||||
|
||||
// fn wrap_image_frame<P: Pixel>(image: Image<P>, transform: DAffine2) -> ImageFrame<P> {
|
||||
// fn wrap_image_frame<P: Pixel>(image: Image<P>, transform: DAffine2) -> RasterData<P> {
|
||||
// if !transform.decompose_scale().abs_diff_eq(DVec2::ZERO, 0.00001) {
|
||||
// ImageFrame {
|
||||
// RasterData {
|
||||
// image,
|
||||
// transform,
|
||||
// alpha_blending: AlphaBlending::default(),
|
||||
// }
|
||||
// } else {
|
||||
// let resolution = DVec2::new(image.height as f64, image.width as f64);
|
||||
// ImageFrame {
|
||||
// RasterData {
|
||||
// image,
|
||||
// transform: DAffine2::from_scale_angle_translation(resolution, 0., transform.translation),
|
||||
// alpha_blending: AlphaBlending::default(),
|
||||
|
|
@ -424,7 +424,7 @@ fn noise_pattern(
|
|||
cellular_distance_function: CellularDistanceFunction,
|
||||
cellular_return_type: CellularReturnType,
|
||||
cellular_jitter: f64,
|
||||
) -> ImageFrameTable<Color> {
|
||||
) -> RasterDataTable<Color> {
|
||||
let footprint = ctx.footprint();
|
||||
let viewport_bounds = footprint.viewport_bounds_in_local_space();
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ fn noise_pattern(
|
|||
|
||||
// If the image would not be visible, return an empty image
|
||||
if size.x <= 0. || size.y <= 0. {
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
}
|
||||
|
||||
let footprint_scale = footprint.scale();
|
||||
|
|
@ -486,7 +486,7 @@ fn noise_pattern(
|
|||
}
|
||||
}
|
||||
|
||||
let mut result = ImageFrameTable::default();
|
||||
let mut result = RasterDataTable::default();
|
||||
result.push(Instance {
|
||||
instance: image,
|
||||
transform: DAffine2::from_translation(offset) * DAffine2::from_scale(size),
|
||||
|
|
@ -551,7 +551,7 @@ fn noise_pattern(
|
|||
}
|
||||
}
|
||||
|
||||
let mut result = ImageFrameTable::default();
|
||||
let mut result = RasterDataTable::default();
|
||||
result.push(Instance {
|
||||
instance: image,
|
||||
transform: DAffine2::from_translation(offset) * DAffine2::from_scale(size),
|
||||
|
|
@ -562,7 +562,7 @@ fn noise_pattern(
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Raster"))]
|
||||
fn mandelbrot(ctx: impl ExtractFootprint + Send) -> ImageFrameTable<Color> {
|
||||
fn mandelbrot(ctx: impl ExtractFootprint + Send) -> RasterDataTable<Color> {
|
||||
let footprint = ctx.footprint();
|
||||
let viewport_bounds = footprint.viewport_bounds_in_local_space();
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ fn mandelbrot(ctx: impl ExtractFootprint + Send) -> ImageFrameTable<Color> {
|
|||
|
||||
// If the image would not be visible, return an empty image
|
||||
if size.x <= 0. || size.y <= 0. {
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
}
|
||||
|
||||
let scale = footprint.scale();
|
||||
|
|
@ -602,7 +602,7 @@ fn mandelbrot(ctx: impl ExtractFootprint + Send) -> ImageFrameTable<Color> {
|
|||
data,
|
||||
..Default::default()
|
||||
};
|
||||
let mut result = ImageFrameTable::default();
|
||||
let mut result = RasterDataTable::default();
|
||||
result.push(Instance {
|
||||
instance: image,
|
||||
transform: DAffine2::from_translation(offset) * DAffine2::from_scale(size),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use bezier_rs::{ManipulatorGroup, Subpath};
|
||||
use glam::{DAffine2, DVec2};
|
||||
use graphene_core::RasterFrame;
|
||||
use graphene_core::RasterDataType;
|
||||
use graphene_core::instances::{Instance, InstanceRef};
|
||||
use graphene_core::vector::misc::BooleanOperation;
|
||||
use graphene_core::vector::style::Fill;
|
||||
|
|
@ -203,7 +203,7 @@ fn flatten_vector_data(graphic_group_table: &GraphicGroupTable) -> VectorDataTab
|
|||
result_table.push(sub_vector_data);
|
||||
}
|
||||
}
|
||||
GraphicElement::RasterFrame(image) => {
|
||||
GraphicElement::RasterDataType(image) => {
|
||||
let make_instance = |transform| {
|
||||
// Convert the image frame into a rectangular subpath with the image's transform
|
||||
let mut subpath = Subpath::new_rect(DVec2::ZERO, DVec2::ONE);
|
||||
|
|
@ -218,12 +218,12 @@ fn flatten_vector_data(graphic_group_table: &GraphicGroupTable) -> VectorDataTab
|
|||
|
||||
// Apply the parent group's transform to each element of raster data
|
||||
match image {
|
||||
RasterFrame::ImageFrame(image) => {
|
||||
RasterDataType::RasterData(image) => {
|
||||
for instance in image.instance_ref_iter() {
|
||||
result_table.push(make_instance(*element.transform * *instance.transform));
|
||||
}
|
||||
}
|
||||
RasterFrame::TextureFrame(image) => {
|
||||
RasterDataType::TextureData(image) => {
|
||||
for instance in image.instance_ref_iter() {
|
||||
result_table.push(make_instance(*element.transform * *instance.transform));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use graphene_core::application_io::{ApplicationIo, ExportFormat, RenderConfig};
|
|||
use graphene_core::instances::Instances;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use graphene_core::raster::bbox::Bbox;
|
||||
use graphene_core::raster::image::{Image, ImageFrameTable};
|
||||
use graphene_core::raster::image::{Image, RasterDataTable};
|
||||
use graphene_core::renderer::RenderMetadata;
|
||||
use graphene_core::renderer::{GraphicElementRendered, RenderParams, RenderSvgSegmentList, SvgRender, format_transform_matrix};
|
||||
use graphene_core::transform::Footprint;
|
||||
|
|
@ -39,7 +39,7 @@ async fn create_surface<'a: 'n>(_: impl Ctx, editor: &'a WasmEditorApi) -> Arc<W
|
|||
// #[cfg(target_arch = "wasm32")]
|
||||
// async fn draw_image_frame(
|
||||
// _: impl Ctx,
|
||||
// image: ImageFrameTable<graphene_core::raster::SRGBA8>,
|
||||
// image: RasterDataTable<graphene_core::raster::SRGBA8>,
|
||||
// surface_handle: Arc<WasmSurfaceHandle>,
|
||||
// ) -> graphene_core::application_io::SurfaceHandleFrame<HtmlCanvasElement> {
|
||||
// let image = image.instance_ref_iter().next().unwrap().instance;
|
||||
|
|
@ -49,9 +49,9 @@ async fn create_surface<'a: 'n>(_: impl Ctx, editor: &'a WasmEditorApi) -> Arc<W
|
|||
// let canvas = &surface_handle.surface;
|
||||
// canvas.set_width(image.image.width);
|
||||
// canvas.set_height(image.image.height);
|
||||
// // TODO: replace "2d" with "bitmaprenderer" once we switch to ImageBitmap (lives on gpu) from ImageData (lives on cpu)
|
||||
// // TODO: replace "2d" with "bitmaprenderer" once we switch to ImageBitmap (lives on gpu) from RasterData (lives on cpu)
|
||||
// let context = canvas.get_context("2d").unwrap().unwrap().dyn_into::<CanvasRenderingContext2d>().unwrap();
|
||||
// let image_data = web_sys::ImageData::new_with_u8_clamped_array_and_sh(array, image.image.width, image.image.height).expect("Failed to construct ImageData");
|
||||
// let image_data = web_sys::ImageData::new_with_u8_clamped_array_and_sh(array, image.image.width, image.image.height).expect("Failed to construct RasterData");
|
||||
// context.put_image_data(&image_data, 0., 0.).unwrap();
|
||||
// }
|
||||
// graphene_core::application_io::SurfaceHandleFrame {
|
||||
|
|
@ -76,9 +76,9 @@ async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")]
|
|||
}
|
||||
|
||||
#[node_macro::node(category("Network"))]
|
||||
fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> ImageFrameTable<Color> {
|
||||
fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> RasterDataTable<Color> {
|
||||
let Some(image) = image::load_from_memory(data.as_ref()).ok() else {
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
};
|
||||
let image = image.to_rgba32f();
|
||||
let image = Image {
|
||||
|
|
@ -91,7 +91,7 @@ fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> ImageFrameTable<Color> {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
ImageFrameTable::new(image)
|
||||
RasterDataTable::new(image)
|
||||
}
|
||||
|
||||
fn render_svg(data: impl GraphicElementRendered, mut render: SvgRender, render_params: RenderParams, footprint: Footprint) -> RenderOutputType {
|
||||
|
|
@ -165,13 +165,13 @@ async fn rasterize<T: WasmNotSend + 'n>(
|
|||
_: impl Ctx,
|
||||
#[implementations(
|
||||
VectorDataTable,
|
||||
ImageFrameTable<Color>,
|
||||
RasterDataTable<Color>,
|
||||
GraphicGroupTable,
|
||||
)]
|
||||
mut data: Instances<T>,
|
||||
footprint: Footprint,
|
||||
surface_handle: Arc<SurfaceHandle<HtmlCanvasElement>>,
|
||||
) -> ImageFrameTable<Color>
|
||||
) -> RasterDataTable<Color>
|
||||
where
|
||||
Instances<T>: GraphicElementRendered,
|
||||
{
|
||||
|
|
@ -179,7 +179,7 @@ where
|
|||
|
||||
if footprint.transform.matrix2.determinant() == 0. {
|
||||
log::trace!("Invalid footprint received for rasterization");
|
||||
return ImageFrameTable::default();
|
||||
return RasterDataTable::default();
|
||||
}
|
||||
|
||||
let mut render = SvgRender::new();
|
||||
|
|
@ -218,7 +218,7 @@ where
|
|||
|
||||
let rasterized = context.get_image_data(0., 0., resolution.x as f64, resolution.y as f64).unwrap();
|
||||
|
||||
let mut result = ImageFrameTable::default();
|
||||
let mut result = RasterDataTable::default();
|
||||
result.push(Instance {
|
||||
instance: Image::from_image_data(&rasterized.data().0, resolution.x as u32, resolution.y as u32),
|
||||
transform: footprint.transform,
|
||||
|
|
@ -234,7 +234,7 @@ async fn render<'a: 'n, T: 'n + GraphicElementRendered + WasmNotSend>(
|
|||
editor_api: impl Node<Context<'static>, Output = &'a WasmEditorApi>,
|
||||
#[implementations(
|
||||
Context -> VectorDataTable,
|
||||
Context -> ImageFrameTable<Color>,
|
||||
Context -> RasterDataTable<Color>,
|
||||
Context -> GraphicGroupTable,
|
||||
Context -> graphene_core::Artboard,
|
||||
Context -> graphene_core::ArtboardGroupTable,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use glam::{DVec2, UVec2};
|
|||
use graph_craft::document::value::RenderOutput;
|
||||
use graph_craft::proto::{NodeConstructor, TypeErasedBox};
|
||||
use graphene_core::raster::color::Color;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::raster::*;
|
||||
use graphene_core::vector::VectorDataTable;
|
||||
use graphene_core::{Artboard, GraphicGroupTable, concrete, generic};
|
||||
|
|
@ -13,7 +13,7 @@ use graphene_core::{fn_type_fut, future};
|
|||
use graphene_std::Context;
|
||||
use graphene_std::GraphicElement;
|
||||
use graphene_std::any::{ComposeTypeErased, DowncastBothNode, DynAnyNode, IntoTypeErasedNode};
|
||||
use graphene_std::application_io::{ImageTexture, TextureFrameTable};
|
||||
use graphene_std::application_io::{ImageTexture, TextureDataTable};
|
||||
use graphene_std::wasm_application_io::*;
|
||||
use node_registry_macros::{async_node, into_node};
|
||||
use once_cell::sync::Lazy;
|
||||
|
|
@ -34,17 +34,17 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
into_node!(from: VectorDataTable, to: GraphicGroupTable),
|
||||
into_node!(from: GraphicGroupTable, to: GraphicGroupTable),
|
||||
into_node!(from: GraphicGroupTable, to: GraphicElement),
|
||||
into_node!(from: ImageFrameTable<Color>, to: ImageFrameTable<Color>),
|
||||
into_node!(from: ImageFrameTable<Color>, to: ImageFrameTable<SRGBA8>),
|
||||
into_node!(from: ImageFrameTable<Color>, to: GraphicElement),
|
||||
into_node!(from: ImageFrameTable<Color>, to: GraphicGroupTable),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => ImageFrameTable<Color>]),
|
||||
into_node!(from: RasterDataTable<Color>, to: RasterDataTable<Color>),
|
||||
into_node!(from: RasterDataTable<Color>, to: RasterDataTable<SRGBA8>),
|
||||
into_node!(from: RasterDataTable<Color>, to: GraphicElement),
|
||||
into_node!(from: RasterDataTable<Color>, to: GraphicGroupTable),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => RasterDataTable<Color>]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => ImageTexture]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => VectorDataTable]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => GraphicGroupTable]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => GraphicElement]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Artboard]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::RasterFrame]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::RasterDataType]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_core::instances::Instances<Artboard>]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => String]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => glam::IVec2]),
|
||||
|
|
@ -70,7 +70,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => Box<graphene_core::vector::VectorModification>]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => Image<Color>]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => VectorDataTable]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => ImageFrameTable<Color>]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => RasterDataTable<Color>]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => GraphicGroupTable]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => Vec<DVec2>]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => Arc<WasmSurfaceHandle>]),
|
||||
|
|
@ -112,9 +112,9 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
#[cfg(feature = "gpu")]
|
||||
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Context, fn_params: [Context => ShaderInputFrame]),
|
||||
#[cfg(feature = "gpu")]
|
||||
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Context, fn_params: [Context => TextureFrameTable]),
|
||||
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Context, fn_params: [Context => TextureDataTable]),
|
||||
#[cfg(feature = "gpu")]
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => TextureFrameTable]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => TextureDataTable]),
|
||||
#[cfg(feature = "gpu")]
|
||||
into_node!(from: &WasmEditorApi, to: &WgpuExecutor),
|
||||
#[cfg(feature = "gpu")]
|
||||
|
|
|
|||
|
|
@ -874,7 +874,7 @@ mod tests {
|
|||
fn test_node_with_implementations() {
|
||||
let attr = quote!(category("Raster: Adjustment"));
|
||||
let input = quote!(
|
||||
fn levels<P: Pixel>(image: ImageFrameTable<P>, #[implementations(f32, f64)] shadows: f64) -> ImageFrameTable<P> {
|
||||
fn levels<P: Pixel>(image: RasterDataTable<P>, #[implementations(f32, f64)] shadows: f64) -> RasterDataTable<P> {
|
||||
// Implementation details...
|
||||
}
|
||||
);
|
||||
|
|
@ -895,10 +895,10 @@ mod tests {
|
|||
where_clause: None,
|
||||
input: Input {
|
||||
pat_ident: pat_ident("image"),
|
||||
ty: parse_quote!(ImageFrameTable<P>),
|
||||
ty: parse_quote!(RasterDataTable<P>),
|
||||
implementations: Punctuated::new(),
|
||||
},
|
||||
output_type: parse_quote!(ImageFrameTable<P>),
|
||||
output_type: parse_quote!(RasterDataTable<P>),
|
||||
is_async: false,
|
||||
fields: vec![ParsedField::Regular {
|
||||
pat_ident: pat_ident("shadows"),
|
||||
|
|
@ -992,7 +992,7 @@ mod tests {
|
|||
fn test_async_node() {
|
||||
let attr = quote!(category("IO"));
|
||||
let input = quote!(
|
||||
async fn load_image(api: &WasmEditorApi, #[expose] path: String) -> ImageFrameTable<Color> {
|
||||
async fn load_image(api: &WasmEditorApi, #[expose] path: String) -> RasterDataTable<Color> {
|
||||
// Implementation details...
|
||||
}
|
||||
);
|
||||
|
|
@ -1016,7 +1016,7 @@ mod tests {
|
|||
ty: parse_quote!(&WasmEditorApi),
|
||||
implementations: Punctuated::new(),
|
||||
},
|
||||
output_type: parse_quote!(ImageFrameTable<Color>),
|
||||
output_type: parse_quote!(RasterDataTable<Color>),
|
||||
is_async: true,
|
||||
fields: vec![ParsedField::Regular {
|
||||
pat_ident: pat_ident("path"),
|
||||
|
|
@ -1132,7 +1132,7 @@ mod tests {
|
|||
fn test_invalid_implementation_syntax() {
|
||||
let attr = quote!(category("Test"));
|
||||
let input = quote!(
|
||||
fn test_node(_: (), #[implementations((Footprint, Color), (Footprint, ImageFrameTable<Color>))] input: impl Node<Footprint, Output = T>) -> T {
|
||||
fn test_node(_: (), #[implementations((Footprint, Color), (Footprint, RasterDataTable<Color>))] input: impl Node<Footprint, Output = T>) -> T {
|
||||
// Implementation details...
|
||||
}
|
||||
);
|
||||
|
|
@ -1158,10 +1158,10 @@ mod tests {
|
|||
#[implementations((), #tuples, Footprint)] footprint: F,
|
||||
#[implementations(
|
||||
() -> Color,
|
||||
() -> ImageFrameTable<Color>,
|
||||
() -> RasterDataTable<Color>,
|
||||
() -> GradientStops,
|
||||
Footprint -> Color,
|
||||
Footprint -> ImageFrameTable<Color>,
|
||||
Footprint -> RasterDataTable<Color>,
|
||||
Footprint -> GradientStops,
|
||||
)]
|
||||
image: impl Node<F, Output = T>,
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ pub use executor::GpuExecutor;
|
|||
use futures::Future;
|
||||
use glam::{DAffine2, UVec2};
|
||||
use gpu_executor::{ComputePassDimensions, GPUConstant, StorageBufferOptions, TextureBufferOptions, TextureBufferType, ToStorageBuffer, ToUniformBuffer};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, ImageTexture, SurfaceHandle, TextureFrameTable};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, ImageTexture, SurfaceHandle, TextureDataTable};
|
||||
use graphene_core::instances::Instance;
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::image::RasterDataTable;
|
||||
use graphene_core::raster::{Image, SRGBA8};
|
||||
use graphene_core::transform::{Footprint, Transform};
|
||||
use graphene_core::{Color, Cow, Ctx, ExtractFootprint, Node, SurfaceFrame, Type};
|
||||
|
|
@ -911,8 +911,8 @@ async fn render_texture<'a: 'n>(
|
|||
}
|
||||
|
||||
#[node_macro::node(category(""))]
|
||||
async fn upload_texture<'a: 'n>(_: impl ExtractFootprint + Ctx, input: ImageFrameTable<Color>, executor: &'a WgpuExecutor) -> TextureFrameTable {
|
||||
let mut result_table = TextureFrameTable::default();
|
||||
async fn upload_texture<'a: 'n>(_: impl ExtractFootprint + Ctx, input: RasterDataTable<Color>, executor: &'a WgpuExecutor) -> TextureDataTable {
|
||||
let mut result_table = TextureDataTable::default();
|
||||
|
||||
for instance in input.instance_ref_iter() {
|
||||
let image = instance.instance;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue