kahlo/lib.rs
1//! kahlo is a software drawing library designed for speed and flexibility.
2//!
3//! The main goal for kahlo is to provide _fast_ drawing of simple 2D shapes and paths onto
4//! multiple surface formats. See the [`formats`] module for the supported formats.
5//!
6//! kahlo will use AVX, if present, but has fallbacks to unoptimized implementations as well. Note
7//! that the unoptimized implementations are mostly present for automated testing and verification
8//! purposes, and are written for clarity and not speed.
9
10mod bitmap;
11mod op;
12
13#[cfg(target_endian = "big")]
14std::compile_error!("kahlo only works on little-endian targets!");
15
16/// Colour-related functionality.
17pub mod colour;
18/// Pixel format definitions.
19pub mod formats;
20
21/// Trait re-exports.
22pub mod prelude {
23 // pub use crate::ops::{AlphaPaintable, Readable, RgbaPaintable, Paintable, Writable};
24 pub use crate::bitmap::{BitmapAccess, BitmapMutAccess};
25 pub use crate::op::KahloOps;
26}
27
28pub mod math;
29
30pub use bitmap::{Bitmap, BitmapMut, BitmapRef};
31
32/// Helper type alias for a Rgba32 bitmap.
33pub type RgbaBitmap = Bitmap<formats::Rgba32>;
34/// Helper type alias for an A8 bitmap.
35pub type Alphamap = Bitmap<formats::A8>;
36
37#[cfg(test)]
38pub fn collect_op_benchmarks(cri: &mut criterion::Criterion) {
39 op::collect_benchmarks(cri);
40}