[Interest] Anti-aliasing for QML Canvas on Windows?

Mark markg85 at gmail.com
Fri May 3 00:03:55 CEST 2013


On Thu, May 2, 2013 at 11:47 PM, Mark <markg85 at gmail.com> wrote:
> On Tue, Mar 12, 2013 at 12:22 AM, Bache-Wiig Jens
> <Jens.Bache-Wiig at digia.com> wrote:
>>> Hi,
>>> Sorry for delay, I had not seen your question
>>> To enable antialiasing in Qt Quick Canvas, you must set the property "antialiasing" to "true" and set the property "renderTarget" to "Canvas.Image"
>>> Guillaume
>>
>> True. It might also be worth mentioning that we also plan to make this the default setting on Canvas items in Qt 5.1.
>>
>> Jens
>>
>>>
>>> On Fri, Feb 15, 2013 at 7:49 PM, Mark <markg85 at gmail.com
>>> > wrote:
>>> >
>>>  Hi,
>>>
>>> >
>>> >
>>>  I'm drawing some shapes on Windows 7 with QML Canvas, but the output
>>>
>>> >
>>>  really seems aliased as in the anti-aliasing is off.
>>>
>>> >
>>> >
>>>  The code:
>>>
>>> >
>>> >
>>>  import QtQuick 2.0
>>>
>>> >
>>> >
>>>  Item {
>>>
>>> >
>>>      width: 400
>>>
>>> >
>>>      height: 400
>>>
>>> >
>>> >
>>>      Canvas {
>>>
>>> >
>>>          id:canvas
>>>
>>> >
>>>          width:400
>>>
>>> >
>>>          height:400
>>>
>>> >
>>>          antialiasing: true
>>>
>>> >
>>> >
>>>          property string strokeStyle:"green"
>>>
>>> >
>>>          property string fillStyle:"yellow"
>>>
>>> >
>>>          property int lineWidth:10
>>>
>>> >
>>>          property bool fill:true
>>>
>>> >
>>>          property bool stroke:true
>>>
>>> >
>>> >
>>> >
>>>      onPaint: {
>>>
>>> >
>>>            var ctx = canvas.getContext('2d');
>>>
>>> >
>>>            ctx.save();
>>>
>>> >
>>>            ctx.clearRect(0, 0, canvas.width, canvas.height);
>>>
>>> >
>>>            ctx.strokeStyle = canvas.strokeStyle;
>>>
>>> >
>>>            ctx.fillStyle = canvas.fillStyle;
>>>
>>> >
>>>            ctx.lineWidth = canvas.lineWidth;
>>>
>>> >
>>> >
>>>            ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle
>>>
>>> >
>>> >
>>>            if (canvas.fill)
>>>
>>> >
>>>               ctx.fill();
>>>
>>> >
>>>            if (canvas.stroke)
>>>
>>> >
>>>               ctx.stroke();
>>>
>>> >
>>> >
>>>            ctx.restore();
>>>
>>> >
>>>          }
>>>
>>> >
>>>      }
>>>
>>> >
>>>  }
>>>
>>> >
>>> >
>>>  I'm using Qt 5.0.1 mingw build x86 on Windows 7.
>>>
>>> >
>>> >
>>>  Cheers,
>>>
>>> >
>>>  Mark
>>>
>>>
>>> Anyone?
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
> Hi,
>
> A late followup on this one. I just tried out
> http://download.qt-project.org/snapshots/qt/5.1/5.1.0-beta1/backups/2013-05-02-11/qt-windows-opensource-5.1.0-beta1-mingw47-x86-offline-2013-05-02-11.exe
> and ran the example in:
> C:\Qt\Qt5.1.0\5.1.0-beta1\mingw47_32\examples\quick\canvas. I noticed
> (quite fast) that antialiasing is not enabled.
>
> Another ANGLE issue?
>
> My graphics card is an nvidia one with an intel cpu so i guess the
> hardware setup is roughly ideal.
>
> Any reason why antialiasing is not on?
>
> Cheers,
> Mark

Note: it does properly antialias when i set the renderTarget to
Canvas.Image but i suppose it should just work with
Canvas.FramebufferObject as well. I also tried the opengl package
http://download.qt-project.org/snapshots/qt/5.1/5.1.0-beta1/backups/2013-05-02-11/qt-windows-opensource-5.1.0-beta1-msvc2012_opengl-x86_64-offline-2013-05-02-11.exe
which works exactly the same as the mingw one. Don't know if both ones
are using angle or not but i tried nonetheless.



More information about the Interest mailing list