Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Canvas blur filter?



  • Hi everybody,
    HTML based canvas has filter properties and methods. You can find at this link.

    I also need blur effect on Canvas element of Qt Quick. Below code doesn't create error also does not work. ctx.b is a Context2d element

        ctx.b.save();
        ctx.b.filter = 'blur(18px)';
        ctx.b.globalCompositeOperation = 'lighten';
        ctx.b.drawImage(canvas.a, 0, 0);
        ctx.b.restore();
    
    

    It seems Context2D QML doesn't support filters. How can I create a blur effect without the filter?
    You can find a full example is here at 178 line in ether.js.

    Thanks.


  • Moderators

    @CKurdu
    you even provide a link to the docs and didn't even check if there is a filter property?! o.O

    To come to your question, you can create a blur effect on the whole Canvas element.



  • @raven-worx said in Canvas blur filter?:

    you even provide a link to the docs and didn't even check if there is a filter property?! o.O

    Actually, I have realized it later, and I tried it but it doesn't give the same view as original javascript one. I think it is related to my code or maybe qt and html5 are using different algorithms. I don't know exactly.

    Thank you for your response.


Log in to reply