Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28711

Canvas transformation does not apply correctly

    XMLWordPrintable

Details

    • 1b284d5f3491a24649d1c1e6d2746a00a513ed78

    Description

      var ctx = canvas.getContext('2d');
      ctx.save();
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      ctx.strokeStyle = 'white'
      ctx.lineWidth = 5;
      
      ctx.rotate(0.15)
      ctx.translate(100, 100);
      
      ctx.beginPath();
      ctx.moveTo(100, 100);
      ctx.lineTo(300, 100);
      
      ctx.stroke();
      
      ctx.fillStyle = 'steelblue'
      
      ctx.font = '20px sansserif'
      ctx.fillText('underlined text', 0, 0);
      
      ctx.restore();
      

      The transformation is not accumulated correctly:

      • The line is positioned at 100,100 and should be 100 pixels away from the text
      • The text and the line should have the same angle.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            leonlee Leonard Lee
            sletta Gunnar Sletta
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes