MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / paint

Method paint

ij/src/main/java/ij/gui/ImageCanvas.java:251–290  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

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)

Callers 4

flattenMethod · 0.95
mousePressedMethod · 0.95
removeWindowMethod · 0.95
updateMethod · 0.95

Calls 14

isLinuxMethod · 0.95
updatePasteMethod · 0.95
paintDoubleBufferedMethod · 0.95
setPaintPendingMethod · 0.95
setInterpolationMethod · 0.95
drawOverlayMethod · 0.95
drawRoiMethod · 0.95
drawZoomIndicatorMethod · 0.95
outOfMemoryMethod · 0.95
setRenderingHintMethod · 0.80
getImageMethod · 0.65
getRoiMethod · 0.45

Tested by

no test coverage detected