Instance table refactor part 6: remove usage of one_instance_* functions (#2672)

* Refactor the spline node

* Refactor the jitter_points node

* Refactor the morph node

* Refactor the merge_by_distance node

* Refactor the area node

* Refactor the centroid node

* Refactor the bevel node

* Refactor the tests

* Code review

* Refactor the morph node

* Refactor the extend_image_to_bounds and sample_image node

* Refactor the dehaze node

* Refactor the blur node

* Refactor the vector_points node

* Refactor the blit node

* Refactor the blend_gpu_image node

* Refactor the path_modify node

* Refactor the image_color_palette

* Fix copy_to_points

* Code review

* Partially make progress toward fixing the Draw Canvas node

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mTvare
2025-05-29 15:38:16 +05:30
committed by GitHub
parent fbefa5b827
commit 4d2e1d57fd
14 changed files with 640 additions and 588 deletions

View File

@@ -2,7 +2,7 @@ use super::Color;
use super::discrete_srgb::float_to_srgb_u8;
use crate::AlphaBlending;
use crate::GraphicElement;
use crate::instances::Instances;
use crate::instances::{Instance, Instances};
use crate::transform::TransformMut;
use alloc::vec::Vec;
use core::hash::{Hash, Hasher};
@@ -393,6 +393,23 @@ 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>::empty();
for image_frame_instance in image_frame_table.instance_iter() {
result_table.push(Instance {
instance: image_frame_instance.instance.into(),
transform: image_frame_instance.transform,
alpha_blending: image_frame_instance.alpha_blending,
source_node_id: image_frame_instance.source_node_id,
});
}
result_table
}
}
impl From<Image<SRGBA8>> for Image<Color> {
fn from(image: Image<SRGBA8>) -> Self {
let data = image.data.into_iter().map(|x| x.into()).collect();