Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Canvas rendered very poor quality image
QtWS25 Last Chance

Canvas rendered very poor quality image

Scheduled Pinned Locked Moved Solved QML and Qt Quick
canvasqmljavascriptimage
3 Posts 1 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    salarelv
    wrote on 11 Nov 2015, 08:38 last edited by
    #1

    Hi,

    I have canvas+javascript application on QML and we render map tiles on the canvas but the image is very poor quality.
    Screenshot

    The image is OK in HTML5 so this isn't a issue with the code/image itself.
    Here is the part that renders the tile:

    this.context.save();
    this.context.translate(T.getViewWidth()/2, T.getViewHeight()/2);
    this.context.rotate(this.wayfinder.options.map2DRotation*Math.PI/180);
    this.context.translate(-T.getViewWidth()/2, -T.getViewHeight()/2);

    this.context.translate(T.getZoomedMapPosition()[0], T.getZoomedMapPosition()[1]);

    this.context.scale(T.getZoom(), T.getZoom());
    this.context.drawImage(tile.image, tile.xwidth, tile.yheight, width, height);
    this.context.restore();

    Any ideas what should I try?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      salarelv
      wrote on 12 Nov 2015, 15:38 last edited by
      #2

      I think the issue is with using context.scale. If I remove that the image will be sharp again but it brakes the logic. Any ideas how can I go round that.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        salarelv
        wrote on 12 Nov 2015, 15:51 last edited by
        #3

        Answering my own question. By multiplying the drawImage coordinates by the zoom factor helped to solve it. Is this a bug of QML or something that I have read from the documentation?

        1 Reply Last reply
        0

        2/3

        12 Nov 2015, 15:38

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved