Crate retro_pixel

Source
Expand description

This is a library for pushing pixels on the CPU.

It uses SIMD where possible, so it’s pretty fast. Run the benchmarks to decide if it’s fast enough for your use-case. The intent is more for smaller resolution situations like a retro console would have, but you can do 1080p if you want. Even without SIMD the indexed color mode at least can run at basically any resolution you want.

Note that this library will not put your pixels on the screen itself. You still have to use a GPU library of some sort to get stuff displayed. Examples are provided of how you might do that with glutin and gl, but you’re free to use anything else if you want.

All of the real work is done via traits, and you can create image slices to wrap around your existing image data. This allows you to quickly connect the library onto your existing image types if you need to. If you don’t have existing image types, there is a VecImage type provided. There’s also an example of an array-backed type, allowing you to use the library in a no_std situation (requires nightly). In the future, it’s hoped that this library will include feature flags to automatically support other crates, but not yet.

Re-exports§

pub use macros::*;
pub use palettes::*;
pub use u16_ext::*;
pub use u32_ext::*;

Modules§

macros
All of our macros go in here.
palettes
Module for color palettes you might wish to use with your indexed color images.
u16_ext
Module for code specific to u16 base images.
u32_ext
Module for code specific to u32 base images.

Macros§

check_misalign4
Checks that an address is aligned to a 4 byte bound.
check_misalign8
Checks that an address is aligned to a 8 byte bound.
check_misalign16
Checks that an address is aligned to a 16 byte bound.
check_misalign32
Checks that an address is aligned to a 32 byte bound.
determine_overlay
rgb16
As per rgba16, but automatically selects alpha=true.
rgb32
As per rgba32, but automatically selects alpha = 255.
rgba16
Builds a u16 value from the given RGBA values.
rgba32
Builds a u32 value from the given RGBA values.

Structs§

ImageMutRefIter
A struct that iterates over pixels of an Image by mutable reference.
ImageMutSlice
A mutable sub-view of some image data.
ImageRefIter
A struct that iterates over pixels of an Image by reference.
ImageSlice
A shared view of some image data.
NESImage
An image the size of an NES screen, backed by an array.
VecImage
An image backed by a Vec.

Traits§

ReadableImage
Trait for anything that can be read as if it was an image.
WritableImage
The trait for anything that can be written to as if it was an image.