OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 181 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 181 Rev 183
Line 94... Line 94...
94
 
94
 
95
                } else if (name.equals("image")) {
95
                } else if (name.equals("image")) {
96
                    String fileName = element.getAttribute("file");
96
                    String fileName = element.getAttribute("file");
97
                    int x = Math.round(ratio * Integer.parseInt(element.getAttribute("x")));
97
                    int x = Math.round(ratio * Integer.parseInt(element.getAttribute("x")));
98
                    int y = Math.round(ratio * Integer.parseInt(element.getAttribute("y")));
98
                    int y = Math.round(ratio * Integer.parseInt(element.getAttribute("y")));
99
                    BufferedImage img = ImageIO.read(new File(graphicsPL.getImageDir(), fileName));
99
                    final File input = new File(graphicsPL.getImageDir(), fileName);
-
 
100
                    if (input.exists()) {
-
 
101
                        BufferedImage img = ImageIO.read(input);
100
                    int w = Math.round(ratio * img.getWidth());
102
                        int w = Math.round(ratio * img.getWidth());
101
                    int h = Math.round(ratio * img.getHeight());
103
                        int h = Math.round(ratio * img.getHeight());
102
                    if (element.hasAttribute("width")) {
104
                        if (element.hasAttribute("width")) {
103
                        w = Math.round(ratio * Integer.parseInt(element.getAttribute("width")));
105
                            w = Math.round(ratio * Integer.parseInt(element.getAttribute("width")));
104
                    }
106
                        }
105
                    if (element.hasAttribute("height")) {
107
                        if (element.hasAttribute("height")) {
106
                        h = Math.round(ratio * Integer.parseInt(element.getAttribute("height")));
108
                            h = Math.round(ratio * Integer.parseInt(element.getAttribute("height")));
107
                    }
109
                        }
108
                    drawImage(x, y, w, h, img);
110
                        drawImage(x, y, w, h, img);
-
 
111
                    } else {
-
 
112
                        throw new IllegalStateException(input.getAbsolutePath() + " not found");
-
 
113
                    }
109
 
114
 
110
                } else if (name.equals("barcode")) {
115
                } else if (name.equals("barcode")) {
111
                    int x = Math.round(ratio * Integer.parseInt(element.getAttribute("x")));
116
                    int x = Math.round(ratio * Integer.parseInt(element.getAttribute("x")));
112
                    int y = Math.round(ratio * Integer.parseInt(element.getAttribute("y")));
117
                    int y = Math.round(ratio * Integer.parseInt(element.getAttribute("y")));
113
                    int h = 0;
118
                    int h = 0;