title: In canvas the alpha value of a stroke gets lost after another one
body: <p>I'm creating a drawing program witch should also use semi-transparent brushes. When I use a transparent brush I end up with some transparent strokes, witch are the lasts until I release the mouse. If I then draw a new stroke again my old strokes get full opacity, even if I don't come across them. The program works getting mouse coordinates, waiting for position changed, and then draws (and strokes) a line which goes from the first point to the second. I have seen that some tutorial suggests to store in memory (array) all the path and draw it again on every mouse release, but I'm not sure due to memory consumption. The program is written in QML + javascript, but canvas works in the same way as does in HTML5.</p>
  
  <p>Thank you in advance to everybody.</p>
  
  <p>The following is the context call:</p>
  
  <pre><code>function pencilBehaviour() {
      if (canvas.isPressed){
          var ctx = canvas.getContext('2d')
          if ((canvas.bufferX != -1) || (canvas.bufferY != -1)){
  
              ctx.globalCompositeOperation = "source-atop"
              ctx.moveTo(canvas.bufferX, canvas.bufferY)
              ctx.lineTo(canvas.px, canvas.py)
              ctx.globalAlpha = 0.4
              ctx.lineCap = "round"
              ctx.lineJoin = "round"
              ctx.strokeStyle = "white"
              ctx.lineWidth = 3
              ctx.stroke()
              console.log("pencil invoking canvas")
  
              //Buffers are needed to draw a line from buffer to current position
              canvas.bufferX = canvas.px
              canvas.bufferY = canvas.py
  
  
          }
          else{
              //Buffers are needed to draw a line from buffer to current position
              canvas.bufferX = canvas.px
              canvas.bufferY = canvas.py
          }
      }
  }
  </code></pre>