aboutsummaryrefslogtreecommitdiff
path: root/src/element/image.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/element/image.rs')
-rw-r--r--src/element/image.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/element/image.rs b/src/element/image.rs
index 12f3f30..dbddb19 100644
--- a/src/element/image.rs
+++ b/src/element/image.rs
@@ -2,10 +2,15 @@
use image::{DynamicImage, GenericImageView};
use super::{Drawable, PointCollection};
-use crate::drawing::backend::{BackendCoord, DrawingBackend, DrawingErrorKind};
-use crate::drawing::bitmap_pixel::{PixelFormat, RGBPixel};
+use plotters_backend::{BackendCoord, DrawingBackend, DrawingErrorKind};
+
+use plotters_bitmap::bitmap_pixel::{PixelFormat, RGBPixel};
+
+#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
+use plotters_bitmap::bitmap_pixel::BGRXPixel;
+
+use plotters_bitmap::BitMapBackend;
-use crate::drawing::BitMapBackend;
use std::borrow::Borrow;
use std::marker::PhantomData;
@@ -174,9 +179,7 @@ impl<'a, Coord> From<(Coord, DynamicImage)> for BitMapElement<'a, Coord, RGBPixe
}
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
-impl<'a, Coord> From<(Coord, DynamicImage)>
- for BitMapElement<'a, Coord, crate::drawing::bitmap_pixel::BGRXPixel>
-{
+impl<'a, Coord> From<(Coord, DynamicImage)> for BitMapElement<'a, Coord, BGRXPixel> {
fn from((pos, image): (Coord, DynamicImage)) -> Self {
let (w, h) = image.dimensions();
let rgb_image = image.to_bgra().into_raw();
@@ -190,7 +193,7 @@ impl<'a, Coord> From<(Coord, DynamicImage)>
}
impl<'a, 'b, Coord> PointCollection<'a, Coord> for &'a BitMapElement<'b, Coord> {
- type Borrow = &'a Coord;
+ type Point = &'a Coord;
type IntoIter = std::iter::Once<&'a Coord>;
fn point_iter(self) -> Self::IntoIter {
std::iter::once(&self.pos)