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

Method drawPoint

ij/src/main/java/ij/gui/PointRoi.java:260–347  ·  view source on GitHub ↗
(Graphics g, int x, int y, int n)

Source from the content-addressed store, hash-verified

258 }
259
260 void drawPoint(Graphics g, int x, int y, int n) {
261 int size2=size/2;
262 boolean colorSet = false;
263 Graphics2D g2d = (Graphics2D)g;
264 AffineTransform saveXform = null;
265 if (flattenScale>1.0) {
266 saveXform = g2d.getTransform();
267 g2d.translate(x, y);
268 g2d.scale(flattenScale, flattenScale);
269 x = y = 0;
270 }
271 Color color = strokeColor!=null?strokeColor:ROIColor;
272 if (!overlay && isActiveOverlayRoi()) {
273 if (color==Color.cyan)
274 color = Color.magenta;
275 else
276 color = Color.cyan;
277 }
278 if (nCounters>1 && counters!=null && n<=counters.length)
279 color = getColor(counters[n-1]);
280 if (type==HYBRID || type==CROSS) {
281 if (type==HYBRID)
282 g.setColor(Color.white);
283 else {
284 g.setColor(color);
285 colorSet = true;
286 }
287 if (size>XXL)
288 g2d.setStroke(fivePixelsWide);
289 else if (size>LARGE)
290 g2d.setStroke(threePixelsWide);
291 g.drawLine(x-(size+2), y, x+size+2, y);
292 g.drawLine(x, y-(size+2), x, y+size+2);
293 }
294 if (type!=CROSS && size>SMALL)
295 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
296 if (type==HYBRID || type==DOT) {
297 if (!colorSet) {
298 g.setColor(color);
299 colorSet = true;
300 }
301 if (size>LARGE)
302 g2d.setStroke(onePixelWide);
303 if (size>LARGE && type==DOT)
304 g.fillOval(x-size2, y-size2, size, size);
305 else if (size>LARGE && type==HYBRID)
306 g.fillRect(x-(size2-2), y-(size2-2), size-4, size-4);
307 else if (size>SMALL && type==HYBRID)
308 g.fillRect(x-(size2-1), y-(size2-1), size-2, size-2);
309 else
310 g.fillRect(x-size2, y-size2, size, size);
311 }
312 if (showLabels && nPoints>1) {
313 int xoffset = 2;
314 if (size==LARGE) xoffset=3;
315 if (size==EXTRA_LARGE) xoffset=4;
316 if (size==XXL) xoffset=5;
317 if (size==XXXL) xoffset=7;

Callers 1

drawMethod · 0.95

Calls 15

getColorMethod · 0.95
isActiveOverlayRoiMethod · 0.80
setStrokeMethod · 0.80
setRenderingHintMethod · 0.80
fillOvalMethod · 0.80
fillRectMethod · 0.80
drawOvalMethod · 0.80
setColorMethod · 0.65
getTransformMethod · 0.45
translateMethod · 0.45
scaleMethod · 0.45
drawLineMethod · 0.45

Tested by

no test coverage detected