Changeset 8832 in josm
- Timestamp:
- 2015-10-07T21:26:40+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r8733 r8832 11 11 import java.awt.Graphics2D; 12 12 import java.awt.GridBagLayout; 13 import java.awt.Transparency; 13 14 import java.awt.event.ActionEvent; 14 15 import java.awt.font.FontRenderContext; … … 280 281 } 281 282 282 private LookupOp getOp(int bands) {283 if (gamma == 1) {284 return null;285 } else if (bands == 3) {286 return op3;287 } else if (bands == 4) {288 return op4;289 } else {290 return null;291 }292 }293 294 283 @Override 295 284 public BufferedImage process(BufferedImage image) { 296 final LookupOp op = getOp(image.getRaster().getNumBands()); 297 final BufferedImage to = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); 298 return op == null ? image : op.filter(image, to); 285 if (gamma == 1) { 286 return image; 287 } 288 try { 289 final int bands = image.getRaster().getNumBands(); 290 if (image.getType() != BufferedImage.TYPE_CUSTOM && bands == 3) { 291 return op3.filter(image, null); 292 } else if (image.getType() != BufferedImage.TYPE_CUSTOM && bands == 4) { 293 return op4.filter(image, null); 294 } 295 } catch (IllegalArgumentException ignore) { 296 } 297 final int type = image.getTransparency() == Transparency.OPAQUE ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; 298 final BufferedImage to = new BufferedImage(image.getWidth(), image.getHeight(), type); 299 to.getGraphics().drawImage(image, 0, 0, null); 300 return process(to); 299 301 } 300 302 }
Note:
See TracChangeset
for help on using the changeset viewer.