Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
Mac OS 10.6.8
-
afaeabeb5a4344b4e05c98e665e8bf6d86594738
Description
It appears that Canvas disables the "smooth" capability if the canvas renderTarget is not set to Canvas.Image (even if smooth is set to true).
I've attached an image that shows the output when the renderTarget is not set to Canvas.Image.
import QtQuick 2.0 Rectangle { width: 600; height: 500 focus: true Keys.onReturnPressed: { print('repainting...') canvas.requestPaint() } Canvas { id: canvas width: parent.width height: parent.height smooth: true // renderTarget: Canvas.Image // if this is set, rendered output is smooth onPaint: { var ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(75,25); ctx.quadraticCurveTo(25,25,25,62.5); ctx.quadraticCurveTo(25,100,50,100); ctx.quadraticCurveTo(50,120,30,125); ctx.quadraticCurveTo(60,120,65,100); ctx.quadraticCurveTo(125,100,125,62.5); ctx.quadraticCurveTo(125,25,75,25); ctx.lineWidth = 3 ctx.closePath(); ctx.strokeStyle = "steelblue"; ctx.fillStyle = "yellow"; ctx.fill(); ctx.stroke(); ctx.fillStyle="green"; ctx.font = "Bold 15px"; ctx.fillText("QML Rocks!", 35, 60); } } }