Struct leechbar::Image[][src]

pub struct Image { /* fields omitted */ }

A cached image.

This creates an image that is cached on the X server. Keeping this around instead of moving it will usually lead to a lower CPU consumption but slightly increase the memory usage of the X server.

Methods

impl Image
[src]

Create a new image from a DynamicImage.

Examples

extern crate image;
use leechbar::{Image, BarBuilder};

// Create the bar
let bar = BarBuilder::new().spawn().unwrap();

// Load the image from disk
let img = image::open("my_image2").unwrap();

// Convert it to an X.Org image
let ximg = Image::new(&bar, &img).unwrap();

Set the alignment of the image.

This aligns the image inside the complete component and allows for having different alignments with different images layered in a single background.

Default: Alignment::CENTER

extern crate image;
use leechbar::{Image, BarBuilder, Alignment};

// Create the bar
let bar = BarBuilder::new().spawn().unwrap();

// Load the image from disk
let img = image::open("my_image2").unwrap();

// Convert it to an X.Org image
let ximg = Image::new(&bar, &img).unwrap();

// Set the alignment
let ximg = ximg.alignment(Alignment::LEFT);

Trait Implementations

impl From<Image> for Background
[src]

Performs the conversion.

impl Clone for Image
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Image

impl Sync for Image