Skip to content

Instantly share code, notes, and snippets.

@kuanyui
Created October 5, 2016 00:49
Show Gist options
  • Save kuanyui/3c561905b28e6fbf208ca3e3ea304a28 to your computer and use it in GitHub Desktop.
Save kuanyui/3c561905b28e6fbf208ca3e3ea304a28 to your computer and use it in GitHub Desktop.
Canvas {
id: canvasTest
property int ratio: Screen.devicePixelRatio
width: 100 //* ratio
height: 100 //* ratio
//scale: 1/ratio
Path {
id: myPath1
startX: 0; startY: 50
PathCurve { x: 25; y: 15 }
PathCurve { x: 50; y: 53 }
PathCurve { x: 75; y: 40 }
PathCurve { x: 100; y: 65 }
}
Path {
id: myPath2
startX: 0; startY: 50
PathCurve { x: 25; y: 49 }
PathCurve { x: 50; y: 40 }
PathCurve { x: 75; y: 36 }
PathCurve { x: 100; y: 70 }
}
onPaint: {
var ctx = getContext("2d")
//ctx.scale(ratio, ratio)
//ctx.save();
ctx.lineWidth = 1
ctx.strokeStyle = "blue"
ctx.path = myPath1;
ctx.stroke();
ctx.path = myPath2
ctx.stroke();
// stroke using line width and stroke style
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment