title: JavaFX reset graphics Context after scaling a canvas
body: <p>I'm trying to make a chart without using any 3rd party libs. I've a zoom feature which scales the Canvas correctly, but now I need to redraw everything inside the canvas once again. </p>
  
  <p>But when I do scaling the <code>GrapphicsContext</code> also scales and blots. I want to readjust the blotting and show points in normal drawing once zoomed. How can I achieve this?</p>
  
  <p>Here is simple snippet that I'm redrawing:</p>
  
  <pre><code>private void redrawImage(Canvas canvas, int scale) {
        GraphicsContext gc = canvas.getGraphicsContext2D();
        gc.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
        gc.scale(scale, scale);
        gc.setStroke(Color.RED);
        gc.setLineWidth(2);
        gc.strokeRect(0, 0, canvas.getWidth(), canvas.getHeight());
        gc.setStroke(Color.GREEN);
        gc.strokeLine(0, 0, canvas.getWidth(), canvas.getHeight());
        gc.strokeLine(0, canvas.getHeight(), canvas.getWidth(), 0);
        gc.setStroke(Color.BLUE);
        gc.strokeText("TEXT", 50, 50);
  
    }
  </code></pre>
  
  <p>Even I remove <code>gc.scale(X,Y)</code> I still see the blotted points or text, I want the scale to be always 1, but I should also zoom or scale simultaneously.</p>
  
  <p>What I want to achieve is like the <strong>GoogleMaps</strong> overlaying, you see the objects when zoomed in or out are recalibrated and adjusted to a viewable scale. This is exactly what I want to achieve.</p>