Hi Ben,
On 13.03.2018 18:06, Nobody III wrote:
Will do. Thanks. The only problem I see now is the Framebuffer interface using 16-bit color, which lacks transparency. With 32-bit color, this should work perfectly, and can even be extended to text rendering.
that's a good point. The color values are limited to 16 bit for the time being. But it is actually possible to supplement the framebuffer with alpha values, by following the convention used by nitpicker.
Nitpicker hands out virtual framebuffers where the pixel buffer is followed by an equally-sized alpha buffer that uses one byte per value. (there is actually even another buffer following the alpha buffer that contains input-mask values)
A client can detect the presence of the alpha buffer by comparing the size of the framebuffer dataspace with the bytes required for the mode plus alpha buffer. If an alpha buffer is present, its pointer can be computed from the start of the pixel buffer as follows:
Pixel_alpha8 *alpha_base = fb_ds.local_addr<Pixel_alpha8>() + mode.bytes_per_pixel()*size().count();
Maybe you can follow the same convention for your image renderer?
BTW, once when we will change Genode's color depth to 8 bits per pixel (presumably sometime later this year), I intend to retain the separation of the alpha buffer from the pixel values. So your code won't require big adaptations then.
If you like to look at an example of using alpha values with the framebuffer, you may find [1] illustrative. It uses nitpicker as back end (not the framebuffer directly) but it shows the principle idea.
[1] https://github.com/genodelabs/genode/blob/master/repos/gems/include/gems/nit...
Cheers Norman