[−][src]Struct artano::Canvas
Methods
impl Canvas
[src]
pub fn read_from_buffer(buf: &[u8]) -> Result<Canvas>
[src]
Creates a new canvas based on a buffer of bytes.
A canvas consists of both a base layer and an upscaled annotation layer (at 3x the original resolution? Depends on how we count that, I guess...). Text is rendered first at this upscaled size and then downsampled onto the background.
pub fn add_annotation<'a>(
&mut self,
annotation: &Annotation,
font: &Font<'a>,
scale_multiplier: f32
)
[src]
&mut self,
annotation: &Annotation,
font: &Font<'a>,
scale_multiplier: f32
)
Adds an annotation to the canvas.
This renders the annotation to the upscaled layer of the canvas that will eventually be overlaid onto the canvas proper. Text is laid out and drawn at this stage, meaning each annotation is individually rendered.
pub fn render(&mut self)
[src]
Produces the final rendering of the canvas.
This rendering step applies the upscaled overlay to the base canvas, thereby adding the desired text to the image proper. This is done via resizing and then overlaying. It's not rocket surgery; the whole process is three lines of code.
I've added this documentation just as a reminder of what's actually going on here.
pub fn save_jpg<W: Write>(&self, stream: &mut W) -> Result<()>
[src]
pub fn save_png<W: Write>(&self, stream: &mut W) -> Result<()>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<Src, Dst> ValueInto for Src where
Dst: ValueFrom<Src>,
[src]
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
[src]
impl<Src, Scheme> ApproxFrom for Src where
Scheme: ApproxScheme,
[src]
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
[src]
impl<Src> ValueFrom for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
[src]
impl<Dst, Src, Scheme> ApproxInto for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
[src]
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
[src]
impl<T, Dst> ConvAsUtil for T
[src]
fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
Approximate the subject with the default scheme.
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
Approximate the subject with a specific scheme.
impl<T> ConvUtil for T
[src]
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
Approximate the subject to a given type with a specific scheme.
fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
[src]
Self: Into<Dst>,
Convert the subject to a given type.
fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
[src]
Self: TryInto<Dst>,
Attempt to convert the subject to a given type.
fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
[src]
Self: ValueInto<Dst>,
Attempt a value conversion of the subject to a given type.
impl<Src> TryFrom for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
[src]
impl<Src, Dst> TryInto for Src where
Dst: TryFrom<Src>,
[src]
Dst: TryFrom<Src>,