#gui #graphics #windows

pnte

2D Graphics library for Windows in Rust

12 releases

Uses new Rust 2024

new 0.3.2 May 2, 2025
0.3.1 Feb 22, 2025
0.2.7 Jan 10, 2025
0.2.6 Aug 19, 2024
0.1.0 Dec 9, 2023

#234 in Graphics APIs

Download history 8/week @ 2025-01-15 3/week @ 2025-02-05 4/week @ 2025-02-12 227/week @ 2025-02-19 41/week @ 2025-02-26 2/week @ 2025-03-05 2/week @ 2025-03-12 7/week @ 2025-04-09 127/week @ 2025-04-30

134 downloads per month

MIT license

580KB
2.5K SLoC

pnte

2D Graphics library for Windows in Rust

pnte is a Direct2D and DreictWrite wrapper.

Requirement

To use this library, CoInitializeEx must be called for each thread.

How to use simply

  1. Create a pnte::Context.
let ctx = pnte::Context::new(pnte::Direct2D::new()?)?;
  1. Create a render target.
let render_target = ctx.create_render_target(&window, (size.width, size.height))?;
  1. Draw.
ctx.draw(&render_target, |cmd| {
    let white = pnte::SolidColorBrush::new(&ctx, (1.0, 1.0, 1.0, 1.0))?;
    cmd.clear((0.0, 0.0, 0.0, 0.0));
    cmd.draw_text("pnte", (10.0, 10.0), &white)?;
})?;

License

This library is licensed under the MIT license.

Dependencies

~115MB
~2M SLoC