Flo_draw 0.3 - a library for drawing 2D graphics on windows

I'd like to announce that I've just released flo_draw 0.3. It's a library that's designed to make it very simple to build applications that render 2D graphics. For instance, here's a program that opens a window with a circle in it:

use flo_draw::*;
use flo_canvas::*;

pub fn main() {
    with_2d_graphics(|| {
        let canvas      = create_drawing_window("Circle");

        canvas.draw(|gc| {
            gc.canvas_height(1000.0);
            gc.center_region(0.0, 0.0, 1000.0, 1000.0);

            gc.new_path();
            gc.circle(500.0, 500.0, 250.0);

            gc.fill_color(Color::Rgba(0.3, 0.6, 0.8, 1.0));
            gc.fill();

            gc.line_width(6.0);
            gc.stroke_color(Color::Rgba(0.0, 0.0, 0.0, 1.0));
            gc.stroke();
        });
    });
}

Events are also supported for developing fully-interactive applications.

This new version adds support for text rendering, as well as texture and gradient fills. There are also many new examples to look at. I've also been putting together a guide that provides some more detailed descriptions of how to use the crate.

Gradient fills are one of the new features:

gradient

flo_draw is based on flo_canvas, which is a streaming-based API for 2D graphics. This allows capturing and reprocessing rendering instructions, for example to capture the paths from text, or animate a distortion (or both at once):

wibble

The mandelbrot example demonstrates interactivity and using canvas layers to support fully multithreaded rendering on a single canvas, as well as showing off how to render arbitrary bitmaps:

mandelbrot

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.