本文整理了Java中ij.gui.Toolbar.getBrushSize()
方法的一些代码示例,展示了Toolbar.getBrushSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getBrushSize()
方法的具体详情如下:
包路径:ij.gui.Toolbar
类名称:Toolbar
方法名:getBrushSize
[英]Returns the size of the selection brush tool, or 0 if the brush tool is not enabled.
[中]返回选择笔刷工具的大小,如果未启用笔刷工具,则返回0。
代码示例来源:origin: net.imagej/ij
public void drawRoiBrush(Graphics g) {
g.setColor(ROIColor);
int size = Toolbar.getBrushSize();
if (size==0 || ic==null)
return;
int flags = ic.getModifiers();
if ((flags&16)==0) return; // exit if mouse button up
size = (int)(size*mag);
Point p = ic.getCursorLoc();
int sx = ic.screenX(p.x);
int sy = ic.screenY(p.y);
g.drawOval(sx-size/2, sy-size/2, size, size);
}
代码示例来源:origin: imagej/ImageJA
public void drawRoiBrush(Graphics g) {
g.setColor(ROIColor);
int size = Toolbar.getBrushSize();
if (size==0 || ic==null)
return;
int flags = ic.getModifiers();
if ((flags&16)==0) return; // exit if mouse button up
size = (int)(size*mag);
Point p = ic.getCursorLoc();
int sx = ic.screenX(p.x);
int sy = ic.screenY(p.y);
g.drawOval(sx-size/2, sy-size/2, size, size);
}
代码示例来源:origin: net.imagej/ij
protected void handleMouseUp(int screenX, int screenY) {
state = NORMAL;
if (imp==null) return;
imp.draw(clipX-5, clipY-5, clipWidth+10, clipHeight+10);
if (Recorder.record) {
String method;
if (type==OVAL)
Recorder.record("makeOval", x, y, width, height);
else if (!(this instanceof TextRoi)) {
if (cornerDiameter==0)
Recorder.record("makeRectangle", x, y, width, height);
else {
if (Recorder.scriptMode())
Recorder.recordCall("imp.setRoi(new Roi("+x+","+y+","+width+","+height+","+cornerDiameter+"));");
else
Recorder.record("makeRectangle", x, y, width, height, cornerDiameter);
}
}
}
if (Toolbar.getToolId()==Toolbar.OVAL&&Toolbar.getBrushSize()>0) {
int flags = ic!=null?ic.getModifiers():16;
if ((flags&16)==0) // erase ROI Brush
{imp.draw(); return;}
}
modifyRoi();
}
代码示例来源:origin: imagej/ImageJA
protected void handleMouseUp(int screenX, int screenY) {
state = NORMAL;
if (imp==null) return;
imp.draw(clipX-5, clipY-5, clipWidth+10, clipHeight+10);
if (Recorder.record) {
String method;
if (type==OVAL)
Recorder.record("makeOval", x, y, width, height);
else if (!(this instanceof TextRoi)) {
if (cornerDiameter==0)
Recorder.record("makeRectangle", x, y, width, height);
else {
if (Recorder.scriptMode())
Recorder.recordCall("imp.setRoi(new Roi("+x+","+y+","+width+","+height+","+cornerDiameter+"));");
else
Recorder.record("makeRectangle", x, y, width, height, cornerDiameter);
}
}
}
if (Toolbar.getToolId()==Toolbar.OVAL&&Toolbar.getBrushSize()>0) {
int flags = ic!=null?ic.getModifiers():16;
if ((flags&16)==0) // erase ROI Brush
{imp.draw(); return;}
}
modifyRoi();
}
代码示例来源:origin: sc.fiji/Image_5D
@Override
public void mouseDragged(final MouseEvent e) {
final boolean selectionBrush =
(Toolbar.getToolId() == Toolbar.OVAL && Toolbar.getBrushSize() > 0);
// Keep reference to Roi in main canvas
Roi oldMainRoi = null;
final Image5DWindow win = (Image5DWindow) imp.getWindow();
if (win != null) {
oldMainRoi = win.getImagePlus().getRoi();
}
super.mouseDragged(e);
adaptChannelMouse();
// Get new reference to Roi in main canvas
Roi newMainRoi = null;
if (win != null) {
newMainRoi = win.getImagePlus().getRoi();
}
// Work around special behaviour of some tools, that operate on the main
// canvas and
// not on the channel canvas, that receives the mousePressed event.
if (oldMainRoi != newMainRoi || selectionBrush) {
adaptChannelRois(false);
}
else {
adaptChannelRois(true);
}
}
代码示例来源:origin: sc.fiji/Image_5D
@Override
public void mousePressed(final MouseEvent e) {
final boolean selectionBrush =
(Toolbar.getToolId() == Toolbar.OVAL && Toolbar.getBrushSize() > 0);
setThisChannelAsCurrent();
// Keep reference to Roi in main canvas
Roi oldMainRoi = null;
final Image5DWindow win = (Image5DWindow) imp.getWindow();
if (win != null) {
oldMainRoi = win.getImagePlus().getRoi();
}
super.mousePressed(e);
adaptChannelMouse();
// Get new reference to Roi in main canvas
Roi newMainRoi = null;
if (win != null) {
newMainRoi = win.getImagePlus().getRoi();
}
// Work around special behaviour of some tools, that operate on the main
// canvas and
// not on the channel canvas, that receives the mousePressed event.
if (oldMainRoi != newMainRoi || selectionBrush) {
adaptChannelRois(false);
}
else {
adaptChannelRois(true);
}
}
代码示例来源:origin: net.imagej/ij
public void run() {
int size = Toolbar.getBrushSize();
ImagePlus img = WindowManager.getCurrentImage();
if (img==null) return;
ImageCanvas ic = img.getCanvas();
if (ic==null) return;
Roi roi = img.getRoi();
if (roi!=null && !roi.isArea())
img.deleteRoi();
Point p = ic.getCursorLoc();
if (roi!=null && !roi.contains(p.x, p.y))
mode = SUBTRACT;
int flags;
while (true) {
p = ic.getCursorLoc();
if (p.equals(previousP))
{IJ.wait(1); continue;}
previousP = p;
flags = ic.getModifiers();
if ((flags&leftClick)==0) return;
if ((flags&shift)!=0)
mode = ADD;
else if ((flags&alt)!=0)
mode = SUBTRACT;
if (mode==ADD)
addCircle(img, p.x, p.y, size);
else
subtractCircle(img, p.x, p.y, size);
}
}
代码示例来源:origin: imagej/ImageJA
public void run() {
int size = Toolbar.getBrushSize();
ImagePlus img = WindowManager.getCurrentImage();
if (img==null) return;
ImageCanvas ic = img.getCanvas();
if (ic==null) return;
Roi roi = img.getRoi();
if (roi!=null && !roi.isArea())
img.deleteRoi();
Point p = ic.getCursorLoc();
if (roi!=null && !roi.contains(p.x, p.y))
mode = SUBTRACT;
int flags;
while (true) {
p = ic.getCursorLoc();
if (p.equals(previousP))
{IJ.wait(1); continue;}
previousP = p;
flags = ic.getModifiers();
if ((flags&leftClick)==0) return;
if ((flags&shift)!=0)
mode = ADD;
else if ((flags&alt)!=0)
mode = SUBTRACT;
if (mode==ADD)
addCircle(img, p.x, p.y, size);
else
subtractCircle(img, p.x, p.y, size);
}
}
代码示例来源:origin: net.imagej/ij
if (Toolbar.getBrushSize()>0)
new RoiBrush();
else
代码示例来源:origin: imagej/ImageJA
if (Toolbar.getBrushSize()>0)
new RoiBrush();
else
代码示例来源:origin: net.imagej/ij
private void addRoiToOverlay() {
Roi roi = imp.getRoi();
if (roi==null)
return;
roi = (Roi)roi.clone();
if (imp.getStackSize()>1) {
if (imp.isHyperStack()||imp.isComposite())
roi.setPosition(0, imp.getSlice(), imp.getFrame());
else
roi.setPosition(imp.getCurrentSlice());
}
if (roi.getName()==null)
roi.setName(""+rt.size());
//roi.setName(IJ.getString("Label:", "m"+rt.size()));
roi.setIgnoreClipRect(true);
Overlay overlay = imp.getOverlay();
if (overlay==null)
overlay = new Overlay();
if (drawLabels)
overlay.drawLabels(true);
if (!overlay.getDrawNames())
overlay.drawNames(true);
overlay.setLabelColor(Color.white);
overlay.drawBackgrounds(true);
overlay.add(roi);
imp.setOverlay(overlay);
if (roi.getType()==Roi.COMPOSITE && Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0)
imp.deleteRoi(); // delete ROIs created with the selection brush tool
}
代码示例来源:origin: net.imagej/ij
&& roi.getBounds().width==imp.getWidth() && roi.getBounds().height==imp.getHeight())
return false;
if (Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0)
Toolbar.getInstance().setTool(Toolbar.RECTANGLE);
roi.setImage(null);
代码示例来源:origin: imagej/ImageJA
&& roi.getBounds().width==imp.getWidth() && roi.getBounds().height==imp.getHeight())
return false;
if (Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0)
Toolbar.getInstance().setTool(Toolbar.RECTANGLE);
roi.setImage(null);
代码示例来源:origin: imagej/ImageJA
private void addRoiToOverlay() {
Roi roi = imp.getRoi();
if (roi==null)
return;
roi = (Roi)roi.clone();
if (imp.getStackSize()>1) {
if (imp.isHyperStack()||imp.isComposite())
roi.setPosition(0, imp.getSlice(), imp.getFrame());
else
roi.setPosition(imp.getCurrentSlice());
}
if (roi.getName()==null)
roi.setName(""+rt.size());
//roi.setName(IJ.getString("Label:", "m"+rt.size()));
roi.setIgnoreClipRect(true);
Overlay overlay = imp.getOverlay();
if (overlay==null)
overlay = new Overlay();
if (drawLabels)
overlay.drawLabels(true);
if (!overlay.getDrawNames())
overlay.drawNames(true);
overlay.setLabelColor(Color.white);
overlay.drawBackgrounds(true);
overlay.add(roi);
imp.setOverlay(overlay);
if (roi.getType()==Roi.COMPOSITE && Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0)
imp.deleteRoi(); // delete ROIs created with the selection brush tool
}
代码示例来源:origin: net.imagej/ij
overlay.add(roi);
imp.setOverlay(overlay);
boolean brushRoi = roi.getType()==Roi.COMPOSITE && Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0;
if (points || (roi instanceof ImageRoi) || (roi instanceof Arrow&&!Prefs.keepArrowSelections) || brushRoi)
imp.deleteRoi();
代码示例来源:origin: imagej/ImageJA
overlay.add(roi);
imp.setOverlay(overlay);
boolean brushRoi = roi.getType()==Roi.COMPOSITE && Toolbar.getToolId()==Toolbar.OVAL && Toolbar.getBrushSize()>0;
if (points || (roi instanceof ImageRoi) || (roi instanceof Arrow&&!Prefs.keepArrowSelections) || brushRoi)
imp.deleteRoi();
内容来源于网络,如有侵权,请联系作者删除!