You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Activity
197g commentedon Jan 18, 2019
Different idea: Move away from an
enumto an opaquestructand provide someinto_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.