fix(io): can't read a png with the bitmap reader service
Description
module_io_bitmap::reader
fails to open a simple PNG image with the default configuration. The backend PNG needs explicitly to be added.
Steps to reproduce
In any app, add a service like:
<service uid="bitmap_reader_srv" type="sight::module::io::bitmap::reader">
<inout key="data" uid="bitmap_image" />
<file>path/to/image.png</resource>
</service>
...
<start uid="bitmap_reader_srv" />
...
<update uid="bitmap_reader_srv" />
You will receive an error saying that the PNG cannot be opened.
Functional specifications
Actually, the current configuration is really overkill. We don't really want to prevent people from having the png or tiff backend. Our only real need here is to ensure we use the GPU backends when we require it for performances reasons. Otherwise, we can live fine with the defaults, which means use the best available option depending on the hardware. Thus I propose to change the current configuration from
<service type="sight::module::io::bitmap::reader">
<inout key="data" uid="..." />
<file>...</file>
<dialog>...</dialog>
<backends enable="gpu|cpu|all">
<libtiff>
<libpng>
...
<backends/>
</service>
into:
<service type="sight::module::io::bitmap::reader">
<inout key="data" uid="..." />
<file>...</file>
<dialog>...</dialog>
<gpu_required>true|false</gpu_required>
</service>
To be consistent, I also propose to do the same for the writer:
<service type="sight::module::io::bitmap::writer">
<in key="data" uid="..." />
<file>...</file>
<dialog>...</dialog>
<gpu_required>true|false</gpu_required>
<mode>best|fast</mode>
</service>
Technical specifications
Simply enable all possible built backends and trigger an error if a gpu backend is not available if required in the configuration.
Test plan
- Unit-tests
- Repeat steps to reproduce.