[−][src]Trait embedded_graphics::transform::Transform
Transform operations
Required methods
fn translate(&self, by: Coord) -> Self
Move the origin of an object by a given number of (x, y) pixels, returning a new object
fn translate_mut(&mut self, by: Coord) -> &mut Self
Move the origin of an object by a given number of (x, y) pixels, mutating the object in place
Implementors
impl<'a, C, Conf> Transform for FontBuilder<'a, C, Conf> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
Translate the image from its current position to a new position by (x, y) pixels, returning
a new Font8x16
. For a mutating transform, see translate_mut
.
// 8px x 1px test image let text = Font8x16::render_str("Hello world") let moved = text.translate(Coord::new(25, 30)); assert_eq!(text.pos, Coord::new(0, 0)); assert_eq!(moved.pos, Coord::new(25, 30));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the font origin from its current position to a new position by (x, y) pixels.
// 8px x 1px test image let mut text = Font8x16::render_str("Hello world") text.translate_mut(Coord::new(25, 30)); assert_eq!(text.pos, Coord::new(25, 30));
impl<'a, C, T> Transform for Image<'a, C, T> where
C: PixelColor,
T: ImageType,
[src]
C: PixelColor,
T: ImageType,
fn translate(&self, by: Coord) -> Self
[src]
Translate the image from its current position to a new position by (x, y) pixels, returning
a new Image
. For a mutating transform, see translate_mut
.
// 8px x 1px test image let image: Image1BPP<u8> = Image1BPP::new(&[ 0xff ], 8, 1); let moved = image.translate(Coord::new(25, 30)); assert_eq!(image.offset, Coord::new(0, 0)); assert_eq!(moved.offset, Coord::new(25, 30));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the image from its current position to a new position by (x, y) pixels.
let mut image: Image1BPP<u8> = Image1BPP::new(&[ 0xff ], 8, 1); image.translate_mut(Coord::new(25, 30)); assert_eq!(image.offset, Coord::new(25, 30));
impl<C> Transform for Circle<C> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
Translate the circle center from its current position to a new position by (x, y) pixels,
returning a new Circle
. For a mutating transform, see translate_mut
.
let circle = Circle::new(Coord::new(5, 10), 10) let moved = circle.translate(Coord::new(10, 10)); assert_eq!(moved.center, Coord::new(15, 20));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the circle center from its current position to a new position by (x, y) pixels.
let mut circle = Circle::new(Coord::new(5, 10), 10) circle.translate_mut(Coord::new(10, 10)); assert_eq!(circle.center, Coord::new(15, 20));
impl<C> Transform for Line<C> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
Translate the line from its current position to a new position by (x, y) pixels, returning
a new Line
. For a mutating transform, see translate_mut
.
let line = Line::new(Coord::new(5, 10), Coord::new(15, 20)) let moved = line.translate(Coord::new(10, 10)); assert_eq!(moved.start, Coord::new(15, 20)); assert_eq!(moved.end, Coord::new(25, 30));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the line from its current position to a new position by (x, y) pixels.
let mut line = Line::new(Coord::new(5, 10), Coord::new(15, 20)) line.translate_mut(Coord::new(10, 10)); assert_eq!(line.start, Coord::new(15, 20)); assert_eq!(line.end, Coord::new(25, 30));
impl<C> Transform for Rectangle<C> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
Translate the rect from its current position to a new position by (x, y) pixels, returning
a new Rectangle
. For a mutating transform, see translate_mut
.
let rect = Rectangle::new(Coord::new(5, 10), Coord::new(15, 20)) let moved = rect.translate(Coord::new(10, 10)); assert_eq!(moved.top_left, Coord::new(15, 20)); assert_eq!(moved.bottom_right, Coord::new(25, 30));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the rect from its current position to a new position by (x, y) pixels.
let mut rect = Rectangle::new(Coord::new(5, 10), Coord::new(15, 20)) rect.translate_mut(Coord::new(10, 10)); assert_eq!(rect.top_left, Coord::new(15, 20)); assert_eq!(rect.bottom_right, Coord::new(25, 30));
impl<C> Transform for Triangle<C> where
C: PixelColor,
[src]
C: PixelColor,
fn translate(&self, by: Coord) -> Self
[src]
Translate the triangle from its current position to a new position by (x, y) pixels,
returning a new Triangle
. For a mutating transform, see translate_mut
.
let tri = Triangle::new(Coord::new(5, 10), Coord::new(15, 20), Coord::new(8, 15)) let moved = tri.translate(Coord::new(10, 10)); assert_eq!(moved.p1, Coord::new(15, 20)); assert_eq!(moved.p2, Coord::new(25, 30)); assert_eq!(moved.p3, Coord::new(18, 25));
fn translate_mut(&mut self, by: Coord) -> &mut Self
[src]
Translate the triangle from its current position to a new position by (x, y) pixels.
let mut tri = Triangle::new(Coord::new(5, 10), Coord::new(15, 20), Coord::new(10, 15)) tri.translate_mut(Coord::new(10, 10)); assert_eq!(tri.p1, Coord::new(15, 20)); assert_eq!(tri.p2, Coord::new(25, 30)); assert_eq!(tri.p3, Coord::new(20, 25));