pub struct GraphExport { /* private fields */ }Expand description
A graph ready to export: an owned copy of what the editor draws,
kept as long as needed (an agent’s graph.export reads the copy the
editor kept at its last frame).
Implementations§
Source§impl GraphExport
impl GraphExport
Sourcepub fn capture(
ctx: &Context,
model: &dyn GraphModel,
state: &GraphState,
) -> GraphExport
pub fn capture( ctx: &Context, model: &dyn GraphModel, state: &GraphState, ) -> GraphExport
A model with an editor’s state (the wire style and node width it drew last), in a context’s theme.
Sourcepub fn with_theme(
model: &dyn GraphModel,
state: &GraphState,
theme: ExportTheme,
) -> GraphExport
pub fn with_theme( model: &dyn GraphModel, state: &GraphState, theme: ExportTheme, ) -> GraphExport
A model with an editor’s state, in a theme of the caller’s (a
light export of a dark interface, a test’s fixed colours). Its
text is drawn in egui’s bundled faces unless GraphExport::faces
gives others.
Sourcepub fn wires(self, style: WireStyle) -> Self
pub fn wires(self, style: WireStyle) -> Self
How wires are drawn (by default the style the editor drew last).
Sourcepub fn node_width(self, width: f32) -> Self
pub fn node_width(self, width: f32) -> Self
A node’s width in graph units (by default the editor’s last).
Sourcepub fn faces(self, faces: Vec<InstalledFace>) -> Self
pub fn faces(self, faces: Vec<InstalledFace>) -> Self
The faces the PNG and PDF exports draw text with, in order (the
first found for a family wins, the others fill in missing
characters); by default the theme’s installed faces
(fonts::installed_faces) when captured from a context. egui’s
bundled faces always come after them, so text never vanishes.
The SVG names the theme’s families and leaves fonts to its reader.
Sourcepub fn theme(&self) -> &ExportTheme
pub fn theme(&self) -> &ExportTheme
The theme it is drawn in.
Sourcepub fn svg(&self, options: &ExportOptions) -> String
pub fn svg(&self, options: &ExportOptions) -> String
The graph as an SVG document, in graph units (a point at 100 %
is one unit): <svg> with a viewBox around what is drawn and
the margin. Every node is a <g data-node="id">, every wire a
<path data-edge="node.port->node.port">, every group frame a
<g data-group="id">, every stack a <g data-stack="id">.
Sourcepub fn png(
&self,
options: &ExportOptions,
scale: f32,
) -> Result<Vec<u8>, ExportError>
pub fn png( &self, options: &ExportOptions, scale: f32, ) -> Result<Vec<u8>, ExportError>
The graph as a PNG image (feature graph-png): GraphExport::svg
rendered by resvg at scale pixels per graph unit (1 for a point
at 100 %, 2 for a high density screen), its text in
GraphExport::faces then egui’s bundled faces. Transparent
without the background. The same graph, options and scale give
the same bytes.
Sourcepub fn pdf(&self, options: &ExportOptions) -> Result<Vec<u8>, ExportError>
pub fn pdf(&self, options: &ExportOptions) -> Result<Vec<u8>, ExportError>
The graph as a one-page PDF (feature graph-pdf):
GraphExport::svg converted by svg2pdf, a graph unit a PDF
point, its text kept as text in GraphExport::faces then
egui’s bundled faces, each embedded as a subset. The metadata is
fixed (the title, egui-pop as producer, no date), and the
objects are written in a canonical order, so the same graph and
options give the same bytes.
Trait Implementations§
Source§impl Clone for GraphExport
impl Clone for GraphExport
Source§fn clone(&self) -> GraphExport
fn clone(&self) -> GraphExport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphExport
impl Debug for GraphExport
Source§impl PartialEq for GraphExport
impl PartialEq for GraphExport
impl StructuralPartialEq for GraphExport
Auto Trait Implementations§
impl Freeze for GraphExport
impl !RefUnwindSafe for GraphExport
impl Send for GraphExport
impl Sync for GraphExport
impl Unpin for GraphExport
impl UnsafeUnpin for GraphExport
impl !UnwindSafe for GraphExport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.