Skip to content

Commit ba2315c

Browse files
committed
Re-export backend types closes #377
1 parent e84df9d commit ba2315c

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

plotters-bitmap/src/bitmap.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@ impl<'a, P: PixelFormat> DrawingBackend for BitMapBackend<'a, P> {
228228
point: BackendCoord,
229229
color: BackendColor,
230230
) -> Result<(), DrawingErrorKind<BitMapBackendError>> {
231-
if point.0 < 0 || point.1 < 0 || point.0 as u32 >= self.size.0 || point.1 as u32 >= self.size.1 {
231+
if point.0 < 0
232+
|| point.1 < 0
233+
|| point.0 as u32 >= self.size.0
234+
|| point.1 as u32 >= self.size.1
235+
{
232236
return Ok(());
233237
}
234238

plotters/src/coord/ranged1d/types/numeric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ mod test {
446446

447447
#[test]
448448
fn regression_test_issue_304_intmax_keypoint_no_panic() {
449-
let coord : RangedCoordu32 = (0..u32::MAX).into();
449+
let coord: RangedCoordu32 = (0..u32::MAX).into();
450450
let p = coord.key_points(10);
451451
assert!(p.len() > 0 && p.len() <= 10);
452452
}

plotters/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,5 +873,17 @@ pub mod prelude {
873873
pub use plotters_svg::SVGBackend;
874874
}
875875

876+
/// This module contains some useful re-export of backend related types.
877+
pub mod backend {
878+
pub use plotters_backend::DrawingBackend;
879+
#[cfg(feature = "bitmap_backend")]
880+
pub use plotters_bitmap::{
881+
bitmap_pixel::{BGRXPixel, PixelFormat, RGBPixel},
882+
BitMapBackend,
883+
};
884+
#[cfg(feature = "svg_backend")]
885+
pub use plotters_svg::SVGBackend;
886+
}
887+
876888
#[cfg(test)]
877889
mod test;

0 commit comments

Comments
 (0)