Function fltk::draw::draw_xyline

source ·
pub fn draw_xyline(x: i32, y: i32, x1: i32)
Expand description

Draws a horizontal line from (x,y) to (x1,y)

Examples found in repository?
examples/gradients.rs (line 20)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fn create_vertical_gradient_frame(
    x: i32,
    y: i32,
    w: i32,
    h: i32,
    col1: Color,
    col2: Color,
) -> frame::Frame {
    let mut frame = frame::Frame::new(x, y, w, h, "Vertical");
    frame.draw(move |f| {
        let imax = f.h();
        let d = if imax > 0 { imax } else { 1 };
        for i in 0..=imax {
            let w = 1.0 - i as f32 / d as f32;
            set_draw_color(Color::inactive(&Color::color_average(col1, col2, w)));
            draw_xyline(f.x(), f.y() + i, f.x() + f.w());
        }
        set_draw_color(Color::Black);
        set_font(Font::Helvetica, app::font_size());
        draw_text2(&f.label(), f.x(), f.y(), f.w(), f.h(), f.align());
    });
    frame
}