コンテンツにスキップ

Embedded Graphics — Crate 詳細

Embedded Graphics

Mature no_std

no_std 環境でも使える 2D グラフィックスライブラリ。フォント描画、図形描画、描画プリミティブを提供し、各種ディスプレイドライバ(別 crate)と組み合わせて UI を構築できる。

A no_std 2D graphics library for embedded systems.

バージョン
0.8.1
ライセンス
MIT
メンテナンス
活発に開発中

コード例

具体的なディスプレイ実装は DrawTarget を実装した別ドライバで提供されます。

テキスト描画(DrawTarget 前提)
#![no_std]
use embedded_graphics::mono_font::{ascii::FONT_6X10, MonoTextStyle};
use embedded_graphics::pixelcolor::BinaryColor;
use embedded_graphics::prelude::*;
use embedded_graphics::text::Text;
pub fn draw_text<D: DrawTarget<Color = BinaryColor>>(display: &mut D) {
let style = MonoTextStyle::new(&FONT_6X10, BinaryColor::On);
let _ = Text::new("Hello", Point::new(0, 12), style).draw(display);
}

関連 Crates