Crate retro_pixel[−][src]
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 (I wouldn't actually use this lib with a phone app, for example). 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 support the indexed color mode stuff 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
. (In the future, it's hoped that this library will include
feature flags to automatically support other crates, but not in this
version.)
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 |
u32_ext |
Module for code specific to |
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 |
rgb32 |
As per |
rgba16 |
Builds a |
rgba32 |
Builds a |
Structs
ImageMutRefIter |
A struct that iterates over pixels of an |
ImageMutSlice |
A mutable sub-view of some image data. |
ImageRefIter |
A struct that iterates over pixels of an |
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 |
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. |