I am trying to take advantage of the convolution capabilities of the
GIL (with the numeric extension of course). I have some text that I
render first using Cairo and then I pass the raw image data along to
the code I'm using with the GIL with some simple glue code. This much
of my code works great - I can write out a PNG using png_write_view
after handing the data off to the library and it contains the rendered
text as I would expect. There is a problem I've encountered, however,
where the anti-aliasing pixels of the white text I have rendered
against a transparent background appear dark and the blurred part of
the text after convolving the image is also dark. I'm pretty sure
this is due to the fact that the raw RGBA data I pass along already
contains premultiplied alpha from Cairo. I'm guessing that the data
is treated as if the alpha has not been premultiplied. I've been
trying to figure out the best way to handle this situation and have
had very little success in getting anything to work. I have recently
been attempting to try one of the 2 things listed in this mailing list
post by Lubomir Bourdev where he gives an example of approaches one
could take to handle premultiplied RGBA data:
http://lists.boost.org/Archives/boost/2006/10/112532.php. No matter
what I try, however, I just keep getting endless compile errors and am
probably going about it all wrong.
Right now I've been trying to do something where I create types to
represent premultiplied RGBA data:
namespace boost {
namespace gil {
struct premultiplied_rgba_t : public rgba_t {};
typedef layout