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

Method getAddSelectionScript

ij/src/main/java/ij/gui/TextRoi.java:616–632  ·  view source on GitHub ↗
(String code)

Source from the content-addressed store, hash-verified

614 }
615
616 private String getAddSelectionScript(String code) {
617 code += "roi = new TextRoi("+this.x+", "+this.y+", \""+text()+"\", font);\n";
618 code += "roi.setStrokeColor(new Color("+getColorArgs(getStrokeColor())+"));\n";
619 if (getFillColor()!=null)
620 code += "roi.setFillColor(new Color("+getColorArgs(getFillColor())+"));\n";
621 int just = getJustification();
622 if (just>LEFT) {
623 if (just==CENTER)
624 code += "roi.setJustification(TextRoi.CENTER);\n";
625 else if (just==RIGHT)
626 code += "roi.setJustification(TextRoi.RIGHT);\n";
627 }
628 if (getAngle()!=0.0)
629 code += "roi.setAngle("+getAngle()+");\n";
630 code += "overlay.add(roi);\n";
631 return code;
632 }
633
634 private String getColorArgs(Color c) {
635 return IJ.d2s(c.getRed()/255.0,2)+", "+IJ.d2s(c.getGreen()/255.0,2)+", "+IJ.d2s(c.getBlue()/255.0,2);

Callers 1

getMacroCodeMethod · 0.95

Calls 6

textMethod · 0.95
getColorArgsMethod · 0.95
getJustificationMethod · 0.95
getAngleMethod · 0.95
getStrokeColorMethod · 0.80
getFillColorMethod · 0.80

Tested by

no test coverage detected