Skip to main content

DrawCommand

Enum DrawCommand 

Source
pub enum DrawCommand {
    None,
    Rect {
        background: Option<Color>,
        border_width: Edges,
        border_color: EdgeValues<Color>,
        border_radius: CornerValues,
        opacity: f64,
    },
    Text {
        lines: Vec<TextLine>,
        color: Color,
        text_decoration: TextDecoration,
        opacity: f64,
    },
    Image {
        image_data: LoadedImage,
    },
    ImagePlaceholder,
    Svg {
        commands: Vec<SvgCommand>,
        width: f64,
        height: f64,
        clip: bool,
    },
    Barcode {
        bars: Vec<u8>,
        bar_width: f64,
        height: f64,
        color: Color,
    },
    QrCode {
        modules: Vec<Vec<bool>>,
        module_size: f64,
        color: Color,
    },
    Chart {
        primitives: Vec<ChartPrimitive>,
    },
    Watermark {
        lines: Vec<TextLine>,
        color: Color,
        opacity: f64,
        angle_rad: f64,
        font_family: String,
    },
}
Expand description

What to actually draw for this element.

Variants§

§

None

Nothing to draw (just a layout container).

§

Rect

Draw a rectangle (background, border).

Fields

§background: Option<Color>
§border_width: Edges
§border_color: EdgeValues<Color>
§border_radius: CornerValues
§opacity: f64
§

Text

Draw text.

Fields

§lines: Vec<TextLine>
§color: Color
§text_decoration: TextDecoration
§opacity: f64
§

Image

Draw an image.

Fields

§image_data: LoadedImage
§

ImagePlaceholder

Draw a grey placeholder rectangle (fallback when image loading fails).

§

Svg

Draw SVG vector graphics.

Fields

§commands: Vec<SvgCommand>
§width: f64
§height: f64
§clip: bool

When true, clip content to [0, 0, width, height] (used by Canvas).

§

Barcode

Draw a 1D barcode as filled rectangles.

Fields

§bars: Vec<u8>
§bar_width: f64
§height: f64
§color: Color
§

QrCode

Draw a QR code as filled rectangles.

Fields

§modules: Vec<Vec<bool>>
§module_size: f64
§color: Color
§

Chart

Draw a chart as a list of drawing primitives.

Fields

§primitives: Vec<ChartPrimitive>
§

Watermark

Draw a watermark (rotated text with opacity).

Fields

§lines: Vec<TextLine>
§color: Color
§opacity: f64
§angle_rad: f64
§font_family: String

Font family used (for PDF font registration).

Trait Implementations§

Source§

impl Clone for DrawCommand

Source§

fn clone(&self) -> DrawCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DrawCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.