mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
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:
@@ -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,
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user