(Graphics g)
| 249 | } |
| 250 | |
| 251 | @AstroImageJ(reason = "Set interpolation to fix rendering at higher UI scales", modified = true) |
| 252 | public void paint(Graphics g) { |
| 253 | painted = true; |
| 254 | Roi roi = imp.getRoi(); |
| 255 | Overlay overlay = imp.getOverlay(); |
| 256 | if (roi!=null || overlay!=null || showAllOverlay!=null || Prefs.paintDoubleBuffered || (IJ.isLinux() && magnification<0.25)) { |
| 257 | // Use double buffering to avoid flickering of ROIs and to work around |
| 258 | // a Linux problem with large images not showing at low magnification. |
| 259 | if (roi!=null) |
| 260 | roi.updatePaste(); |
| 261 | if (imageWidth!=0) { |
| 262 | paintDoubleBuffered(g);//todo mark |
| 263 | setPaintPending(false); |
| 264 | return; |
| 265 | } |
| 266 | } |
| 267 | try { |
| 268 | if (imageUpdated) { |
| 269 | imageUpdated = false; |
| 270 | imp.updateImage(); |
| 271 | } |
| 272 | ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, |
| 273 | RenderingHints.VALUE_INTERPOLATION_BICUBIC); |
| 274 | |
| 275 | setInterpolation(g, Prefs.interpolateScaledImages); |
| 276 | Image img = imp.getImage(); |
| 277 | if (img!=null) |
| 278 | g.drawImage(img, 0, 0, (int)(srcRect.width*magnification+0.5), (int)(srcRect.height*magnification+0.5), |
| 279 | srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null); |
| 280 | if (overlay!=null) |
| 281 | drawOverlay(overlay, g); |
| 282 | if (showAllOverlay!=null) |
| 283 | drawOverlay(showAllOverlay, g); |
| 284 | if (roi!=null) drawRoi(roi, g); |
| 285 | if (srcRect.width<imageWidth || srcRect.height<imageHeight) |
| 286 | drawZoomIndicator(g); |
| 287 | //if (IJ.debugMode) showFrameRate(g); |
| 288 | } catch(OutOfMemoryError e) {IJ.outOfMemory("Paint");} |
| 289 | setPaintPending(false); |
| 290 | } |
| 291 | |
| 292 | private void setInterpolation(Graphics g, boolean interpolate) { |
| 293 | if (magnification==1) |
no test coverage detected