[SVG] probleme dessin d'images SVG avec Batik

M

Mardagg

Bonjour a tous,
j'ai un probleme avec la bibliotheque Batik pour manipuler des images
SVG (images vectorielles).
J'ai un panel qui dessine des éléments. Chaque élément contient une
image SVG (JSVGCanvas). J'ai ajouté des methodes pour pouvoir
redimensionner l'image avec la souris mais malheureusement le
JSVGCanvas ne se met pas tout le temps a jour (parfois il n'y a qu'une
partie de l'image qui se dessine par exemple). Je voulais savoir si
quelqu'un a deja été confronté à se genre de problème et si oui
comment faire ^^
Voici des extraits de mon code au besoin :


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

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

// initialisation de l'image SVG
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); // la variable
Donnees.zoom est un indice representant un zoom sur l'objet
int h = (int)(getHeight()*Donnees.zoom);

// ...

svgCanvas.setSize(w, h);
svgCanvas.setBackground(new Color(0, 0, 0, 0)); // definit
le fond transparent

svgCanvas.paintComponent(g);
}
}

J'ai vu qu'il existait l'interface UpdateManagerListener dans la
bibliotheque Batik mais je n'ai pas tres bien compris comment ca
marchait ...
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top