RazrFalcon / tiny-skia

A tiny Skia subset ported to Rust
BSD 3-Clause "New" or "Revised" License
1.05k stars 67 forks source link

const fn for Color::from_rgba8 #77

Open jeffreyrosenbluth opened 1 year ago

jeffreyrosenbluth commented 1 year ago

It would be nice to have a const version of this so it is possible to create color names in an application.

RazrFalcon commented 1 year ago

Will take a look. Does float operations already const in Rust?

Woodman3 commented 1 month ago

emmm,it still not,but i think const fn is stil should be add

RazrFalcon commented 1 month ago

It will be added when I would have time.

Woodman3 commented 1 month ago

I have see the source code and find it seem not easy to do it . Because from_rgba use NormalizedF32:new_u8() and this function is also not const. And to make this function constable it may use f32::from::<u8>() but it is also not constable...