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

Method getPixel

ij/src/main/java/ij/gui/Wand.java:305–318  ·  view source on GitHub ↗
(int x, int y)

Source from the content-addressed store, hash-verified

303
304 // get a pixel value; returns Float.NaN if outside the field.
305 private float getPixel(int x, int y) {
306 if (x<0 || x>=width || y<0 || y>=height)
307 return Float.NaN;
308 if (bpixels!=null)
309 return bpixels[y*width + x] & 0xff;
310 else if (spixels!=null)
311 return spixels[y*width + x] & 0xffff;
312 else if (fpixels!=null)
313 return fpixels[y*width + x];
314 else if (exactPixelValue) //RGB for exact match
315 return cpixels[y*width + x] & 0xffffff; //don't care for upper byte
316 else //gray value of RGB
317 return ip.getPixelValue(x,y);
318 }
319
320 /* Are we tracing a one pixel wide line? Makes Legacy mode 8-connected instead of 4-connected */
321 private boolean isLine(int xs, int ys) {

Callers 5

autoOutlineMethod · 0.95
insideMethod · 0.95
setDrawingColorMethod · 0.45
drawLegendMethod · 0.45
autoLegendPositionMethod · 0.45

Calls 1

getPixelValueMethod · 0.45

Tested by

no test coverage detected