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

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

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

Toolbar.setForegroundColor介绍

暂无

代码示例

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

private void setForegroundColor(Color c) {
  Toolbar.setForegroundColor(c);
  if (Recorder.record)
    Recorder.record("setForegroundColor", c.getRed(), c.getGreen(), c.getBlue());
}

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

private void setForegroundColor(Color c) {
  Toolbar.setForegroundColor(c);
  if (Recorder.record)
    Recorder.record("setForegroundColor", c.getRed(), c.getGreen(), c.getBlue());
}

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

public static void setBrushWidth(int width) {
  if (brushInstance!=null) {
    Color c = Toolbar.getForegroundColor();
    brushInstance.setWidth(width);
    Toolbar.setForegroundColor(c);
  }
}

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

public static void setBrushWidth(int width) {
  if (brushInstance!=null) {
    Color c = Toolbar.getForegroundColor();
    brushInstance.setWidth(width);
    Toolbar.setForegroundColor(c);
  }
}

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

static void setColor(int red, int green, int blue, boolean foreground) {
  if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0; 
  if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;  
  Color c = new Color(red, green, blue);
  if (foreground) {
    Toolbar.setForegroundColor(c);
    ImagePlus img = WindowManager.getCurrentImage();
    if (img!=null)
      img.getProcessor().setColor(c);
  } else
    Toolbar.setBackgroundColor(c);
}

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

static void setColor(int red, int green, int blue, boolean foreground) {
  if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0; 
  if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;  
  Color c = new Color(red, green, blue);
  if (foreground) {
    Toolbar.setForegroundColor(c);
    ImagePlus img = WindowManager.getCurrentImage();
    if (img!=null)
      img.getProcessor().setColor(c);
  } else
    Toolbar.setBackgroundColor(c);
}

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

void setDrawingColor(int x, int y, boolean setBackground) {
  int p = ip.getPixel(x, y);
  int r = (p&0xff0000)>>16;
  int g = (p&0xff00)>>8;
  int b = p&0xff;
  Color c = new Color(r, g, b);
  if (setBackground) {
    Toolbar.setBackgroundColor(c);
    if (Recorder.record)
      Recorder.setBackgroundColor(c);
  } else {
    Toolbar.setForegroundColor(c);
    if (Recorder.record)
      Recorder.setForegroundColor(c);
  }
}

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

void setDrawingColor(int x, int y, boolean setBackground) {
  int p = ip.getPixel(x, y);
  int r = (p&0xff0000)>>16;
  int g = (p&0xff00)>>8;
  int b = p&0xff;
  Color c = new Color(r, g, b);
  if (setBackground) {
    Toolbar.setBackgroundColor(c);
    if (Recorder.record)
      Recorder.setBackgroundColor(c);
  } else {
    Toolbar.setForegroundColor(c);
    if (Recorder.record)
      Recorder.setForegroundColor(c);
  }
}

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

Toolbar.setBackgroundColor(color);
else {
  Toolbar.setForegroundColor(color);
  if (gd != null)
    options.setColor(color);

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

void editColor() {
  Color c  = background?Toolbar.getBackgroundColor():Toolbar.getForegroundColor();
  ColorChooser cc = new ColorChooser((background?"Background":"Foreground")+" Color", c, false);
  c = cc.getColor();
  if (background)
    Toolbar.setBackgroundColor(c);
  else
    Toolbar.setForegroundColor(c);
}

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

void editColor() {
  Color c  = background?Toolbar.getBackgroundColor():Toolbar.getForegroundColor();
  ColorChooser cc = new ColorChooser((background?"Background":"Foreground")+" Color", c, false);
  c = cc.getColor();
  if (background)
    Toolbar.setBackgroundColor(c);
  else
    Toolbar.setForegroundColor(c);
}

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

public void colorOptions(ColorRGB fgColor, ColorRGB bgColor) {
  Toolbar.setForegroundColor(AWTColors.getColor(fgColor));
  Toolbar.setBackgroundColor(AWTColors.getColor(bgColor));
  OptionsChannels options = optionsService.getOptions(OptionsChannels.class);
  options.setLastFgColor(fgColor, false);
  options.setLastBgColor(bgColor, false);
  //options.save(); BDZ - shouldn't be necessary - see OptionsChannels impl
}

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
    if (e!=null && e.toString().contains("Undo")) {
      ImagePlus imp = WindowManager.getCurrentImage();
      if (imp!=null) IJ.run("Undo");
      return true;
    }
    width = (int)gd.getNextNumber();
    if (gd.invalidNumber() || width<0)
      width = (int)Prefs.get(widthKey, 1);
    //transparency = (int)gd.getNextNumber();
    //if (gd.invalidNumber() || transparency<0 || transparency>100)
    //	transparency = 100;
    String colorName = gd.getNextChoice();
    paintOnOverlay = gd.getNextBoolean();
    Color color = Colors.decode(colorName, null);
    Toolbar.setForegroundColor(color);
    Prefs.set(widthKey, width);
    Prefs.set(OVERLAY_KEY, paintOnOverlay);
    return true;
  }
}

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
    if (e!=null && e.toString().contains("Undo")) {
      ImagePlus imp = WindowManager.getCurrentImage();
      if (imp!=null) IJ.run("Undo");
      return true;
    }
    width = (int)gd.getNextNumber();
    if (gd.invalidNumber() || width<0)
      width = (int)Prefs.get(widthKey, 1);
    //transparency = (int)gd.getNextNumber();
    //if (gd.invalidNumber() || transparency<0 || transparency>100)
    //	transparency = 100;
    String colorName = gd.getNextChoice();
    paintOnOverlay = gd.getNextBoolean();
    Color color = Colors.decode(colorName, null);
    Toolbar.setForegroundColor(color);
    Prefs.set(widthKey, width);
    Prefs.set(OVERLAY_KEY, paintOnOverlay);
    return true;
  }
}

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

public void itemStateChanged(ItemEvent e) {
  Choice choice = (Choice)e.getSource();
  String item = choice.getSelectedItem();
  Color color = getColor(item, Color.black);
  if (choice==fchoice)
    Toolbar.setForegroundColor(color);
  else if (choice==bchoice)
    Toolbar.setBackgroundColor(color);
  else if (choice==schoice) {
    Roi.setColor(color);
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp!=null && imp.getRoi()!=null) imp.draw();
    Toolbar.getInstance().repaint();
  }
}

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

public void itemStateChanged(ItemEvent e) {
  Choice choice = (Choice)e.getSource();
  String item = choice.getSelectedItem();
  Color color = getColor(item, Color.black);
  if (choice==fchoice)
    Toolbar.setForegroundColor(color);
  else if (choice==bchoice)
    Toolbar.setBackgroundColor(color);
  else if (choice==schoice) {
    Roi.setColor(color);
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp!=null && imp.getRoi()!=null) imp.draw();
    Toolbar.getInstance().repaint();
  }
}

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  if (e!=null && e.toString().contains("Undo")) {
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp==null) return true;
    Overlay overlay = imp.getOverlay();
    if (overlay!=null && overlay.size()>0) {
      overlay.remove(overlay.size()-1);
      imp.draw();
    }
    return true;
  }
  width = (float)gd.getNextNumber();
  if (gd.invalidNumber() || width<0)
    width = (float)Prefs.get(WIDTH_KEY, 5);
  transparency = (int)gd.getNextNumber();
  if (gd.invalidNumber() || transparency<0 || transparency>100)
    transparency = 100;
  String colorName = gd.getNextChoice();
  Color color = Colors.decode(colorName, null);
  Toolbar.setForegroundColor(color);
  Prefs.set(WIDTH_KEY, width);
  return true;
}

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  if (e!=null && e.toString().contains("Undo")) {
    ImagePlus imp = WindowManager.getCurrentImage();
    if (imp==null) return true;
    Overlay overlay = imp.getOverlay();
    if (overlay!=null && overlay.size()>0) {
      overlay.remove(overlay.size()-1);
      imp.draw();
    }
    return true;
  }
  width = (float)gd.getNextNumber();
  if (gd.invalidNumber() || width<0)
    width = (float)Prefs.get(WIDTH_KEY, 5);
  transparency = (int)gd.getNextNumber();
  if (gd.invalidNumber() || transparency<0 || transparency>100)
    transparency = 100;
  String colorName = gd.getNextChoice();
  Color color = Colors.decode(colorName, null);
  Toolbar.setForegroundColor(color);
  Prefs.set(WIDTH_KEY, width);
  return true;
}

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

if (colorName!=null && !colorName2.equals(colorName)) {
  Color color = Colors.decode(colorName2, null);
  Toolbar.setForegroundColor(color);
  colorName = colorName2;

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

if (colorName!=null && !colorName2.equals(colorName)) {
  Color color = Colors.decode(colorName2, null);
  Toolbar.setForegroundColor(color);
  colorName = colorName2;

相关文章