dir
direct2d
cargo install direct2d
dir

direct2d

`direct2d` is trying to be a safe, thin abstraction for Direct2D to let you easily write 2D drawing on Windows

by Connie Hilarides

0.2.0 (see all)License:MIT/Apache-2.0
cargo install direct2d
Readme

Safe abstractions for drawing on Windows using Direct2D

Example

extern crate direct2d;

use direct2d::{DeviceContext, RenderTarget};
use direct2d::brush::SolidColorBrush;
use direct2d::image::Bitmap;

fn draw(context: &mut DeviceContext, target: &Bitmap) {
    let brush = SolidColorBrush::create(&context)
        .with_color(0xFF_7F_7F)
        .build().unwrap();

    context.begin_draw();
    context.set_target(target);
    context.clear(0xFF_FF_FF);
    
    context.draw_line((10.0, 10.0), (20.0, 20.0), &brush, 2.0, None);
    context.draw_line((10.0, 20.0), (20.0, 10.0), &brush, 2.0, None);

    match context.end_draw() {
        Ok(_) => {/* cool */},
        Err(_) => panic!("Uh oh, rendering failed!"),
    }
}

GitHub Stars

29

LAST COMMIT

3yrs ago

MAINTAINERS

1

CONTRIBUTORS

5

OPEN ISSUES

2

OPEN PRs

1
VersionTagPublished
0.3.0-alpha1
3yrs ago
0.2.0
4yrs ago
0.1.4
4yrs ago
0.1.3
4yrs ago
No alternatives found
No tutorials found
Add a tutorial