[cairo] Unable to create a blur image

Uli Schlachter psychon at znc.in
Fri Oct 11 07:20:21 UTC 2019


Hi,

On 10.10.19 13:15, Murali Krishna wrote:
> I have been trying to create a blur image in C++ using cairo library

You are not actually using cairo to blur the image. You are bluring it
yourself. Butokay, whatever.

> the code I used doesn't actually work.

"Doesn't actually work" is not the best error description I ever heard.

I took your code and removed the osg references. The attached program
loads "img.png" and writes "out.png". For me, this results in a blur, so
I guess your blurring code works.

However, your createBlur() function for some reason fills the whole
surface with blue and blurring a solid color is not really interesting.

(It is blue, because you use cairo_set_source_rgba(cr, b, g, a), so your
variable names do not match the order of function arguments.)

(It is the whole surface, because you use cairo_paint(). This fills the
whole surface. To just fill the current path, you would use
cairo_fill(). Which you also call...?)

Cheers,
Uli
-- 
“Some people are worth melting for.” - Olaf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BlurExample.cpp
Type: text/x-c++src
Size: 5397 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20191011/c09e1ad6/attachment.cpp>


More information about the cairo mailing list