Skip to main content

DgFrame

Struct DgFrame 

Source
pub struct DgFrame<'a> {
    pub vp: Viewport,
    pub clip: [f32; 4],
    pub geo: &'a DgGeo,
    pub theme: &'a [u32],
    pub bg: u32,
    pub fonts: [(u32, i32); 7],
    pub dark: bool,
    pub moving: bool,
}
Expand description

what a DgPaint gets at render time

Fields§

§vp: Viewport§clip: [f32; 4]

the world rectangle x0, y0, x1, y1 that needs pixels now: skip what lies outside

§geo: &'a DgGeo§theme: &'a [u32]

the theme’s colours (color(T_*)), the canvas background (opaque)

§bg: u32§fonts: [(u32, i32); 7]

font and size (24.8 px at zoom 1) of every TS_* text style

§dark: bool§moving: bool

a gesture moves the view or nodes (a pan, wheel turns, a drag of nodes or a waypoint): leave out what costs and nobody reads in passing (small labels; plain shapes, dg_hairline); the canvas is painted in full after it

Implementations§

Source§

impl DgFrame<'_>

Source

pub fn color(&self, tok: u32) -> u32

0xAARRGGBB of a theme token

Source

pub fn visible(&self, r: [f32; 4]) -> bool

the world rectangle x, y, w, h (with 2 px for anti-aliasing) touches the clip

Source

pub fn route_visible(&self, rt: &DgRoute, width: f32) -> bool

a route stroked width world units wide (dg_stroke_edge, arrow heads included) touches the clip

Source

pub fn find(&self, margin: f32, edges: bool) -> Vec<u32>

the nodes (edges = false: DModel::nodes) or the edges whose spatial buckets touch the clip grown by margin px: ascending indices, a superset of what can need paint (cheaper than looking at all of them)

Source

pub fn font(&self, ts: u32) -> (u32, i32)

font and size (24.8 px) of text style ts at the current zoom

Auto Trait Implementations§

§

impl<'a> Forget for DgFrame<'a>

§

impl<'a> Freeze for DgFrame<'a>

§

impl<'a> RefUnwindSafe for DgFrame<'a>

§

impl<'a> Send for DgFrame<'a>

§

impl<'a> Sync for DgFrame<'a>

§

impl<'a> Unpin for DgFrame<'a>

§

impl<'a> UnsafeUnpin for DgFrame<'a>

§

impl<'a> UnwindSafe for DgFrame<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.