Struct ytesrev::latex::latex_obj::LatexObj [−][src]
pub struct LatexObj { pub inner: Option<PngImage>, pub expr: &'static str, pub is_text: bool, // some fields omitted }
Represents a LaTeX expression. When loaded, this will create a PNG of the expression and load it.
Fields
inner: Option<PngImage>
The rendered document
expr: &'static str
The LaTeX expression that will be rendered
is_text: bool
A LaTeX expression can either be text or math, with math being surrounded by dollar sings
Methods
impl LatexObj
[src]
impl LatexObj
pub fn math(expr: &'static str) -> LatexObj
[src]
pub fn math(expr: &'static str) -> LatexObj
Create a LaTeX object containing math
use ytesrev::latex::LatexObj; let e_mc2 = LatexObj::math("E = mc^2"); assert!(!e_mc2.is_text); assert_eq!(e_mc2.expr, "E = mc^2");
pub fn text(expr: &'static str) -> LatexObj
[src]
pub fn text(expr: &'static str) -> LatexObj
Create a LaTeX object containing text
use ytesrev::latex::LatexObj; let lorem = LatexObj::text("Lorem Ipsum"); assert!(lorem.is_text); assert_eq!(lorem.expr, "Lorem Ipsum");
Trait Implementations
impl KnownSize for LatexObj
[src]
impl KnownSize for LatexObj
fn width(&self) -> usize
[src]
fn width(&self) -> usize
The width of the object
fn height(&self) -> usize
[src]
fn height(&self) -> usize
The height of the object
impl ImageContainer for LatexObj
[src]
impl ImageContainer for LatexObj
fn get_data(&self) -> &Vec<u8>
[src]
fn get_data(&self) -> &Vec<u8>
Retrieve the data in the image
fn get_data_mut(&mut self) -> &mut Vec<u8>
[src]
fn get_data_mut(&mut self) -> &mut Vec<u8>
Retrieve the data in the image, mutably
fn into_data(self) -> Vec<u8>
[src]
fn into_data(self) -> Vec<u8>
Retrieve the data in the image, consuming the object
fn as_knownsize(&self) -> &KnownSize
[src]
fn as_knownsize(&self) -> &KnownSize
Convert the object to a dynamic KnownSize object, as rust doesn't support calling KnownSize -methods directly on this object Read more
impl Drawable for LatexObj
[src]
impl Drawable for LatexObj
fn content(&self) -> Vec<&Drawable>
[src]
fn content(&self) -> Vec<&Drawable>
What this object contains
fn content_mut(&mut self) -> Vec<&mut Drawable>
[src]
fn content_mut(&mut self) -> Vec<&mut Drawable>
What this object contains, mutably
fn draw(
&self,
canvas: &mut Canvas<Window>,
position: &Position,
settings: DrawSettings
)
[src]
fn draw(
&self,
canvas: &mut Canvas<Window>,
position: &Position,
settings: DrawSettings
)
Draw everything
fn register(&mut self)
[src]
fn register(&mut self)
Register all content. This is mostly just used by [LatexObj
]s, that need to be registered before loaded. Read more
fn load(&mut self)
[src]
fn load(&mut self)
Load all content
fn step(&mut self)
[src]
fn step(&mut self)
When the user presses space, the state of the presentation is advanced. This method is what is called. Read more
fn state(&self) -> State
[src]
fn state(&self) -> State
What state the object is in
fn event(&mut self, e: Event)
[src]
fn event(&mut self, e: Event)
When any event occurs
fn update(&mut self, dt: f64)
[src]
fn update(&mut self, dt: f64)
Tick the object