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
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