AuburnSounds / gamut

Image encoding and decoding library for D. Detailed layout control. Experimental codec QOIX.
Boost Software License 1.0
41 stars 2 forks source link

Improve image typing #29

Closed p0nce closed 1 year ago

p0nce commented 1 year ago
p0nce commented 1 year ago

Big question is: is there an interest for an unknown pixel type at runtime? this doesn't allow to do template type punning. Should having no type just be equivalent to being errored? In which case, image should start their life as errored. Simplify things. And errors should destroy the image type and data.

p0nce commented 1 year ago

New paradigm:

///                 Image                              Images can be: isError() or isValid().
///                /     \                             Image start their life as Image.init in error state.
///        isError()  or  isValid()                    Image that are `isValid` have a known PixelType, unlike `isError` images.

There was indeed no useful distinction between errored and "no type". Indeed T.init will be in errored state with message "image has no type".

p0nce commented 1 year ago

Okay!