Changeset 14334 in josm
- Timestamp:
- 2018-10-14T21:50:40+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/kitfox/svg/ImageSVG.java
r14328 r14334 119 119 imageSrc = new URL(null, src.toASCIIString(), new Handler()); 120 120 } 121 else 122 { 123 if (!diagram.getUniverse().isImageDataInlineOnly())121 else if (!diagram.getUniverse().isImageDataInlineOnly()) 122 { 123 try 124 124 { 125 try 126 { 127 imageSrc = src.toURL(); 128 } catch (Exception e) 129 { 130 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 131 "Could not parse xlink:href " + src, e); 132 imageSrc = null; 133 } 125 imageSrc = src.toURL(); 126 } catch (Exception e) 127 { 128 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 129 "Could not parse xlink:href " + src, e); 130 imageSrc = null; 134 131 } 135 132 } … … 140 137 } 141 138 142 diagram.getUniverse().registerImage(imageSrc); 143 144 //Set widths if not set 145 BufferedImage img = diagram.getUniverse().getImage(imageSrc); 146 if (img == null) 147 { 139 if (imageSrc != null) 140 { 141 diagram.getUniverse().registerImage(imageSrc); 142 143 //Set widths if not set 144 BufferedImage img = diagram.getUniverse().getImage(imageSrc); 145 if (img == null) 146 { 147 xform = new AffineTransform(); 148 bounds = new Rectangle2D.Float(); 149 return; 150 } 151 152 if (width == 0) 153 { 154 width = img.getWidth(); 155 } 156 if (height == 0) 157 { 158 height = img.getHeight(); 159 } 160 161 //Determine image xform 148 162 xform = new AffineTransform(); 149 bounds = new Rectangle2D.Float(); 150 return; 151 } 152 153 if (width == 0) 154 { 155 width = img.getWidth(); 156 } 157 if (height == 0) 158 { 159 height = img.getHeight(); 160 } 161 162 //Determine image xform 163 xform = new AffineTransform(); 164 xform.translate(this.x, this.y); 165 xform.scale(this.width / img.getWidth(), this.height / img.getHeight()); 166 163 xform.translate(this.x, this.y); 164 xform.scale(this.width / img.getWidth(), this.height / img.getHeight()); 165 } 167 166 bounds = new Rectangle2D.Float(this.x, this.y, this.width, this.height); 168 167 } … … 337 336 URI src = sty.getURIValue(getXMLBase()); 338 337 339 URL newVal ;338 URL newVal = null; 340 339 if ("data".equals(src.getScheme())) 341 340 { 342 341 newVal = new URL(null, src.toASCIIString(), new Handler()); 343 } else 342 } else if (!diagram.getUniverse().isImageDataInlineOnly()) 344 343 { 345 344 newVal = src.toURL(); 346 345 } 347 346 348 if ( !newVal.equals(imageSrc))347 if (newVal != null && !newVal.equals(imageSrc)) 349 348 { 350 349 imageSrc = newVal;
Note:
See TracChangeset
for help on using the changeset viewer.