- Timestamp:
- 2011-12-22T18:13:15+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r4241 r4698 85 85 86 86 boolean error = tracker.isErrorID(1); 87 if (img.getWidth(null) == 0 || img.getHeight(null) ==0) {87 if (img.getWidth(null) < 0 || img.getHeight(null) < 0) { 88 88 error = true; 89 89 } … … 96 96 } 97 97 98 ImageDisplay.this.image = img; 99 visibleRect = new Rectangle(0, 0, img.getWidth(null), img.getHeight(null)); 100 101 final int w = (int) visibleRect.getWidth(); 102 final int h = (int) visibleRect.getHeight(); 103 104 outer: { 105 final int hh, ww, q; 106 final double ax, ay; 107 switch (orientation) { 108 case 8: 109 q = -1; 110 ax = w / 2; 111 ay = w / 2; 112 ww = h; 113 hh = w; 114 break; 115 case 3: 116 q = 2; 117 ax = w / 2; 118 ay = h / 2; 119 ww = w; 120 hh = h; 121 break; 122 case 6: 123 q = 1; 124 ax = h / 2; 125 ay = h / 2; 126 ww = h; 127 hh = w; 128 break; 129 default: 130 break outer; 98 if (!error) { 99 ImageDisplay.this.image = img; 100 visibleRect = new Rectangle(0, 0, img.getWidth(null), img.getHeight(null)); 101 102 final int w = (int) visibleRect.getWidth(); 103 final int h = (int) visibleRect.getHeight(); 104 105 outer: { 106 final int hh, ww, q; 107 final double ax, ay; 108 switch (orientation) { 109 case 8: 110 q = -1; 111 ax = w / 2; 112 ay = w / 2; 113 ww = h; 114 hh = w; 115 break; 116 case 3: 117 q = 2; 118 ax = w / 2; 119 ay = h / 2; 120 ww = w; 121 hh = h; 122 break; 123 case 6: 124 q = 1; 125 ax = h / 2; 126 ay = h / 2; 127 ww = h; 128 hh = w; 129 break; 130 default: 131 break outer; 132 } 133 134 final BufferedImage rot = new BufferedImage(ww, hh, BufferedImage.TYPE_INT_RGB); 135 final AffineTransform xform = AffineTransform.getQuadrantRotateInstance(q, ax, ay); 136 final Graphics2D g = rot.createGraphics(); 137 g.drawImage(image, xform, null); 138 g.dispose(); 139 140 visibleRect.setSize(ww, hh); 141 image.flush(); 142 ImageDisplay.this.image = rot; 131 143 } 132 133 final BufferedImage rot = new BufferedImage(ww, hh, BufferedImage.TYPE_INT_RGB);134 final AffineTransform xform = AffineTransform.getQuadrantRotateInstance(q, ax, ay);135 final Graphics2D g = rot.createGraphics();136 g.drawImage(image, xform, null);137 g.dispose();138 139 visibleRect.setSize(ww, hh);140 image.flush();141 ImageDisplay.this.image = rot;142 144 } 143 145
Note:
See TracChangeset
for help on using the changeset viewer.