private String getAddSelectionScript(String code) { code += "roi = new TextRoi("+x+", "+y+", \""+text()+"\", font);\n"; code += "roi.setStrokeColor(new Color("+getColorArgs(getStrokeColor())+"));\n"; if (getFillColor()!=null) code += "roi.setFillColor(new Color("+getColorArgs(getFillColor())+"));\n"; if (getAngle()!=0.0) code += "roi.setAngle("+getAngle()+");\n"; code += "overlay.add(roi);\n"; return code; }
private String getAddSelectionScript(String code) { code += "roi = new TextRoi("+x+", "+y+", \""+text()+"\", font);\n"; code += "roi.setStrokeColor(new Color("+getColorArgs(getStrokeColor())+"));\n"; if (getFillColor()!=null) code += "roi.setFillColor(new Color("+getColorArgs(getFillColor())+"));\n"; if (getAngle()!=0.0) code += "roi.setAngle("+getAngle()+");\n"; code += "overlay.add(roi);\n"; return code; }
void saveTextRoi(TextRoi roi) { Font font = roi.getCurrentFont(); String fontName = font.getName(); int size = font.getSize(); int drawStringMode = roi.getDrawStringMode()?1024:0; int style = font.getStyle() + roi.getJustification()*256+drawStringMode; String text = roi.getText(); float angle = (float)roi.getAngle(); int angleLength = 4; int fontNameLength = fontName.length(); int textLength = text.length(); int textRoiDataLength = 16+fontNameLength*2+textLength*2 + angleLength; byte[] data2 = new byte[HEADER_SIZE+HEADER2_SIZE+textRoiDataLength+roiNameSize+roiPropsSize]; System.arraycopy(data, 0, data2, 0, HEADER_SIZE); data = data2; putShort(RoiDecoder.SUBTYPE, RoiDecoder.TEXT); putInt(HEADER_SIZE, size); putInt(HEADER_SIZE+4, style); putInt(HEADER_SIZE+8, fontNameLength); putInt(HEADER_SIZE+12, textLength); for (int i=0; i<fontNameLength; i++) putShort(HEADER_SIZE+16+i*2, fontName.charAt(i)); for (int i=0; i<textLength; i++) putShort(HEADER_SIZE+16+fontNameLength*2+i*2, text.charAt(i)); int hdr2Offset = HEADER_SIZE+textRoiDataLength; //ij.IJ.log("saveTextRoi: "+HEADER_SIZE+" "+textRoiDataLength+" "+fontNameLength+" "+textLength); putFloat(hdr2Offset-angleLength, angle); putHeader2(roi, hdr2Offset); }
void saveTextRoi(TextRoi roi) { Font font = roi.getCurrentFont(); String fontName = font.getName(); int size = font.getSize(); int drawStringMode = roi.getDrawStringMode()?1024:0; int style = font.getStyle() + roi.getJustification()*256+drawStringMode; String text = roi.getText(); float angle = (float)roi.getAngle(); int angleLength = 4; int fontNameLength = fontName.length(); int textLength = text.length(); int textRoiDataLength = 16+fontNameLength*2+textLength*2 + angleLength; byte[] data2 = new byte[HEADER_SIZE+HEADER2_SIZE+textRoiDataLength+roiNameSize+roiPropsSize]; System.arraycopy(data, 0, data2, 0, HEADER_SIZE); data = data2; putShort(RoiDecoder.SUBTYPE, RoiDecoder.TEXT); putInt(HEADER_SIZE, size); putInt(HEADER_SIZE+4, style); putInt(HEADER_SIZE+8, fontNameLength); putInt(HEADER_SIZE+12, textLength); for (int i=0; i<fontNameLength; i++) putShort(HEADER_SIZE+16+i*2, fontName.charAt(i)); for (int i=0; i<textLength; i++) putShort(HEADER_SIZE+16+fontNameLength*2+i*2, text.charAt(i)); int hdr2Offset = HEADER_SIZE+textRoiDataLength; //ij.IJ.log("saveTextRoi: "+HEADER_SIZE+" "+textRoiDataLength+" "+fontNameLength+" "+textLength); putFloat(hdr2Offset-angleLength, angle); putHeader2(roi, hdr2Offset); }
roi = imp.getRoi(); isTextRoi = roi!=null && (roi instanceof TextRoi); if (isTextRoi && (arg.equals("draw") || arg.equals("fill")) && ((TextRoi)roi).getAngle()!=0.0) { String s = IJ.isMacOSX()?"command+b":"ctrl+b"; IJ.error("Draw rotated text by pressing "+s+" (Image>Overlay>Add Selection).");
roi = imp.getRoi(); isTextRoi = roi!=null && (roi instanceof TextRoi); if (isTextRoi && (arg.equals("draw") || arg.equals("fill")) && ((TextRoi)roi).getAngle()!=0.0) { String s = IJ.isMacOSX()?"command+b":"ctrl+b"; IJ.error("Draw rotated text by pressing "+s+" (Image>Overlay>Add Selection).");
code += "setColor(\""+Colors.colorToString(getStrokeColor())+"\");\n"; if (addSelection) { code += "Overlay.drawString(\""+text()+"\", "+x+", "+(y+fontHeight)+", "+getAngle()+");\n"; code += "Overlay.show();\n"; } else {
code += "setColor(\""+Colors.colorToString(getStrokeColor())+"\");\n"; if (addSelection) { code += "Overlay.drawString(\""+text()+"\", "+x+", "+(y+fontHeight)+", "+getAngle()+");\n"; code += "Overlay.show();\n"; } else {
if (type==POINT || ((this instanceof TextRoi) && ((TextRoi)this).getAngle()!=0.0)) ignoreClipRect = true; updateClipRect();
if (type==POINT || ((this instanceof TextRoi) && ((TextRoi)this).getAngle()!=0.0)) ignoreClipRect = true; updateClipRect();
Font font = textRoi.getCurrentFont(); fontSize = font.getSize(); angle = (int)textRoi.getAngle(); style = font.getStyle(); justification = textRoi.getJustification();
Font font = textRoi.getCurrentFont(); fontSize = font.getSize(); angle = (int)textRoi.getAngle(); style = font.getStyle(); justification = textRoi.getJustification();
Font font = troi.getCurrentFont(); strokeWidth = font.getSize(); angle = troi.getAngle(); justification = troi.getJustification(); antialias = troi.getAntialiased();
Font font = troi.getCurrentFont(); strokeWidth = font.getSize(); angle = troi.getAngle(); justification = troi.getJustification(); antialias = troi.getAntialiased();