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

Method setColor

ij/src/main/java/ij/macro/Functions.java:876–906  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

874 }
875
876 void setColor() {
877 interp.getLeftParen();
878 if (isStringArg()) {
879 globalColor = getColor();
880 globalValue = Double.NaN;
881 ImagePlus imp = WindowManager.getCurrentImage();
882 if (imp!=null) {
883 if (overlayPath!=null)
884 addDrawingToOverlay(imp);
885 getProcessor().setColor(globalColor);
886 getProcessor().fillColorSet(true);
887 }
888 interp.getRightParen();
889 return;
890 }
891 double arg1 = interp.getExpression();
892 if (interp.nextToken()==')') {
893 interp.getRightParen();
894 setColor(arg1);
895 return;
896 }
897 int red=(int)arg1, green=(int)getNextArg(), blue=(int)getLastArg();
898 if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0;
899 if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;
900 globalColor = new Color(red, green, blue);
901 globalValue = Double.NaN;
902 if (WindowManager.getCurrentImage()!=null) {
903 getProcessor().setColor(globalColor);
904 getProcessor().fillColorSet(true);
905 }
906 }
907
908 void setColor(double value) {
909 ImageProcessor ip = getProcessor();

Callers 2

doFunctionMethod · 0.95
doColorMethod · 0.95

Calls 15

isStringArgMethod · 0.95
getColorMethod · 0.95
getCurrentImageMethod · 0.95
addDrawingToOverlayMethod · 0.95
getProcessorMethod · 0.95
fillColorSetMethod · 0.95
getNextArgMethod · 0.95
getLastArgMethod · 0.95
getImageMethod · 0.95
getBitDepthMethod · 0.95
setValueMethod · 0.95
getLocalCalibrationMethod · 0.95

Tested by

no test coverage detected