ȣ #333 һΡεʼλԭ㣬ȺͿȷֱijȺͿȡӰԡıΪ 80 ؼӴֵ sans-serifˡEarthʡнʾ
canvas Ӱ
ע۲ĸԱߵķЧʵʹӰġ
CanvasԪִ֧ӶԴͼΪ˻ͼҪȼͼʹComponent.onCompleted¼ԴﵽһĿģ
onPaint: { var ctx = getContext("2d") // ͼ ctx.drawImage('assets/earth.png', 10, 10) // 浱ǰ״̬ ctx.save() // ƽϵ ctx.translate(100,0) ctx.strokeStyle = 'red' // üΧ ctx.beginPath() ctx.moveTo(10,10) ctx.lineTo(55,10) ctx.lineTo(35,55) ctx.closePath() ctx.clip() // ·ü // ͼӦòü ctx.drawImage('assets/earth.png', 10, 10) // · ctx.stroke() // ָ״̬ ctx.restore() } Component.onCompleted: { loadImage("assets/earth.png") }н£
canvas image
ĵͼϽΪ (10, 10) λãҲͼӦ·üͼ·Ա·üֻʹclip()ɡøú֮еĻƶ·УҲνüüڻָϴ״̬ʱȡ
һƪ һƪ