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

Bache-Wiig Jens Jens.Bache-Wiig at digia.com
Tue Mar 12 00:22:31 CET 2013


> 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




More information about the Interest mailing list