Note that there are some explanatory texts on larger screens.

plurals
  1. POSVG Circle Resolution in Java
    text
    copied!<p>I have a circle represented in SVG by :</p> <pre class="lang-svg prettyprint-override"><code> &lt;circle cx="50" cy="50" r="50" stroke="black" stroke-width="1" style="fill:white"/&gt; </code></pre> <p>I then convert this circle to a BufferedImage in Java with width and height = 100 and imageType = BufferedImage.TYPE_INT_ARGB.I then draw this BufferedImage onto another via the following code : </p> <pre class="lang-java prettyprint-override"><code> BufferedImage source = ImageIO.read(new File("imgToDrawOnto.png")); Graphics g = source.getGraphics(); g.drawImage(circleImg, 100, 100, null); </code></pre> <p>where circleImg is the BufferedImage of the SVG circle.This works fine and draws onto the image however it comes out very pixelated.Is there any way I can get a smoother circle?I would prefer to keep using SVG,but other ways can also be considered if there is no way in SVG.</p> <p>Things I have tried:</p> <ol> <li>I have set the radius of the circle to 500 and left the BufferedImage height and width at 100.</li> <li>I have set the BufferedImage height and width to 1000 and used the draw method which takes height and width as arguments and made them 100.</li> <li>I have done both 1 and 2 at the same time.</li> <li>I have also tried making the radius even bigger ie. 2500</li> <li>I also changed the circleImg argument to circleImg.getScaledInstance(100, 100, 1)</li> </ol> <p>Nothing has worked.Some seem smoother,but not by alot and others look worse.Also something to note is I also observe the pixelation when using g.drawOval(150, 150, 100, 100).This leads me to believe the problem is not with SVG,but I may be wrong.</p> <p>Any help appreciated.</p> <p>Java Version:</p> <pre> java version "1.6.0_30" Java SE Runtime Enviroment (build 1.6.0_30-b12) Java HotSpot 64-bit Server VM (build 20.5-b03, mixed mode) </pre> <p>For SVG I am using SVG-Salamander v1.0</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload