image icon indicating copy to clipboard operation
image copied to clipboard

Finalize DynamicImage enum

Open fintelia opened this issue 6 years ago • 1 comments

Similar in spirit to #855, the DynamicImage enum needs some definitive set of variants before a 1.0 release. One option is to match all types included in the ColorType enum. Another more limited option (meaning less implementation effort...) would be to only include a couple core types and require, possibly expensive conversions. A possible set would be: Luminance8, Luminance32, Luminance32f, Rgb8, Rgba8, and Rgba32f.

fintelia avatar Jan 18 '19 20:01 fintelia

Different idea: Move away from an enum to an opaque struct and provide some into_xxx(self) -> Result<XXX, Self> (only if exact match), as_xxx(&self) -> Option<&XXX>, convert_to_xxx(self) -> image::Result<XXX> (with conversions where possible, though we need some way to specify if lossy is okay, limits etc). That way, we can add new representations in backwards compatible manner at any point. One con is that we somehow need to come up with better dispatch than currently to make this work internally and the interface may loose functionality before we get to writing the definitive set of helping wrappers.

197g avatar Jan 18 '19 21:01 197g