-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derive AnyBitPattern for ColorU8 #120
Comments
Why do you even need to cast |
Because I need to demultiply the Pixmap and still have it in Vec form to pass it to |
Pixmap cannot be demultiplied. You should call |
Right, but I'm trying to do it in place, which means that during the loop the slice will actually contain a mix of multiplied and demultiplied colors that AFAIK can't be represented in safe Rust. I guess I could represent that with a union to avoid the cast/transmute in the demultiply() loop, but unions are unsafe too. Or are you suggesting I reinvent the |
I still don't understand what you're trying to do. If you're trying to demultiply a Pixmap then it's not possible by design. If you're trying do demultiply just a |
If ColorU8 derived AnyBitPattern, I'd be able to replace the
transmute
calls in this method with bytemuck'scast
and remove the unsafe code. This will be possible even ifbytemuck
becomes an optional dependency; it'll just have to be guarded bycfg_attr
.https://github.com/Pr0methean/OcHd-RustBuild/blob/main/main/src/image_tasks/png_output.rs#L312-L324
The text was updated successfully, but these errors were encountered: