Changeset 7134 in josm
- Timestamp:
- 2014-05-15T20:03:47+02:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7132 r7134 63 63 import org.w3c.dom.Element; 64 64 import org.w3c.dom.Node; 65 import org.w3c.dom.NodeList; 65 66 import org.xml.sax.Attributes; 66 67 import org.xml.sax.EntityResolver; … … 1272 1273 Node root = metadata.getAsTree(f); 1273 1274 if (root instanceof Element) { 1274 Node item = ((Element)root).getElementsByTagName("TransparentColor").item(0); 1275 if (item instanceof Element) { 1276 String value = ((Element)item).getAttribute("value"); 1277 String[] s = value.split(" "); 1278 if (s.length == 3) { 1279 int[] rgb = new int[3]; 1280 try { 1281 for (int i = 0; i<3; i++) { 1282 rgb[i] = Integer.parseInt(s[i]); 1275 NodeList list = ((Element)root).getElementsByTagName("TransparentColor"); 1276 if (list.getLength() > 0) { 1277 Node item = list.item(0); 1278 if (item instanceof Element) { 1279 String value = ((Element)item).getAttribute("value"); 1280 String[] s = value.split(" "); 1281 if (s.length == 3) { 1282 int[] rgb = new int[3]; 1283 try { 1284 for (int i = 0; i<3; i++) { 1285 rgb[i] = Integer.parseInt(s[i]); 1286 } 1287 return new Color(rgb[0], rgb[1], rgb[2]); 1288 } catch (IllegalArgumentException e) { 1289 Main.error(e); 1283 1290 } 1284 return new Color(rgb[0], rgb[1], rgb[2]);1285 } catch (IllegalArgumentException e) {1286 Main.error(e);1287 1291 } 1288 1292 } 1289 1293 } 1290 1294 } -
trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java
r7132 r7134 29 29 assertThat(ImageProvider.read(file, true, false).getTransparency(), is(Transparency.OPAQUE)); 30 30 } 31 32 /** 33 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/10030">#10030</a> 34 * @throws IOException if an error occurs during reading 35 */ 36 @Test 37 public void testTicket10030() throws IOException { 38 File file = new File(TestUtils.getTestDataRoot()+"regress/10030/tile.jpg"); 39 ImageProvider.read(file, true, true); 40 } 31 41 }
Note:
See TracChangeset
for help on using the changeset viewer.