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); }
private Overlay createTextOverlay(final Roi roi) { assert roi instanceof TextRoi; final TextRoi tRoi = (TextRoi) roi; final Double bounds = tRoi.getFloatBounds(); final double x = bounds.x; final double y = bounds.y; final TextOverlay overlay = new TextOverlay(getContext(), x, y, tRoi.getText()); switch (tRoi.getJustification()) { case TextRoi.LEFT: overlay.setJustification(Justification.LEFT); break; case TextRoi.CENTER: overlay.setJustification(Justification.CENTER); break; case TextRoi.RIGHT: overlay.setJustification(Justification.RIGHT); break; default: break; } assignPropertiesToOverlay(overlay, roi); return overlay; }
angle = (int)textRoi.getAngle(); style = font.getStyle(); justification = textRoi.getJustification(); Color c = textRoi.getStrokeColor(); if (c!=null) color=c;
angle = (int)textRoi.getAngle(); style = font.getStyle(); justification = textRoi.getJustification(); Color c = textRoi.getStrokeColor(); if (c!=null) color=c;
strokeWidth = font.getSize(); angle = troi.getAngle(); justification = troi.getJustification(); antialias = troi.getAntialiased(); if (justification!=troi.getJustification()) troi.setJustification(justification); troi.setAntialiased(antialias);
strokeWidth = font.getSize(); angle = troi.getAngle(); justification = troi.getJustification(); antialias = troi.getAntialiased(); if (justification!=troi.getJustification()) troi.setJustification(justification); troi.setAntialiased(antialias);
if (rpRoi instanceof TextRoi) { font = ((TextRoi)rpRoi).getCurrentFont(); justification = ((TextRoi)rpRoi).getJustification();
if (rpRoi instanceof TextRoi) { font = ((TextRoi)rpRoi).getCurrentFont(); justification = ((TextRoi)rpRoi).getJustification();