QtQuick antialiasing



  • Hi!
    I'm new to qtquick 2.0 and I'm playing with some examples.
    Lets look into the example shipped with qt - how to draw bezeir curve. The curve is drawnm but it is not antialiased.

    Is it possible (if yes, how?) to antialias thinks drawn with qtquick?



  • Hi!
    I've found the solution.
    In the shipped example QSurfaceFormat is not used. If you use it like this:
    @
    QQuickView view;
    QSurfaceFormat format;
    format.setSamples(16);
    view.setFormat(format);
    ...@

    The picture is antialiased



  • You can set the "antialiasing" property to true on any item, including the Canvas. From the documentation:

    "Primarily used in Rectangle and image based elements to decide if the item should use antialiasing or not. Items with antialiasing enabled require more memory and are potentially slower to render.

    The default is false"

    I think the default should really be true for some items like the Canvas at least.



  • I tested the Rectagle item with antialiasung property set to true and it was not antialiased until I used the QSurfaceFormat.
    Additional - there is no info about how this antialiasing will be created - using this property, it would be (theoretically) multisampled? With how many samples?



  • The Rectangle item should get antialiased without changing the QSurfaceFormat, it doesn't use multisampling. Of course it will only be antialiased if it has a rounded corner (a radius set), otherwise there's nothing to antialias.

    A bezier curve however is a custom item and will probably need multisampling to be antialiased, it all depends on how it is being rendered.



  • @capisce: the ROTADED box without radius is not being antialiased.



  • It should be, if you do "antialiasing: true" in the Rectangle. Here's an example, run it with qmlscene:

    @
    import QtQuick 2.0

    Rectangle {
    width: 800
    height: 600

    Rectangle {
        x: 200
        y: 200
        width: 400
        height: 200
        rotation: 20
        antialiasing: true
        color: "red"
    
        MouseArea {
            anchors.fill: parent
            onPressed: { parent.antialiasing = !parent.antialiasing }
        }
    }
    

    }
    @



  • but there is a problem with antialiasing property in qtquick2.0. It usage high CPU in animating objects. For resolving that i have changed my graphic card settings instead of antialiasing property.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.