Prisma2D - Fast, API agnostic, software only 2D graphics crate in pure Rust.

Overview

Prisma2D: Ultra-fast CPU 2D graphics

License Repo Size

Prisma2D is a blazingly fast, efficient yet minimal crate for basic 2D graphics on the CPU. for Rust. With Prisma2D, whether you're building games, simulations, or any graphics-intensive application, you can squeeze every single bit of processing power available to draw efficiently anything you want on the screen!

Features

  • 🦀 No dependencies: Prisma2D can be used with absolutely no dependencies (Not even std!). This can come in handy when you work in a very restricted environment such as low-level graphics. It will also never depend on any graphics hardware to be present and runs all logic on the CPU.

  • 🚀 Efficiency at its Core: Prisma2D is designed for speed, being able to draw millions of pixels every second without struggling at all. It's optimized to handle the most demanding graphics tasks without breaking a sweat. Your primitives can be rendered with near-instant results, thanks to the use of efficient algorithms and extensive optimization.

  • 🖌️ Pixel Perfection: Achieve pixel perfection effortlessly. Prisma2D provides precise control over pixels, allowing you to create crisp and clear graphics with absolute control on every single pixel.

Getting Started

  • Add Prisma2D to your Cargo.toml:
[dependencies]
prisma2d = "0.1.0"
  • Draw literally anything (See examples for more details):
use prisma2d::{
    line::Line,
    point::Point,
    color::Color,
};

fn main() {
    /* Create your framebuffer here. You can use a crate like 'pixels' */
    let framebuffer = Vec::<u8>::new();
    let line = Line::new(
        Point { x: 50, y: 200 },
        Point { x: 150, y: 200 },
        Color::default(), // White color by default
    )
    line.draw();
}

TODOs

  • Lines
  • Pixels
  • Vertices
  • Examples
  • Images
  • Multithreading
  • Helper functions
  • Rectangles
  • Filling
  • Gradients

FAQ

  • Does this support x?
    Yes, it probably does, given that most operating systems work with a (shared) framebuffer to display the contents of a window, which is what Prisma2D wants to render upon.

  • How does this compare to other crates?
    Before you get an answer, you must understand that this crate is in early development and even very basic features are missing, so I won't consider this factor for now.

  • tiny-skia is close enough, and given the amount of time it had to develop, it can fulfill most of the functionality Prisma2D offers. (TODO: Benchmarks)
  • cairo is a C library, so it can easily escape Rust's enforcing safety, however it's stable and has been used for many other libraries.
  • skia is a C++ library (Meaning you can't use it from another language AT ALL), and it's bloated as hell (It can take hours and GBs of space to compile it), not to mention the resulting library is ~5MBs in space.

In essence, this crate tries to sit somewhere in a small corner of your codebase, whereas most crates try to gain complete control over your graphics rendering.

  • If it's so small why not just reimplement it by hand myself?
    You will waste a few days to rewrite this crate, which you could've invested in your actual application/library. Also, you will have to learn some concepts from scratch just to reinvent the wheel.

  • I want x, please add it.
    The code is here, the pull requests are there, make one and add anything you wish to add. If you don't know how to implement x, open an issue.

Contributing

We welcome contributions! Whether it's bug reports, feature requests, or code contributions, every bit helps. Check out our Contribution Guidelines to get started.

Prisma2D is licensed under the MIT License - see the LICENSE file for details.

You might also like...
Check the reproducibility status of your Arch Linux packages (read-only mirror)
Check the reproducibility status of your Arch Linux packages (read-only mirror)

arch-repro-status A CLI tool for querying the reproducibility status of the Arch Linux packages using data from a rebuilderd instance such as reproduc

A concurrent, append-only vector
A concurrent, append-only vector

The vector provided by this crate suports concurrent get and push operations. Reads are always lock-free, as are writes except when resizing is required.

Answering the question nobody asked: what if you wanted to text your friends using only ARP?
Answering the question nobody asked: what if you wanted to text your friends using only ARP?

arpchat so... you know arp? the protocol your computer uses to find the mac addresses of other computers on your network? yeah. that. i thought it wou

try to find the correct word with only first letter and unknown letter count.

MOTUS Current dictionaries are provided in french and can contain some words not included in the official Motus dictionary. Additionally, dictionaries

A complete imgui-rs example using dependencies only from crates.io.
A complete imgui-rs example using dependencies only from crates.io.

Dear imgui-rs, hello. This is a fairly basic, but complete and standalone example application for the Rust version of dear imgui (https://github.com/o

Boxxy puts bad Linux applications in a box with only their files.

boxxy is a tool for boxing up misbehaving Linux applications and forcing them to put their files and directories in the right place, without symlinks!

Shell Escape for Typst typesetting system. Linux Only.

Shell Escape for Typst This is a simple shell escape for Typst. It allows you to run shell commands directly from Typst compiler. That said, it does n

A super simple /sbin/init for Linux which allows running one and only one program

Summary High-performance /sbin/init program for Linux This is designed to do literally nothing but accept binaries over the network and run them as a

Tumour-only somatic mutation calling using long reads

smrest smrest is a prototype somatic mutation caller for single molecule long reads. It uses haplotype phasing patterns for tumour samples that have a

Owner
Aggelos Tselios
Open source C/Rust developer. Linux user, primarily working with system programming and 2D graphics.
Aggelos Tselios
Rust vs C: Software Graphics Challenge

Rust vs C: Reto de Gráficos por Software Aprende Rust y C programando gráficos por software con efectos de demoscene clásica de los años 80. Episodios

null 9 Aug 26, 2023
A text renderer for Rust's embedded-graphics crate, based on U8g2

u8g2-fonts This crate is a pure Rust reimplementation of the font subsystem of U8g2. It is intended for the embedded-graphics ecosystem. Licensing Whi

null 4 Aug 29, 2022
Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust.

brusher Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust. ultimate goal My hope i

Brian Howard 17 Sep 4, 2024
Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.

Ember Ember is a simple and fun 2D rendering library for Rust, allowing you to quickly create graphics and interactive applications with ease. It uses

null 8 May 4, 2023
Super-lightweight Immediate-mode Embedded GUI framework, based on the awesome embedded-graphics library. Written in Rust.

Kolibri - A GUI framework made to be as lightweight as its namesake What is Kolibri? Kolibri is an embedded Immediate Mode GUI mini-framework very str

null 6 Jun 24, 2023
Revolutionize handheld gaming with adaptive game settings. Optimize graphics and gameplay experience based on real-time system metrics. Open-source project empowering developers to enhance games on portable devices

Welcome to the server-side application for the HarmonyLink project. This innovative software is developed with the Rust programming language and is ai

Jordon Brooks 5 Jun 28, 2023
12600+ icons pack for embedded graphics!

?? embedded-icon 12600+ ?? icons for embedded-graphics. ?? Features ?? Support to multiple icon packs - Easy to add support to! ?? Multiple resolution

Patrick José Pereira 3 Jul 24, 2023
Fast TLSH-compatible Fuzzy Hashing Library in pure Rust

fast-tlsh: Fast TLSH-compatible Fuzzy Hashing Library in pure Rust TLSH stands for Trendmicro Locality Sensitive Hash. TLSH can be used to detect simi

Tsukasa OI 4 Mar 27, 2024
Pure-Rust implementation of Fast Static Symbol Tables string compression

fsst-rs A pure-Rust, zero-dependency implementation of the FSST string compression algorithm. FSST is a string compression algorithm meant for use in

Spiral 78 Sep 29, 2024
Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.

unosolo Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers. Disclaimer This is my first Rust p

Vittorio Romeo 26 Jul 9, 2021