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]
impl Image
pub fn new(bar: &Bar, image: &DynamicImage) -> Result<Self, Error>
[src]
pub fn new(bar: &Bar, image: &DynamicImage) -> Result<Self, Error>
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();
pub fn alignment(self, alignment: Alignment) -> Self
[src]
pub fn alignment(self, alignment: Alignment) -> Self
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]
impl From<Image> for Background
fn from(image: Image) -> Background
[src]
fn from(image: Image) -> Background
Performs the conversion.
impl Clone for Image
[src]
impl Clone for Image