本文整理了Java中ij.gui.ImageCanvas.offScreenX()
方法的一些代码示例,展示了ImageCanvas.offScreenX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageCanvas.offScreenX()
方法的具体详情如下:
包路径:ij.gui.ImageCanvas
类名称:ImageCanvas
方法名:offScreenX
ImageCanvas.offScreenX介绍
[英]Converts a screen x-coordinate to an offscreen x-coordinate.
[中]将屏幕x坐标转换为屏幕外x坐标。
代码示例
代码示例来源:origin: net.imagej/ij
protected void handleMouseDown(int sx, int sy) {
if (state==NORMAL && ic!=null) {
state = MOVING;
startX = ic.offScreenX(sx);
startY = ic.offScreenY(sy);
startXD = ic.offScreenXD(sx);
startYD = ic.offScreenYD(sy);
//showStatus();
}
}
代码示例来源:origin: sc.fiji/fiji-lib
public int getOffscreenX(MouseEvent e) {
ImageCanvas canvas = getImageCanvas(e);
return canvas == null ? -1 : canvas.offScreenX(e.getX());
}
代码示例来源:origin: sc.fiji/Time_Lapse
@Override
public void mouseMoved(MouseEvent e) {
if (image == null)
return;
int x = canvas.offScreenX(e.getX());
int frame = 1 + (int)((peakCountPlotLimits[1] - peakCountPlotLimits[0])
* (x - Plot.LEFT_MARGIN) / (peakCountPlot.getWidth() - Plot.LEFT_MARGIN - Plot.RIGHT_MARGIN));
if (frame >= 1 && frame <= image.getStackSize())
image.setSlice(frame);
}
});
代码示例来源:origin: imagej/ImageJA
protected void handleMouseDown(int sx, int sy) {
if (state==NORMAL && ic!=null) {
state = MOVING;
startX = ic.offScreenX(sx);
startY = ic.offScreenY(sy);
startXD = ic.offScreenXD(sx);
startYD = ic.offScreenYD(sy);
//showStatus();
}
}
代码示例来源:origin: net.imagej/ij
public void mouseReleased(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
if (arrow!=null && !(roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))) {
arrow.mouseReleased(e);
e.consume();
}
}
代码示例来源:origin: net.imagej/ij
protected void mouseDownInHandle(int handle, int sx, int sy) {
if (state==CONSTRUCTING)
return;
int ox=ic.offScreenX(sx), oy=ic.offScreenY(sy);
double oxd=ic.offScreenXD(sx), oyd=ic.offScreenYD(sy);
if ((IJ.altKeyDown()||IJ.controlKeyDown()) && !(nPoints<=3 && type!=POINT) && !(this instanceof RotatedRectRoi)) {
deleteHandle(oxd, oyd);
return;
} else if (IJ.shiftKeyDown() && type!=POINT && !(this instanceof RotatedRectRoi)) {
addHandle(oxd, oyd);
return;
}
state = MOVING_HANDLE;
activeHandle = handle;
int m = (int)(10.0/ic.getMagnification());
xClipMin=ox-m; yClipMin=oy-m; xClipMax=ox+m; yClipMax=oy+m;
}
代码示例来源:origin: imagej/ImageJA
public void mouseReleased(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
if (arrow!=null && !(roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))) {
arrow.mouseReleased(e);
e.consume();
}
}
代码示例来源:origin: imagej/ImageJA
protected void mouseDownInHandle(int handle, int sx, int sy) {
if (state==CONSTRUCTING)
return;
int ox=ic.offScreenX(sx), oy=ic.offScreenY(sy);
double oxd=ic.offScreenXD(sx), oyd=ic.offScreenYD(sy);
if ((IJ.altKeyDown()||IJ.controlKeyDown()) && !(nPoints<=3 && type!=POINT) && !(this instanceof RotatedRectRoi)) {
deleteHandle(oxd, oyd);
return;
} else if (IJ.shiftKeyDown() && type!=POINT && !(this instanceof RotatedRectRoi)) {
addHandle(oxd, oyd);
return;
}
state = MOVING_HANDLE;
activeHandle = handle;
int m = (int)(10.0/ic.getMagnification());
xClipMin=ox-m; yClipMin=oy-m; xClipMax=ox+m; yClipMax=oy+m;
}
代码示例来源:origin: net.imagej/ij
public void mouseDragged(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
if (roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))
roi.mouseDragged(e);
else if (arrow!=null)
arrow.mouseDragged(e);
e.consume();
}
代码示例来源:origin: imagej/ImageJA
public void mouseDragged(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
if (roi!=null && (roi instanceof Arrow) && roi.contains(ox,oy))
roi.mouseDragged(e);
else if (arrow!=null)
arrow.mouseDragged(e);
e.consume();
}
代码示例来源:origin: net.imagej/ij
public void mousePressed(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
int handle = roi!=null?roi.isHandle(ox, oy):-1;
if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) {
arrow = new Arrow(sx, sy, imp);
imp.setRoi(arrow, false);
e.consume();
}
}
代码示例来源:origin: imagej/ImageJA
public void mousePressed(ImagePlus imp, MouseEvent e) {
ImageCanvas ic = imp.getCanvas();
int sx = e.getX();
int sy = e.getY();
int ox = ic.offScreenX(sx);
int oy = ic.offScreenY(sy);
Roi roi = imp.getRoi();
int handle = roi!=null?roi.isHandle(ox, oy):-1;
if (!(roi!=null && (roi instanceof Arrow) && (handle>=0||roi.contains(ox,oy)))) {
arrow = new Arrow(sx, sy, imp);
imp.setRoi(arrow, false);
e.consume();
}
}
代码示例来源:origin: net.imagej/ij
void move(int sx, int sy) {
int xNew = ic.offScreenX(sx);
int yNew = ic.offScreenY(sy);
x += xNew - startxd;
y += yNew - startyd;
clipboard=null;
startxd = xNew;
startyd = yNew;
updateClipRect();
if (ignoreClipRect)
imp.draw();
else
imp.draw(clipX, clipY, clipWidth, clipHeight);
oldX = x;
oldY = y;
oldWidth = width;
old| height<5)
imp.deleteRoi();
}
代码示例来源:origin: imagej/ImageJA
protected void handleMouseUp(int screenX, int screenY) {
super.handleMouseUp(screenX, screenY);
if (width<5 && height<5 && imp!=null && previousRoi==null) {
int ox = ic!=null?ic.offScreenX(screenX):screenX;
int oy = ic!=null?ic.offScreenY(screenY):screenY;
TextRoi roi = new TextRoi(ox, oy, line1a);
roi.setStrokeColor(Toolbar.getForegroundColor());
roi.firstChar = true;
imp.setRoi(roi);
return;
} else if (firstMouseUp) {
updateBounds(null);
updateText();
firstMouseUp = false;
}
if (width<5 || height<5)
imp.deleteRoi();
}