( &mut self, document: &DocumentMessageHandler, document_id: DocumentId, transform: DAffine2, pointer: DVec2, viewport_resolution: UVec2, viewport_scale: f64, time: TimingInformation,
| 232 | |
| 233 | #[allow(clippy::too_many_arguments)] |
| 234 | pub(crate) fn submit_eyedropper_preview( |
| 235 | &mut self, |
| 236 | document: &DocumentMessageHandler, |
| 237 | document_id: DocumentId, |
| 238 | transform: DAffine2, |
| 239 | pointer: DVec2, |
| 240 | viewport_resolution: UVec2, |
| 241 | viewport_scale: f64, |
| 242 | time: TimingInformation, |
| 243 | ) -> Result<Message, String> { |
| 244 | let viewport = Footprint { |
| 245 | transform, |
| 246 | resolution: viewport_resolution, |
| 247 | ..Default::default() |
| 248 | }; |
| 249 | |
| 250 | // TODO: On desktop, SVG Preview mode cannot work with the Eyedropper tool until <https://github.com/GraphiteEditor/Graphite/issues/3796> is implemented. |
| 251 | // TODO: So for now, we fall back to the Eyedropper using Normal mode (Vello) rendering, which looks similar enough to SVG Preview. |
| 252 | #[cfg(not(target_family = "wasm"))] |
| 253 | let render_mode = match document.render_mode { |
| 254 | graphene_std::vector::style::RenderMode::SvgPreview => graphene_std::vector::style::RenderMode::Normal, |
| 255 | other => other, |
| 256 | }; |
| 257 | // On web, SVG Preview is handled by the frontend's SVG rasterization path instead, producing the correct result, so we keep it enabled. |
| 258 | #[cfg(target_family = "wasm")] |
| 259 | let render_mode = document.render_mode; |
| 260 | |
| 261 | let render_config = RenderConfig { |
| 262 | viewport, |
| 263 | scale: viewport_scale, |
| 264 | time, |
| 265 | pointer, |
| 266 | export_format: graphene_std::application_io::ExportFormat::Raster, |
| 267 | render_mode, |
| 268 | for_export: false, |
| 269 | for_eyedropper: true, |
| 270 | }; |
| 271 | |
| 272 | // Execute the node graph |
| 273 | let execution_id = self.queue_execution(render_config); |
| 274 | |
| 275 | self.futures.push_back(( |
| 276 | execution_id, |
| 277 | ExecutionContext { |
| 278 | export_config: None, |
| 279 | document_id, |
| 280 | measure_fill: None, |
| 281 | }, |
| 282 | )); |
| 283 | |
| 284 | Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into()) |
| 285 | } |
| 286 | |
| 287 | /// Evaluates a node graph for export |
| 288 | pub fn submit_document_export(&mut self, document: &mut DocumentMessageHandler, document_id: DocumentId, mut export_config: ExportConfig) -> Result<(), String> { |
no test coverage detected