Skip to main content

Paint

Enum Paint 

Source
pub enum Paint {
    Panel {
        bounds: Bounds,
        radius: u8,
        fill: Option<Rgb>,
        border: Option<Rgb>,
        shadow: bool,
        dashed: bool,
    },
    Wash {
        bounds: Bounds,
        radius: u8,
        color: Rgb,
        alpha: u8,
        border: Option<Rgb>,
    },
    Hairline {
        bounds: Bounds,
        color: Rgb,
    },
    Text {
        x: i32,
        y: i32,
        max_width: i32,
        text: String,
        color: Rgb,
        font: Font,
        align_right: bool,
        centred: bool,
        underline: bool,
    },
    Icon {
        bounds: Bounds,
        icon: Icon,
        color: Rgb,
    },
    Corners {
        bounds: Bounds,
        radius: u8,
        color: Rgb,
        which: u8,
    },
    Strips {
        bounds: Bounds,
        strips: Vec<Strip>,
    },
    Image {
        bounds: Bounds,
        clip: Bounds,
        bitmap: Bitmap,
        color: Rgb,
    },
}

Variants§

§

Panel

Fields

§bounds: Bounds
§radius: u8

As a percentage of a row’s height.

§fill: Option<Rgb>
§border: Option<Rgb>
§shadow: bool
§dashed: bool

The border in dashes.

§

Wash

A see-through wash with round corners over what’s already drawn, text included, and a border twice a panel’s weight: where something dragged would land.

Fields

§bounds: Bounds
§radius: u8

As a percentage of a row’s height.

§color: Rgb
§alpha: u8

Out of 255.

§border: Option<Rgb>
§

Hairline

A line one device pixel thick, along the top or left of bounds.

Fields

§bounds: Bounds
§color: Rgb
§

Text

Fields

§y: i32

The row it’s centred on, in paint units.

§max_width: i32
§text: String
§color: Rgb
§font: Font
§align_right: bool

x is the right edge rather than the left.

§centred: bool

x is the middle of the text. Only the rasterizer knows a text’s true width.

§underline: bool

Drawn under the text at its true width.

§

Icon

Fields

§bounds: Bounds
§icon: Icon
§color: Rgb
§

Corners

Fills the listed corners of bounds back in. Cells can’t be rounded and paint can’t go under text, so a rounded surface is cells with its corners painted out.

Fields

§bounds: Bounds
§radius: u8

As a percentage of a row’s height.

§color: Rgb
§which: u8
§

Strips

A row’s share of a minimap: many small bars, which as panels would be slow.

Fields

§bounds: Bounds
§strips: Vec<Strip>
§

Image

A bitmap scaled to bounds. Coverage is inked in color.

Fields

§bounds: Bounds
§clip: Bounds

What it stays inside, since a page scrolls past its pictures.

§bitmap: Bitmap
§color: Rgb

Implementations§

Source§

impl Paint

Source

pub fn lift(&mut self, by: i32)

Moves it up by by paint units.

Source

pub fn reach(&self) -> (i32, i32)

Paint units of the columns this can touch, as (left, right). It may overstate them: that costs a tile, where understating would leave stale pixels.

Source

pub fn on_row(&self, top: i32) -> Self

This as seen from a row starting at top. What’s drawn in a row depends on this and not on where the row stands, so a row that scrolls keeps its tile.

Trait Implementations§

Source§

impl Clone for Paint

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Paint

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Paint

Source§

impl Hash for Paint

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Paint

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Paint

Auto Trait Implementations§

§

impl Forget for Paint

§

impl Freeze for Paint

§

impl Move for Paint

§

impl RefUnwindSafe for Paint

§

impl Send for Paint

§

impl Sync for Paint

§

impl Unpin for Paint

§

impl UnsafeUnpin for Paint

§

impl UnwindSafe for Paint

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 = !

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.