java.awt.Graphics2D.setXORMode()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(181)

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

Graphics2D.setXORMode介绍

暂无

代码示例

代码示例来源:origin: kevin-wayne/algs4

/**
 * Turns on xor mode.
 */
public void xorOn() {
  offscreen.setXORMode(DEFAULT_CLEAR_COLOR);
}

代码示例来源:origin: plantuml/plantuml

g2.setStroke(debugStroke);
g2.setColor(new Color(170, 170, 170));
g2.setXORMode(Color.white);
for(int x = 0; x < diagram.getWidth(); x += diagram.getCellWidth())
  g2.drawLine(x, 0, x, diagram.getHeight());

代码示例来源:origin: apache/pdfbox

@Override
public void setXORMode(Color c1)
{
  groupG2D.setXORMode(c1);
  alphaG2D.setXORMode(c1);
}

代码示例来源:origin: geotools/geotools

public void setXORMode(Color c1) {
  delegate.setXORMode(c1);
}

代码示例来源:origin: haraldk/TwelveMonkeys

protected void setupForInvert() {
  // TODO: Setup for invert
  graphics.setColor(Color.BLACK);
  graphics.setXORMode(Color.WHITE);
}

代码示例来源:origin: stackoverflow.com

public BufferedImage colorImage(BufferedImage loadImg, int red, int green, int blue) {
  BufferedImage img = new BufferedImage(loadImg.getWidth(), loadImg.getHeight(),
    BufferedImage.TRANSLUCENT);
  Graphics2D graphics = img.createGraphics(); 
  Color newColor = new Color(red, green, blue, 0 /* alpha needs to be zero */);
  graphics.setXORMode(newColor);
  graphics.drawImage(loadImg, null, 0, 0);
  graphics.dispose();
  return img;
}

代码示例来源:origin: geotools/geotools

/** Creates and initializes the graphics object if required. */
  private void ensureGraphics() {
    if (graphics == null) {
      graphics = (Graphics2D) parentComponent.getGraphics().create();
      graphics.setColor(Color.WHITE);
      graphics.setXORMode(Color.RED);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf

/** {@inheritDoc} */
@Override
public void setXORMode(Color c1) {
  g2d.setXORMode(c1);
}

代码示例来源:origin: org.apache.pdfbox/pdfbox

@Override
public void setXORMode(Color c1)
{
  groupG2D.setXORMode(c1);
  alphaG2D.setXORMode(c1);
}

代码示例来源:origin: org.scijava/j3dcore

@Override
public final void setXORMode(Color c1) {
xOrModeColor = c1;
offScreenGraphics2D.setXORMode(c1);
}

代码示例来源:origin: com.samskivert/samskivert

@Override
public void setXORMode (Color c)
{
  _copy.setXORMode(c);
  _primary.setXORMode(c);
}

代码示例来源:origin: robo-code/robocode

@Override
public void setXORMode(Color c1) {
  g.setXORMode(c1);
}

代码示例来源:origin: haraldk/TwelveMonkeys

try {
  g.setColor(Color.WHITE);
  g.setXORMode(Color.BLACK);
  g.fillRect(0, 0, one.getWidth(), one.getHeight());

代码示例来源:origin: com.twelvemonkeys.imageio/imageio-pict

protected void setupForInvert() {
  // TODO: Setup for invert
  graphics.setColor(Color.BLACK);
  graphics.setXORMode(Color.WHITE);
}

代码示例来源:origin: org.openmicroscopy/ome-poi

public void setXORMode(Color c1)
{
  System.out.println( "setXORMode(Color):" );
  System.out.println( "c1 = " + c1 );
  g2D.setXORMode( c1 );
}

代码示例来源:origin: stackoverflow.com

Graphics2D g2 = (Graphics2D) g;

g2.setColor(Color.white);
g2.fillRect(0, 0, getWidth(), getHeight());

g2.setColor(Color.BLUE);
g2.fill(myEllipse);

g2.setColor(Color.red);
g2.setXORMode(Color.white); // Set XOR mode to white
g2.drawString(myText, 70, 70);

代码示例来源:origin: sc.fiji/TrakEM2_

@Override
public void paint(final Graphics2D g, final Rectangle srcRect, final double mag) {
  final int x = (int)((this.x - srcRect.x)*mag);
  final int y = (int)((this.y - srcRect.y)*mag);
  final Composite co = g.getComposite();
  g.setXORMode(Color.white);
  g.drawOval(x -10, y -10, 21, 21);
  g.drawRect(x -1, y -15, 3, 31);
  g.drawRect(x -15, y -1, 31, 3);
  g.setComposite(co); // undo XOR paint
}
public Rectangle getBoundingBox(final Rectangle b) {

代码示例来源:origin: locationtech/jts

private void setup(Graphics2D graphics) {
 originalColor = graphics.getColor();
 originalStroke = graphics.getStroke();
 originalFont = graphics.getFont();
 graphics.setFont(new Font(FontGlyphReader.FONT_SANSSERIF, Font.PLAIN, 14));
 graphics.setColor(bandColor);
 graphics.setXORMode(Color.white);
}

代码示例来源:origin: org.geotools/gt-swing

/**
 * Creates and initializes the graphics object if required.
 */
private void ensureGraphics() {
  if (graphics == null) {
    graphics = (Graphics2D) parentComponent.getGraphics().create();
    graphics.setColor(Color.WHITE);
    graphics.setXORMode(Color.RED);
  }
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

void effaceDessin() {
 if (isPaint_ && enCours()) {
  final Graphics2D g = (Graphics2D) getGraphics();
  g.setXORMode(Color.white);
  tl_.dessineTrait(g, x1_, y1_, x2_, y1_);
  tl_.dessineTrait(g, x1_, y1_, x1_, y2_);
  tl_.dessineTrait(g, x2_, y2_, x2_, y1_);
  tl_.dessineTrait(g, x2_, y2_, x1_, y2_);
  isPaint_ = false;
 }
}

相关文章

Graphics2D类方法