Thumbnails for the layer node (#1210)

* Thumbnails for the layer node

* Raster node graph frames

* Downscale to a random resolution

* Cleanup and bug fixes

* Generate paths before duplicating outputs

* Fix stable id test

* Code review changes

* Code review pass with minor changes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-05-18 05:12:50 +01:00
committed by GitHub
parent d76bd36447
commit 88c4713e75
24 changed files with 609 additions and 131 deletions

View File

@@ -37,7 +37,7 @@ mod base64_serde {
}
}
#[derive(Clone, Debug, PartialEq, Default, specta::Type)]
#[derive(Clone, PartialEq, Default, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Image<P: Pixel> {
pub width: u32,
@@ -46,6 +46,17 @@ pub struct Image<P: Pixel> {
pub data: Vec<P>,
}
impl<P: Pixel + Debug> Debug for Image<P> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let length = self.data.len();
f.debug_struct("Image")
.field("width", &self.width)
.field("height", &self.height)
.field("data", if length < 100 { &self.data } else { &length })
.finish()
}
}
unsafe impl<P: StaticTypeSized + Pixel> StaticType for Image<P>
where
P::Static: Pixel,