INNER CODE UNIT · Rust
height
plotters-rs/plotters · plotters-backend/src/lib.rs:237
let height = max_y - min_y;
let dx = match style.anchor().h_pos {
HPos::Left => 0,
HPos::Right => -width,
HPos::Center => -width / 2,
};
let dy = match style.anchor().v_pos {
VPos::Top => 0,
VPos::Center => -height / 2,
VPos::Bottom => -height,
};
let trans = style.transform();
let (w, h) = self.get_size();
let drawing_result = style.draw(text, (0, 0), |x, y, color| {
let (x, y) = trans.transform(x + dx - min_x, y + dy - min_y);
let (x, y) = (pos.0 + x, pos.1 + y);
if x >= 0 && x < w as i32 && y >= 0 && y < h as i32 {
self.draw_pixel((x, y), color)