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

Method draw

ij/src/main/java/ij/gui/PointRoi.java:229–258  ·  view source on GitHub ↗

Draws the points on the image.

(Graphics g)

Source from the content-addressed store, hash-verified

227
228 /** Draws the points on the image. */
229 public void draw(Graphics g) {
230 updatePolygon();
231 if (showLabels && nPoints>1) {
232 fontSize = 8;
233 double scale = size>=XXL?2:1.5;
234 fontSize += scale*convertSizeToIndex(size);
235 fontSize = (int)Math.round(fontSize);
236 font = new Font("SansSerif", Font.PLAIN, fontSize);
237 g.setFont(font);
238 if (fontSize>9)
239 Java2.setAntialiasedText(g, true);
240 }
241 int[] positions = this.positions; //use a copy to avoid NullPointerException on asynchronous change to null
242 int slice = imp!=null && positions!=null && imp.getStackSize()>1?imp.getCurrentSlice():0;
243 ImageCanvas ic = imp!=null?imp.getCanvas():null;
244 if (ic!=null && overlay && ic.getShowAllList()!=null && ic.getShowAllList().contains(this) && !Prefs.showAllSliceOnly)
245 slice = 0; // In RoiManager's "show all" mode and not "associate with slice", draw point irrespective of currently selected slice
246 if (Prefs.showAllPoints)
247 slice = 0; // "Show on all slices" in Point tool options
248 for (int i=0; i<nPoints; i++) {
249 if (slice==0 || (positions!=null&&(slice==positions[i]||positions[i]==0)))
250 drawPoint(g, xp2[i], yp2[i], i+1);
251 }
252 if (updateFullWindow) {
253 updateFullWindow = false;
254 imp.draw();
255 }
256 PointToolOptions.update();
257 flattenScale = 1.0;
258 }
259
260 void drawPoint(Graphics g, int x, int y, int n) {
261 int size2=size/2;

Callers 1

PointRoiMethod · 0.45

Calls 12

convertSizeToIndexMethod · 0.95
setAntialiasedTextMethod · 0.95
getShowAllListMethod · 0.95
drawPointMethod · 0.95
updateMethod · 0.95
updatePolygonMethod · 0.80
getCurrentSliceMethod · 0.80
setFontMethod · 0.65
roundMethod · 0.45
getStackSizeMethod · 0.45
getCanvasMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected