ij.gui.Toolbar.setRoundRectArcSize()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中ij.gui.Toolbar.setRoundRectArcSize()方法的一些代码示例,展示了Toolbar.setRoundRectArcSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setRoundRectArcSize()方法的具体详情如下:
包路径:ij.gui.Toolbar
类名称:Toolbar
方法名:setRoundRectArcSize

Toolbar.setRoundRectArcSize介绍

[英]Sets the rounded rectangle corner diameter (pixels).
[中]设置圆角矩形的角直径(像素)。

代码示例

代码示例来源:origin: net.imagej/imagej-legacy

private void roundRectOptions() {
  final OptionsRoundedRectangleTool optionsRoundedRectangleTool =
    optionsService.getOptions(OptionsRoundedRectangleTool.class);
  final int crnDiam = optionsRoundedRectangleTool.getCornerDiameter();
  Toolbar.setRoundRectArcSize(crnDiam);
  final double width = optionsRoundedRectangleTool.getStrokeWidth();
  setIJ1DefaultStrokeWidth(width);
  // TODO
  // IJ1 RectToolOptions does not manipulate Prefs much. It fires
  // code to change behavior when dialog entries changed. No programmatic
  // way to make our settings affect legacy ImageJ. Need pure modern ImageJ
  // support elsewhere.
  // Prefs.get(SettingsKeys.OPTIONS_ROUND_RECT_FILL_COLOR, none); ?how to
  // handle "none"?
  // Prefs.get(SettingsKeys.OPTIONS_ROUND_RECT_STROKE_COLOR, Color.black);
  // NB BDZ thinks these prefs are unimportant. We use Overlay "Properties"
  // dialog in modern ImageJ to change these.
}

代码示例来源:origin: net.imagej/ij

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  double strokeWidth2 = gd.getNextNumber();
  int cornerDiameter2 = (int)gd.getNextNumber();
  String strokec2 = gd.getNextString();
  String fillc2 = gd.getNextString();
  ImagePlus imp = WindowManager.getCurrentImage();
  Roi roi = imp!=null?imp.getRoi():null;
  Color strokeColor2 = Colors.decode(strokec2, defaultStrokeColor);
  if (roi!=null && (roi.getType()==Roi.RECTANGLE)) {
    roi.setStrokeWidth((int)strokeWidth2);
    roi.setCornerDiameter((int)(cornerDiameter2));
    strokeColor2 = Colors.decode(strokec2, roi.getStrokeColor());
    Color fillColor = Colors.decode(fillc2, roi.getFillColor());
    roi.setStrokeColor(strokeColor2);
    roi.setFillColor(fillColor);
  }
  defaultStrokeWidth = strokeWidth2;
  defaultStrokeColor = strokeColor2;
  Toolbar.setRoundRectArcSize(cornerDiameter2);
  if (cornerDiameter2>0) {
    if (!Toolbar.getToolName().equals("roundrect"))
      IJ.setTool("roundrect");
  }
  return true;
}

代码示例来源:origin: imagej/ImageJA

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  double strokeWidth2 = gd.getNextNumber();
  int cornerDiameter2 = (int)gd.getNextNumber();
  String strokec2 = gd.getNextString();
  String fillc2 = gd.getNextString();
  ImagePlus imp = WindowManager.getCurrentImage();
  Roi roi = imp!=null?imp.getRoi():null;
  Color strokeColor2 = Colors.decode(strokec2, defaultStrokeColor);
  if (roi!=null && (roi.getType()==Roi.RECTANGLE)) {
    roi.setStrokeWidth((int)strokeWidth2);
    roi.setCornerDiameter((int)(cornerDiameter2));
    strokeColor2 = Colors.decode(strokec2, roi.getStrokeColor());
    Color fillColor = Colors.decode(fillc2, roi.getFillColor());
    roi.setStrokeColor(strokeColor2);
    roi.setFillColor(fillColor);
  }
  defaultStrokeWidth = strokeWidth2;
  defaultStrokeColor = strokeColor2;
  Toolbar.setRoundRectArcSize(cornerDiameter2);
  if (cornerDiameter2>0) {
    if (!Toolbar.getToolName().equals("roundrect"))
      IJ.setTool("roundrect");
  }
  return true;
}

相关文章