New node: Rasterize (#1755)

* Add RasterizeVector node

* Add document node definition for RasterizeVectorNode

* Add dummy node properties

* Add prototype of footprint widget

* Fix types

* Fix footprint widget to use document space

* Fix aspect ratio issues by making resolution a multiplier

* Fix rebase errors

* Fix rasterization bounds and node definition

* UI and bug fixes but still issues with scaling in the frame

* Rename node to Raster

* Fix RasterizeNode

* Reenable resolution multiplier

* Remove unused variable

* UI fixes

* Fix Footprint default and resolution updates

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2024-06-27 10:24:09 +02:00
committed by GitHub
parent cf496668fb
commit c9a33e44bd
7 changed files with 330 additions and 44 deletions

View File

@@ -155,11 +155,14 @@ impl Default for SvgRender {
}
}
#[derive(Default)]
pub enum ImageRenderMode {
#[default]
Base64,
}
/// Static state used whilst rendering
#[derive(Default)]
pub struct RenderParams {
pub view_mode: crate::vector::style::ViewMode,
pub image_render_mode: ImageRenderMode,

View File

@@ -200,6 +200,16 @@ impl Footprint {
let end = inverse.transform_point2(self.resolution.as_dvec2());
AxisAlignedBbox { start, end }
}
pub fn scale(&self) -> DVec2 {
let x = self.transform.transform_vector2((1., 0.).into()).length();
let y = self.transform.transform_vector2((0., 1.).into()).length();
DVec2::new(x, y)
}
pub fn offset(&self) -> DVec2 {
self.transform.transform_point2(DVec2::ZERO)
}
}
#[derive(Debug, Clone, Copy)]