A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.rs/embedded-graphics/latest/embedded_graphics/image/struct.Image.html below:

Image in embedded_graphics::image - Rust

pub struct Image<'a, T> {  }
Expand description Source§ Source§ Source§ Source§ Source§ Source§

Writes the defmt representation of self to fmt.

Source§ Source§

Translate the image by a given delta, returning a new image

§Examples §Move an image around

This examples moves a 4x4 black and white image by (10, 20) pixels without mutating the original image

use embedded_graphics::{
    geometry::Point,
    image::{Image, ImageRaw},
    pixelcolor::BinaryColor,
    prelude::*,
};

let image: ImageRaw<BinaryColor> = ImageRaw::new(&[0xff, 0x00, 0xff, 0x00], 4);

let image = Image::new(&image, Point::zero());

let image_moved = image.translate(Point::new(10, 20));

assert_eq!(image.bounding_box().top_left, Point::zero());
assert_eq!(image_moved.bounding_box().top_left, Point::new(10, 20));
Source§

Translate the image by a given delta, modifying the original object

§Examples §Move an image around

This examples moves a 4x4 black and white image by (10, 20) pixels by mutating the original image

use embedded_graphics::{
    geometry::Point,
    image::{Image, ImageRaw},
    pixelcolor::BinaryColor,
    prelude::*,
};

let image: ImageRaw<BinaryColor> = ImageRaw::new(&[0xff, 0x00, 0xff, 0x00], 4);

let mut image = Image::new(&image, Point::zero());

image.translate_mut(Point::new(10, 20));

assert_eq!(image.bounding_box().top_left, Point::new(10, 20));
Source§

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4