This is heavily in development. Only use this if you like bugs.
Why not? Honestly, it's not a great library. Mypaint suffers from it being too generic, and nothing else uses it (to my knowledge) because it's not generic enough. It being written in C means there's likely dozens of major bugs that haven't been discovered yet. In the end, libmypaint really needs a fresh start.
- Step 1: Have a fully ABI-compatible libmypaint.so generated entirely in Rust with no C inter-op outside of FFI.
- Step 2: Clean this shit up. A direct port of C code to Rust does not look pretty.
- Step 3?: Possibly try and move some of the C++ in Mypaint to Rust. rust-cpython will help with this.
- Ultimate goal: Fully eliminate all unsafe code from Mypaint.
There's a few side goals as well, that I'm sure are manageable. For example, leveraging Rust's excellent concurrency tools to fully parallelize brush stroke painting would be pretty nice. Also a fully-featured test suite will make lives much easier.
Around 70% ported. Got a few bugs that need hunting down, which is annoying because of the lack of testing beyond "open Mypaint and draw a bit". Most functions are ported over to equivalent Rust, and some areas that aren't publicly exposed have been cleaned up a lot. Progress is slow but steady, as I tend to be busy, so chances are if you find something broken, a PR would really help out.
The current layout of the project is:
- This crate is generating a .so
- The .so is dynamically linked with C libmypaint's .so
- Functions are removed from the C code, causing the linker to automatically use the Rust functions instead
- Running Mypaint just involves telling it where our Rust-augmented libmypaint is
Steps:
- Install Rust if you haven't already and run
cargo build --release
in this project. - Clone the libmypaint repo
- Checkout f052590 (just in case changes make incompatibilities pop up, which is unlikely as libmypaint development is slow)
- Follow libmypaint's compilation guide, but replace
./configure
with./configure LDFLAGS="-L/path/to/rustport/target/release/ -lrustport"
- It should make properly without complaining. If it doesn't then uh, make an issue?
- Clone Mypaint and follow its installation instructions.
- Export
LD_PRELOAD
as/path/to/our/libmypaint/.libs/libmypaint.so
andLD_LIBRARY_PATH
as/path/to/rustport/target/release/
- Run Mypaint and pray that it works.