title: Cairo image blurred when scaled
body: <p>I have the following cairo code:</p>
  
  <pre><code>cairo_set_source_rgba(cr, 1, 1, 1, 1);
  cairo_rectangle(cr, 0, 0, WINDOW_SIZE, WINDOW_SIZE);
  cairo_fill(cr);
  cairo_scale(cr, 8, 8);
  draw_image(cr, "q.png", 5, 5);
  </code></pre>
  
  <p>And</p>
  
  <pre><code>void draw_image(cairo_t* cr, char* img_name, int x, int y)
  {
      cairo_translate(cr, x, y);
      cairo_surface_t* img = cairo_image_surface_create_from_png(img_name);
      cairo_set_source_surface(cr, img, 0, 0);
      cairo_paint(cr);
      cairo_translate(cr, -x, -y);
  }
  </code></pre>
  
  <p>q.png is a 5x5 image:
  <a href="https://i.stack.imgur.com/Dajg1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dajg1.png" alt="enter image description here"></a></p>
  
  <p>But when the program is run, the image is slightly blurred:<br>
  <a href="https://i.stack.imgur.com/ijba0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ijba0.png" alt="enter image description here"></a></p>
  
  <p>I have already tried</p>
  
  <pre><code>cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
  </code></pre>
  
  <p>but it does not work.</p>
  
  <p>Is there any way to fix this problem?</p>