[SVG] problem with SVG image drawing with Batik Library

M

Mardagg

Hello!
I have a problem with Batik library in order to manipulate SVG images.
I have a panel that paints elements. Each element contains SVG image
(JSVGCanvas). I added methods to resize the image with the mouse but
unfortunately the JSVGCanvas is not updated every time (some time
there's only a few part of the image that is painted for example). I
would know if someone already had this problem and how to solve it ^^
Here's some summary of my code if necessary:

public class Materiel{
protected JSVGCanvas svgCanvas;
// ...

public Materiel(String nom, int x, int y, int l, int h) {
// ...

// initialise SVG image
svgCanvas = new JSVGCanvas();
File f = new File("aiv/images/pc_g.svg");
try {
svgCanvas.setURI(f.toURL().toString());
} catch (IOException ex) {
ex.printStackTrace();
}
svgCanvas.setBounds(getX(), getY(), getWidth(),
getHeight());
}

public void dessiner(Graphics g){
// ...

int w = (int)(getWidth()*Donnees.zoom);
int h = (int)(getHeight()*Donnees.zoom);

// ...

svgCanvas.setSize(w, h);
svgCanvas.setBackground(new Color(0, 0, 0, 0));

svgCanvas.paintComponent(g);
}
}



Thanks for your help ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top