| 1 |
use superrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/::*; |
| 2 |
|
| 3 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 4 |
fn test_bitmap_backendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_backend().() { |
| 5 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 6 |
|
| 7 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 8 |
|
| 9 |
{ |
| 10 |
let back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (10, 10)); |
| 11 |
|
| 12 |
let area = back.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 13 |
area.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 14 |
area.drawrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw().(&PathElementrust-analyzer cargo plotters 0.3.7 element/basic_shapes/PathElement#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`PathElement<Coord>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(0, 0), (10, 10)], REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().())) |
| 15 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 16 |
area.presentrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]present().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 17 |
} |
| 18 |
|
| 19 |
for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 20 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 33]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 255); |
| 21 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 33 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 22 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 33 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 23 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().33]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = 255; |
| 24 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().33 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = 255; |
| 25 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().33 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = 255; |
| 26 |
} |
| 27 |
|
| 28 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(buffer.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|x| x == 255)); |
| 29 |
} |
| 30 |
|
| 31 |
#[cfg(test)] |
| 32 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 33 |
fn test_bitmap_backend_fill_halfrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_backend_fill_half().() { |
| 34 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 35 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 36 |
|
| 37 |
{ |
| 38 |
let back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (10, 10)); |
| 39 |
|
| 40 |
let area = back.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 41 |
area.drawrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw().(&Rectanglerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Rectangle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Rectangle<Coord>`]new().([(0, 0), (5, 10)], REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().())) |
| 42 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 43 |
area.presentrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]present().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 44 |
} |
| 45 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 46 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 47 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 48 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., |
| 49 |
if x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5 { 255 } else { 0 } |
| 50 |
); |
| 51 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 52 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 57 |
|
| 58 |
{ |
| 59 |
let back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (10, 10)); |
| 60 |
|
| 61 |
let area = back.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 62 |
area.drawrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw().(&Rectanglerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Rectangle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Rectangle<Coord>`]new().([(0, 0), (10, 5)], REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().())) |
| 63 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 64 |
area.presentrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]present().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 65 |
} |
| 66 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 67 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 68 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 69 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., |
| 70 |
if y <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5 { 255 } else { 0 } |
| 71 |
); |
| 72 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 73 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
#[cfg(test)] |
| 79 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 80 |
fn test_bitmap_backend_blendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_backend_blend().() { |
| 81 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 82 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![255; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 83 |
|
| 84 |
{ |
| 85 |
let back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (10, 10)); |
| 86 |
|
| 87 |
let area = back.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 88 |
area.drawrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw().(&Rectanglerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Rectangle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Rectangle<Coord>`]new().( |
| 89 |
[(0, 0), (5, 10)], |
| 90 |
RGBColorrust-analyzer cargo plotters 0.3.7 style/color/RGBColor#(0, 100, 200).mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.2).filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().(), |
| 91 |
)) |
| 92 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 93 |
area.presentrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]present().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 94 |
} |
| 95 |
|
| 96 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 97 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 98 |
let (r, g, b) = if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().5 { |
| 99 |
(205, 225, 245) |
| 100 |
} else { |
| 101 |
(255, 255, 255) |
| 102 |
}; |
| 103 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., r); |
| 104 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., g); |
| 105 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., b); |
| 106 |
} |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
#[cfg(test)] |
| 111 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 112 |
fn test_bitmap_backend_split_and_fillrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_backend_split_and_fill().() { |
| 113 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 114 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![255; 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 10 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 115 |
|
| 116 |
{ |
| 117 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (10, 10)); |
| 118 |
|
| 119 |
for (sub_backend, color) in back.splitrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`]split().(&[5]).into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().([&REDrust-analyzer cargo plotters 0.3.7 style/colors/RED., &GREENrust-analyzer cargo plotters 0.3.7 style/colors/GREEN.].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) { |
| 120 |
sub_backend.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().().fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().color).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 125 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 { |
| 126 |
let (r, g, b) = if y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().5 { (255, 0, 0) } else { (0, 255, 0) }; |
| 127 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., r); |
| 128 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., g); |
| 129 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 10 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., b); |
| 130 |
} |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
#[cfg(test)] |
| 135 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 136 |
fn test_draw_rect_out_of_rangerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_draw_rect_out_of_range().() { |
| 137 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 138 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1099 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 139 |
|
| 140 |
{ |
| 141 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (1000, 1000)); |
| 142 |
|
| 143 |
back.draw_linerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_line().((1100, 0), (1100, 999), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().()) |
| 144 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 145 |
back.draw_linerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_line().((0, 1100), (999, 1100), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().()) |
| 146 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 147 |
back.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((1100, 0), (1100, 999), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().(), true) |
| 148 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 149 |
} |
| 150 |
|
| 151 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 152 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 153 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 154 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 155 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 156 |
} |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
#[cfg(test)] |
| 161 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 162 |
fn test_draw_rect_exclude_bottom_rightrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_draw_rect_exclude_bottom_right().() { |
| 163 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 164 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 100 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 100 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 165 |
|
| 166 |
{ |
| 167 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (100, 100)); |
| 168 |
|
| 169 |
back.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (0, 0), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().(), true) |
| 170 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 171 |
} |
| 172 |
|
| 173 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0..3]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &[0, 0, 0]); |
| 174 |
} |
| 175 |
|
| 176 |
#[cfg(test)] |
| 177 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 178 |
fn test_draw_line_out_of_rangerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_draw_line_out_of_range().() { |
| 179 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 180 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 181 |
|
| 182 |
{ |
| 183 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (1000, 1000)); |
| 184 |
|
| 185 |
back.draw_linerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_line().((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1000, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1000), (2000, 2000), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().()) |
| 186 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 187 |
|
| 188 |
back.draw_linerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_line().((999, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1000), (999, 2000), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE..to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().()) |
| 189 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 190 |
} |
| 191 |
|
| 192 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 193 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 194 |
let expected_value = if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().y || x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().999 { 255 } else { 0 }; |
| 195 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value); |
| 196 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value); |
| 197 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value); |
| 198 |
} |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
#[cfg(test)] |
| 203 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 204 |
fn test_bitmap_blend_largerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_blend_large().() { |
| 205 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 206 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 207 |
|
| 208 |
for fill_color in [REDrust-analyzer cargo plotters 0.3.7 style/colors/RED., GREENrust-analyzer cargo plotters 0.3.7 style/colors/GREEN., BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE.].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 209 |
buffer.iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]for_each().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().x = 0); |
| 210 |
|
| 211 |
{ |
| 212 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (1000, 1000)); |
| 213 |
|
| 214 |
back.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (1000, 1000), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.1), true) |
| 215 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); // should be (24, 24, 24) |
| 216 |
back.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (100, 100), &fill_color.mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.5), true) |
| 217 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); // should be (139, 24, 24) |
| 218 |
} |
| 219 |
|
| 220 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 221 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 222 |
let expected_value = if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().100 && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().100 { |
| 223 |
let (r, g, b) = fill_color.to_rgbarust-analyzer cargo plotters 0.3.7 style/color/Color#to_rgba().().rgbrust-analyzer cargo plotters 0.3.7 style/color/Color#rgb().(); |
| 224 |
( |
| 225 |
if r rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().0 { 139 } else { 12 }, |
| 226 |
if g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().0 { 139 } else { 12 }, |
| 227 |
if b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().0 { 139 } else { 12 }, |
| 228 |
) |
| 229 |
} else { |
| 230 |
(24, 24, 24) |
| 231 |
}; |
| 232 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value.0); |
| 233 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value.1); |
| 234 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().(y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 1000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). x) as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_value.2); |
| 235 |
} |
| 236 |
} |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
#[cfg(test)] |
| 241 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 242 |
fn test_bitmap_bgrx_pixel_formatrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_bgrx_pixel_format().() { |
| 243 |
use craterust-analyzer cargo plotters-bitmap 0.3.7 crate/::{bitmap_pixelrust-analyzer cargo plotters-bitmap 0.3.7 bitmap_pixel/::BGRXPixelrust-analyzer cargo plotters-bitmap 0.3.7 bitmap_pixel/bgrx/BGRXPixel#, BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#}; |
| 244 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::{Colorrust-analyzer cargo plotters 0.3.7 style/color/Color#, RGBColorrust-analyzer cargo plotters 0.3.7 style/color/RGBColor#, BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK., BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE., GREENrust-analyzer cargo plotters 0.3.7 style/colors/GREEN., REDrust-analyzer cargo plotters 0.3.7 style/colors/RED., WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE., YELLOWrust-analyzer cargo plotters 0.3.7 style/colors/YELLOW.}; |
| 245 |
let mut rgb_buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 246 |
let mut bgrx_buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4]; |
| 247 |
|
| 248 |
{ |
| 249 |
let mut rgb_back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut rgb_buffer, (1000, 1000)); |
| 250 |
let mut bgrx_back = |
| 251 |
BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::<BGRXPixelrust-analyzer cargo plotters-bitmap 0.3.7 bitmap_pixel/bgrx/BGRXPixel#>::with_buffer_and_formatrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`]with_buffer_and_format().(&mut bgrx_buffer, (1000, 1000)) |
| 252 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 253 |
|
| 254 |
rgb_back |
| 255 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (1000, 1000), &BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK., true) |
| 256 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 257 |
bgrx_back |
| 258 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (1000, 1000), &BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK., true) |
| 259 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 260 |
|
| 261 |
rgb_back |
| 262 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().( |
| 263 |
(0, 0), |
| 264 |
(1000, 1000), |
| 265 |
&RGBColorrust-analyzer cargo plotters 0.3.7 style/color/RGBColor#(0xaa, 0xbb, 0xcc).mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.85), |
| 266 |
true, |
| 267 |
) |
| 268 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 269 |
bgrx_back |
| 270 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().( |
| 271 |
(0, 0), |
| 272 |
(1000, 1000), |
| 273 |
&RGBColorrust-analyzer cargo plotters 0.3.7 style/color/RGBColor#(0xaa, 0xbb, 0xcc).mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.85), |
| 274 |
true, |
| 275 |
) |
| 276 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 277 |
|
| 278 |
rgb_back |
| 279 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (1000, 1000), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.85), true) |
| 280 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 281 |
bgrx_back |
| 282 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((0, 0), (1000, 1000), &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.85), true) |
| 283 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 284 |
|
| 285 |
rgb_back.draw_circlerust-analyzer cargo plotters-backend 0.3.7 DrawingBackend#draw_circle().((300, 300), 100, &GREENrust-analyzer cargo plotters 0.3.7 style/colors/GREEN., true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 286 |
bgrx_back |
| 287 |
.draw_circlerust-analyzer cargo plotters-backend 0.3.7 DrawingBackend#draw_circle().((300, 300), 100, &GREENrust-analyzer cargo plotters 0.3.7 style/colors/GREEN., true) |
| 288 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 289 |
|
| 290 |
rgb_back.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (50, 50), &BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE., true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 291 |
bgrx_back |
| 292 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (50, 50), &BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE., true) |
| 293 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 294 |
|
| 295 |
rgb_back |
| 296 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (50, 50), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE., true) |
| 297 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 298 |
bgrx_back |
| 299 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (50, 50), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE., true) |
| 300 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 301 |
|
| 302 |
rgb_back |
| 303 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (15, 50), &YELLOWrust-analyzer cargo plotters 0.3.7 style/colors/YELLOW., true) |
| 304 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 305 |
bgrx_back |
| 306 |
.draw_rectrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_rect().((10, 10), (15, 50), &YELLOWrust-analyzer cargo plotters 0.3.7 style/colors/YELLOW., true) |
| 307 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 308 |
} |
| 309 |
|
| 310 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 311 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 312 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 313 |
(rgb_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32 |
| 314 |
-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). bgrx_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32) |
| 315 |
.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().() |
| 316 |
<= 1 |
| 317 |
); |
| 318 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 319 |
(rgb_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32 |
| 320 |
-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). bgrx_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32) |
| 321 |
.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().() |
| 322 |
<= 1 |
| 323 |
); |
| 324 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 325 |
(rgb_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32 |
| 326 |
-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). bgrx_buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 4 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as i32) |
| 327 |
.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().() |
| 328 |
<= 1 |
| 329 |
); |
| 330 |
} |
| 331 |
} |
| 332 |
} |
| 333 |
#[cfg(test)] |
| 334 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 335 |
fn test_draw_simple_linesrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_draw_simple_lines().() { |
| 336 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 337 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 338 |
|
| 339 |
{ |
| 340 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (1000, 1000)); |
| 341 |
back.draw_linerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]draw_line().((500, 0), (500, 1000), &WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().().stroke_widthrust-analyzer cargo plotters 0.3.7 style/shape/impl#[ShapeStyle]stroke_width().(5)) |
| 342 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 343 |
} |
| 344 |
|
| 345 |
let nz_count = buffer.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0).countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]count().(); |
| 346 |
|
| 347 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(nz_count, 6 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3); |
| 348 |
} |
| 349 |
|
| 350 |
#[cfg(test)] |
| 351 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 352 |
fn test_bitmap_blitrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test_bitmap_blit().() { |
| 353 |
let src_bitmap: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100) |
| 354 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|y| (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#300).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(move |x| ((x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().y) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Rem<Self>`]rem().253) as u8)) |
| 355 |
.flattenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flatten().() |
| 356 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 357 |
|
| 358 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 359 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 1000 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 360 |
|
| 361 |
{ |
| 362 |
let mut back = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (1000, 1000)); |
| 363 |
back.blit_bitmaprust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a, P>`][DrawingBackend]blit_bitmap().((500, 500), (100, 100), &src_bitmap[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().) |
| 364 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 365 |
} |
| 366 |
|
| 367 |
for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 368 |
for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1000 { |
| 369 |
if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().500 && x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().600 && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().500 && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().600 { |
| 370 |
let lx = x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().500; |
| 371 |
let ly = y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().500; |
| 372 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as usize, (ly *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). lx *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3) %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). 253); |
| 373 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 374 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as usize, |
| 375 |
(ly *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). (lx *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1)) %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). 253 |
| 376 |
); |
| 377 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 378 |
buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). as usize, |
| 379 |
(ly *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). (lx *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2)) %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). 253 |
| 380 |
); |
| 381 |
} else { |
| 382 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 383 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 384 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().y *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3000 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., 0); |
| 385 |
} |
| 386 |
} |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))] |
| 391 |
#[cfg(test)] |
| 392 |
mod testrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/ { |
| 393 |
use craterust-analyzer cargo plotters-bitmap 0.3.7 crate/::BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#; |
| 394 |
use imagerust-analyzer cargo image 0.25.10 crate/::{ImageBufferrust-analyzer cargo image 0.25.10 images/buffer/ImageBuffer#, Rgbrust-analyzer cargo image 0.25.10 color/Rgb#}; |
| 395 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::preluderust-analyzer cargo plotters 0.3.7 prelude/::*; |
| 396 |
use plottersrust-analyzer cargo plotters 0.3.7 crate/::stylerust-analyzer cargo plotters 0.3.7 style/::text_anchorrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/::{HPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#, Posrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/Pos#, VPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#}; |
| 397 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/; |
| 398 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| •399 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#; |
| 400 |
|
| •401 |
fn get_dst_dirrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/get_dst_dir().() -> PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# { |
| 402 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cargo_target_dir) = option_envrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/option_env!!("CARGO_TARGET_DIR") { |
| 403 |
return Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(cargo_target_dir).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("bitmap"); |
| 404 |
} else { |
| 405 |
return Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("target/test/bitmap").to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().(); |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
fn checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().(name: &str, content: &[u8], w: u32, h: u32) { |
| 410 |
/* |
| 411 |
Please use the PNG file to manually verify the results. |
| 412 |
*/ |
| 413 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(content.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x != 0)); |
| •414 |
fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(get_dst_dirrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/get_dst_dir().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 415 |
let file_name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}.png", name); |
| •416 |
let file_path = get_dst_dirrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/get_dst_dir().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(file_name); |
| 417 |
printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?} created", file_path); |
| 418 |
let img = ImageBufferrust-analyzer cargo image 0.25.10 images/buffer/ImageBuffer#::<Rgbrust-analyzer cargo image 0.25.10 color/Rgb#<u8>, &[u8]>::from_rawrust-analyzer cargo image 0.25.10 images/buffer/impl#[`ImageBuffer<P, Container>`]from_raw().(w, h, content).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 419 |
img.saverust-analyzer cargo image 0.25.10 images/buffer/impl#[`ImageBuffer<P, Container>`]save().(&file_path).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 420 |
} |
| 421 |
|
| 422 |
fn draw_mesh_with_custom_ticksrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/draw_mesh_with_custom_ticks().(tick_size: i32, test_name: &str) { |
| 423 |
let (width, height) = (500, 500); |
| 424 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; (width *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). height *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). 3) as usize]; |
| 425 |
{ |
| 426 |
let root = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (width, height)).into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 427 |
root.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 428 |
|
| 429 |
let mut chart = ChartBuilderrust-analyzer cargo plotters 0.3.7 chart/builder/ChartBuilder#::onrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]on().(&root) |
| 430 |
.captionrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]caption().("This is a test", ("sans-serif", 20)) |
| 431 |
.set_all_label_area_sizerust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]set_all_label_area_size().(40) |
| 432 |
.build_cartesian_2drust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]build_cartesian_2d().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10, 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10) |
| 433 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 434 |
|
| 435 |
chart |
| 436 |
.configure_meshrust-analyzer cargo plotters 0.3.7 chart/context/cartesian2d/impl#[`ChartContext<'a, DB, Cartesian2d<X, Y>>`]configure_mesh().() |
| 437 |
.set_all_tick_mark_sizerust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]set_all_tick_mark_size().(tick_size) |
| 438 |
.drawrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]draw().() |
| 439 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 440 |
} |
| 441 |
checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().(test_name, &buffer, width, height); |
| 442 |
} |
| 443 |
|
| 444 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 445 |
fn test_draw_mesh_no_ticksrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_draw_mesh_no_ticks().() { |
| 446 |
draw_mesh_with_custom_ticksrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/draw_mesh_with_custom_ticks().(0, "test_draw_mesh_no_ticks"); |
| 447 |
} |
| 448 |
|
| 449 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 450 |
fn test_draw_mesh_negative_ticksrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_draw_mesh_negative_ticks().() { |
| 451 |
draw_mesh_with_custom_ticksrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/draw_mesh_with_custom_ticks().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().10, "test_draw_mesh_negative_ticks"); |
| 452 |
} |
| 453 |
|
| 454 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 455 |
fn test_text_drawrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_text_draw().() { |
| 456 |
let (width, height) = (1500, 800); |
| 457 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; (width *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). height *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). 3) as usize]; |
| 458 |
{ |
| 459 |
let root = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (width, height)).into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 460 |
root.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 461 |
let root = root |
| 462 |
.titledrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]titled().("Image Title", ("sans-serif", 60).into_fontrust-analyzer cargo plotters 0.3.7 style/font/font_desc/impl#[T][`IntoFont<'a>`]into_font().()) |
| 463 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 464 |
|
| 465 |
let mut chart = ChartBuilderrust-analyzer cargo plotters 0.3.7 chart/builder/ChartBuilder#::onrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]on().(&root) |
| 466 |
.captionrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]caption().("All anchor point positions", ("sans-serif", 20)) |
| 467 |
.set_all_label_area_sizerust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]set_all_label_area_size().(40) |
| 468 |
.build_cartesian_2drust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]build_cartesian_2d().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100, 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#50) |
| 469 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 470 |
|
| 471 |
chart |
| 472 |
.configure_meshrust-analyzer cargo plotters 0.3.7 chart/context/cartesian2d/impl#[`ChartContext<'a, DB, Cartesian2d<X, Y>>`]configure_mesh().() |
| 473 |
.disable_x_meshrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]disable_x_mesh().() |
| 474 |
.disable_y_meshrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]disable_y_mesh().() |
| 475 |
.x_descrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]x_desc().("X Axis") |
| 476 |
.y_descrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]y_desc().("Y Axis") |
| 477 |
.drawrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]draw().() |
| 478 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 479 |
|
| 480 |
let ((x1, y1), (x2, y2), (x3, y3)) = ((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().30, 30), (0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().30), (30, 30)); |
| 481 |
|
| 482 |
for (dy, trans) in [ |
| 483 |
FontTransformrust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#::Nonerust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#None#, |
| 484 |
FontTransformrust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#::Rotate90rust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#Rotate90#, |
| 485 |
FontTransformrust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#::Rotate180rust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#Rotate180#, |
| 486 |
FontTransformrust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#::Rotate270rust-analyzer cargo plotters-backend 0.3.7 text/FontTransform#Rotate270#, |
| 487 |
] |
| 488 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 489 |
.enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() |
| 490 |
{ |
| 491 |
for (dx1, h_pos) in [HPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#::Leftrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#Left#, HPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#::Rightrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#Right#, HPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#::Centerrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#Center#].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 492 |
for (dx2, v_pos) in [VPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#::Toprust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#Top#, VPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#::Centerrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#Center#, VPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#::Bottomrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#Bottom#].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 493 |
let x = 150_i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().(dx1 as i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().dx2 as i32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().150; |
| 494 |
let y = 120 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().dy as i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().150; |
| 495 |
let draw = |x, y, text| { |
| 496 |
root.drawrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw().(&Circlerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Circle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Circle<Coord, Size>`]new().((x, y), 3, &BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.5))).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 497 |
let style = TextStylerust-analyzer cargo plotters 0.3.7 style/text/TextStyle#::fromrust-analyzer cargo plotters 0.3.7 style/text/impl#[`TextStyle<'a>`][`From<T>`]from().(("sans-serif", 20).into_fontrust-analyzer cargo plotters 0.3.7 style/font/font_desc/impl#[T][`IntoFont<'a>`]into_font().()) |
| 498 |
.posrust-analyzer cargo plotters 0.3.7 style/text/impl#[`TextStyle<'a>`]pos().(Posrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/Pos#::newrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/impl#[Pos]new().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().h_pos, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().v_pos)) |
| 499 |
.transformrust-analyzer cargo plotters 0.3.7 style/text/impl#[`TextStyle<'a>`]transform().(trans.clonerust-analyzer cargo plotters-backend 0.3.7 text/impl#[FontTransform][Clone]clone().()); |
| 500 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().(text, &style, (x, y)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 501 |
}; |
| 502 |
draw(x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().x1, y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().y1, "dood"); |
| 503 |
draw(x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().x2, y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().y2, "dog"); |
| 504 |
draw(x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().x3, y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().y3, "goog"); |
| 505 |
} |
| 506 |
} |
| 507 |
} |
| 508 |
} |
| 509 |
checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().("test_text_draw", &buffer, width, height); |
| 510 |
} |
| 511 |
|
| 512 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 513 |
fn test_text_clippingrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_text_clipping().() { |
| 514 |
let (width, height) = (500_i32, 500_i32); |
| 515 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; (width *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). height *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 3) as usize]; |
| 516 |
{ |
| 517 |
let root = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (width as u32, height as u32)) |
| 518 |
.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 519 |
root.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 520 |
|
| 521 |
let style = TextStylerust-analyzer cargo plotters 0.3.7 style/text/TextStyle#::fromrust-analyzer cargo plotters 0.3.7 style/text/impl#[`TextStyle<'a>`][`From<T>`]from().(("sans-serif", 20).into_fontrust-analyzer cargo plotters 0.3.7 style/font/font_desc/impl#[T][`IntoFont<'a>`]into_font().()) |
| 522 |
.posrust-analyzer cargo plotters 0.3.7 style/text/impl#[`TextStyle<'a>`]pos().(Posrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/Pos#::newrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/impl#[Pos]new().(HPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#::Centerrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/HPos#Center#, VPosrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#::Centerrust-analyzer cargo plotters-backend 0.3.7 text/text_anchor/VPos#Center#)); |
| 523 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("TOP LEFT", &style, (0, 0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 524 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("TOP CENTER", &style, (width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2, 0)) |
| 525 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 526 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("TOP RIGHT", &style, (width, 0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 527 |
|
| 528 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("MIDDLE LEFT", &style, (0, height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2)) |
| 529 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 530 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("MIDDLE RIGHT", &style, (width, height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2)) |
| 531 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 532 |
|
| 533 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("BOTTOM LEFT", &style, (0, height)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 534 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("BOTTOM CENTER", &style, (width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Div<Self>`]div().2, height)) |
| 535 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 536 |
root.draw_textrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, Shift>`]draw_text().("BOTTOM RIGHT", &style, (width, height)) |
| 537 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 538 |
} |
| 539 |
checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().("test_text_clipping", &buffer, width as u32, height as u32); |
| 540 |
} |
| 541 |
|
| 542 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 543 |
fn test_series_labelsrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_series_labels().() { |
| 544 |
let (width, height) = (500, 500); |
| 545 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; (width *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). height *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). 3) as usize]; |
| 546 |
{ |
| 547 |
let root = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (width, height)).into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 548 |
root.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 549 |
|
| 550 |
let mut chart = ChartBuilderrust-analyzer cargo plotters 0.3.7 chart/builder/ChartBuilder#::onrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]on().(&root) |
| 551 |
.captionrust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]caption().("All series label positions", ("sans-serif", 20)) |
| 552 |
.set_all_label_area_sizerust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]set_all_label_area_size().(40) |
| 553 |
.build_cartesian_2drust-analyzer cargo plotters 0.3.7 chart/builder/impl#[`ChartBuilder<'a, 'b, DB>`]build_cartesian_2d().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#50, 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#50) |
| 554 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 555 |
|
| 556 |
chart |
| 557 |
.configure_meshrust-analyzer cargo plotters 0.3.7 chart/context/cartesian2d/impl#[`ChartContext<'a, DB, Cartesian2d<X, Y>>`]configure_mesh().() |
| 558 |
.disable_x_meshrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]disable_x_mesh().() |
| 559 |
.disable_y_meshrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]disable_y_mesh().() |
| 560 |
.drawrust-analyzer cargo plotters 0.3.7 chart/mesh/impl#[`MeshStyle<'a, 'b, X, Y, DB>`]draw().() |
| 561 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 562 |
|
| 563 |
chart |
| 564 |
.draw_seriesrust-analyzer cargo plotters 0.3.7 chart/context/impl#[`ChartContext<'a, DB, CT>`]draw_series().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(Circlerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Circle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Circle<Coord, Size>`]new().((5, 15), 5, &REDrust-analyzer cargo plotters 0.3.7 style/colors/RED.))) |
| 565 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Drawing error") |
| 566 |
.labelrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesAnno<'a, DB>`]label().("Series 1") |
| 567 |
.legendrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesAnno<'a, DB>`]legend().(|(x, y)| Circlerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Circle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Circle<Coord, Size>`]new().((x, y), 3, REDrust-analyzer cargo plotters 0.3.7 style/colors/RED..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().())); |
| 568 |
|
| 569 |
chart |
| 570 |
.draw_seriesrust-analyzer cargo plotters 0.3.7 chart/context/impl#[`ChartContext<'a, DB, CT>`]draw_series().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(Circlerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Circle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Circle<Coord, Size>`]new().((5, 15), 10, &BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE.))) |
| 571 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Drawing error") |
| 572 |
.labelrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesAnno<'a, DB>`]label().("Series 2") |
| 573 |
.legendrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesAnno<'a, DB>`]legend().(|(x, y)| Circlerust-analyzer cargo plotters 0.3.7 element/basic_shapes/Circle#::newrust-analyzer cargo plotters 0.3.7 element/basic_shapes/impl#[`Circle<Coord, Size>`]new().((x, y), 3, BLUErust-analyzer cargo plotters 0.3.7 style/colors/BLUE..filledrust-analyzer cargo plotters 0.3.7 style/color/Color#filled().())); |
| 574 |
|
| 575 |
for pos in vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 576 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::UpperLeftrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#UpperLeft#, |
| 577 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::MiddleLeftrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#MiddleLeft#, |
| 578 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::LowerLeftrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#LowerLeft#, |
| 579 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::UpperMiddlerust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#UpperMiddle#, |
| 580 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::MiddleMiddlerust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#MiddleMiddle#, |
| 581 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::LowerMiddlerust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#LowerMiddle#, |
| 582 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::UpperRightrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#UpperRight#, |
| 583 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::MiddleRightrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#MiddleRight#, |
| 584 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::LowerRightrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#LowerRight#, |
| 585 |
SeriesLabelPositionrust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#::Coordinaterust-analyzer cargo plotters 0.3.7 chart/series/SeriesLabelPosition#Coordinate#(70, 70), |
| 586 |
] |
| 587 |
.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 588 |
{ |
| 589 |
chart |
| 590 |
.configure_series_labelsrust-analyzer cargo plotters 0.3.7 chart/context/impl#[`ChartContext<'a, DB, CT>`]configure_series_labels().() |
| 591 |
.border_stylerust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesLabelStyle<'a, 'b, DB, CT>`]border_style().(&BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(0.5)) |
| 592 |
.positionrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesLabelStyle<'a, 'b, DB, CT>`]position().(pos) |
| 593 |
.drawrust-analyzer cargo plotters 0.3.7 chart/series/impl#[`SeriesLabelStyle<'a, 'b, DB, CT>`]draw().() |
| 594 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Drawing error"); |
| 595 |
} |
| 596 |
} |
| 597 |
checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().("test_series_labels", &buffer, width, height); |
| 598 |
} |
| 599 |
|
| 600 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 601 |
fn test_draw_pixel_alphasrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/test_draw_pixel_alphas().() { |
| 602 |
let (width, height) = (100_i32, 100_i32); |
| 603 |
let mut buffer = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; (width *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). height *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). 3) as usize]; |
| 604 |
{ |
| 605 |
let root = BitMapBackendrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/BitMapBackend#::with_bufferrust-analyzer cargo plotters-bitmap 0.3.7 bitmap/impl#[`BitMapBackend<'a>`]with_buffer().(&mut buffer, (width as u32, height as u32)) |
| 606 |
.into_drawing_arearust-analyzer cargo plotters 0.3.7 drawing/area/impl#[T][IntoDrawingArea]into_drawing_area().(); |
| 607 |
root.fillrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]fill().(&WHITErust-analyzer cargo plotters 0.3.7 style/colors/WHITE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 608 |
for i in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().20..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#20 { |
| 609 |
let alpha = i as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().0.1; |
| 610 |
root.draw_pixelrust-analyzer cargo plotters 0.3.7 drawing/area/impl#[`DrawingArea<DB, CT>`]draw_pixel().((50 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().i, 50 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().i), &BLACKrust-analyzer cargo plotters 0.3.7 style/colors/BLACK..mixrust-analyzer cargo plotters 0.3.7 style/color/Color#mix().(alpha)) |
| 611 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 612 |
} |
| 613 |
} |
| 614 |
checked_save_filerust-analyzer cargo plotters-bitmap 0.3.7 bitmap/test/test/checked_save_file().( |
| 615 |
"test_draw_pixel_alphas", |
| 616 |
&buffer, |
| 617 |
width as u32, |
| 618 |
height as u32, |
| 619 |
); |
| 620 |
} |
| 621 |
} |