Skip to content

Commit

Permalink
Re-export backend types closes #377
Browse files Browse the repository at this point in the history
  • Loading branch information
38 committed Jul 4, 2022
1 parent e84df9d commit ba2315c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion plotters-bitmap/src/bitmap.rs
Expand Up @@ -228,7 +228,11 @@ impl<'a, P: PixelFormat> DrawingBackend for BitMapBackend<'a, P> {
point: BackendCoord,
color: BackendColor,
) -> Result<(), DrawingErrorKind<BitMapBackendError>> {
if point.0 < 0 || point.1 < 0 || point.0 as u32 >= self.size.0 || point.1 as u32 >= self.size.1 {
if point.0 < 0
|| point.1 < 0
|| point.0 as u32 >= self.size.0
|| point.1 as u32 >= self.size.1
{
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion plotters/src/coord/ranged1d/types/numeric.rs
Expand Up @@ -446,7 +446,7 @@ mod test {

#[test]
fn regression_test_issue_304_intmax_keypoint_no_panic() {
let coord : RangedCoordu32 = (0..u32::MAX).into();
let coord: RangedCoordu32 = (0..u32::MAX).into();
let p = coord.key_points(10);
assert!(p.len() > 0 && p.len() <= 10);
}
Expand Down
12 changes: 12 additions & 0 deletions plotters/src/lib.rs
Expand Up @@ -873,5 +873,17 @@ pub mod prelude {
pub use plotters_svg::SVGBackend;
}

/// This module contains some useful re-export of backend related types.
pub mod backend {
pub use plotters_backend::DrawingBackend;
#[cfg(feature = "bitmap_backend")]
pub use plotters_bitmap::{
bitmap_pixel::{BGRXPixel, PixelFormat, RGBPixel},
BitMapBackend,
};
#[cfg(feature = "svg_backend")]
pub use plotters_svg::SVGBackend;
}

#[cfg(test)]
mod test;

0 comments on commit ba2315c

Please sign in to comment.