Skip to content

Commit 426cfaf

Browse files
lisanhu38
authored andcommitted
adding a feature named evcxr_bitmap_figure
1 parent 08927c6 commit 426cfaf

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ ttf = ["font-kit", "ttf-parser", "lazy_static", "pathfinder_geometry"]
100100
datetime = ["chrono"]
101101
evcxr = ["svg_backend", "bitmap_backend", "image"]
102102
deprecated_items = [] # Keep some of the deprecated items for backward compatibility
103+
evcxr_bitmap_figure = ["bitmap_backend", "evcxr"]
103104

104105
[dev-dependencies]
105106
itertools = "0.10.0"

plotters/src/evcxr.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ pub fn evcxr_figure<
4545
SVGWrapper(buffer, "".to_string())
4646
}
4747

48+
#[cfg(feature = "evcxr_bitmap_figure")]
4849
pub struct BitMapWrapper(String, String);
4950

51+
#[cfg(feature = "evcxr_bitmap_figure")]
5052
impl BitMapWrapper {
5153
pub fn evcxr_display(&self) {
5254
println!("{:?}", self);
@@ -58,6 +60,7 @@ impl BitMapWrapper {
5860
}
5961
}
6062

63+
#[cfg(feature = "evcxr_bitmap_figure")]
6164
impl std::fmt::Debug for BitMapWrapper {
6265
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6366
let enc = self.0.as_str();
@@ -69,6 +72,7 @@ impl std::fmt::Debug for BitMapWrapper {
6972
}
7073
}
7174

75+
#[cfg(feature = "evcxr_bitmap_figure")]
7276
fn encode_png<P, Container>(img: &ImageBuffer<P, Container>) -> Result<Vec<u8>, ImageError>
7377
where
7478
P: Pixel<Subpixel = u8> + 'static,
@@ -80,6 +84,7 @@ where
8084
Ok(buf)
8185
}
8286

87+
#[cfg(feature = "evcxr_bitmap_figure")]
8388
/// Start drawing an evcxr figure
8489
pub fn evcxr_bitmap_figure<
8590
Draw: FnOnce(DrawingArea<BitMapBackend, Shift>) -> Result<(), Box<dyn std::error::Error>>,
@@ -98,13 +103,14 @@ pub fn evcxr_bitmap_figure<
98103
BitMapWrapper(buffer, "".to_string())
99104
}
100105

101-
pub fn evcxr_animation<
102-
Draw: FnOnce(DrawingArea<SVGBackend, Shift>) -> Result<(), Box<dyn std::error::Error>>,
103-
>(
104-
drawing_area: &DrawingArea<SVGBackend, Shift>,
105-
draws: Draw,
106-
frames: usize,
107-
interval: usize,
108-
) -> SVGWrapper {
109-
todo!();
110-
}
106+
// #[cfg(feature = "evcxr_bitmap_figure")]
107+
// pub fn evcxr_animation<
108+
// Draw: FnOnce(DrawingArea<SVGBackend, Shift>) -> Result<(), Box<dyn std::error::Error>>,
109+
// >(
110+
// drawing_area: &DrawingArea<SVGBackend, Shift>,
111+
// draws: Draw,
112+
// frames: usize,
113+
// interval: usize,
114+
// ) -> SVGWrapper {
115+
// todo!();
116+
// }

0 commit comments

Comments
 (0)