I have a circle represented in SVG by :
<circle cx="50" cy="50" r="50" stroke="black" stroke-width="1" style="fill:white"/>
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 :
BufferedImage source = ImageIO.read(new File("imgToDrawOnto.png"));
Graphics g = source.getGraphics();
g.drawImage(circleImg, 100, 100, null);
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.
Things I have tried:
- I have set the radius of the circle to 500 and left the BufferedImage height and width at 100.
- 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.
- I have done both 1 and 2 at the same time.
- I have also tried making the radius even bigger ie. 2500
- I also changed the circleImg argument to circleImg.getScaledInstance(100, 100, 1)
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.
Java Version:
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)
For SVG I am using SVG-Salamander v1.0