当前位置: 首页>>代码示例>>Java>>正文


Java Graphics2D.setXORMode方法代码示例

本文整理汇总了Java中java.awt.Graphics2D.setXORMode方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics2D.setXORMode方法的具体用法?Java Graphics2D.setXORMode怎么用?Java Graphics2D.setXORMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Graphics2D的用法示例。


在下文中一共展示了Graphics2D.setXORMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawHorizontalAxisTrace

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * Draws a vertical line used to trace the mouse position to the horizontal axis.
 * 
 * @param g2
 *            the graphics device.
 * @param x
 *            the x-coordinate of the trace line.
 */
private void drawHorizontalAxisTrace(Graphics2D g2, int x) {

	Rectangle2D dataArea = getScreenDataArea();

	g2.setXORMode(Color.orange);
	if ((int) dataArea.getMinX() < x && x < (int) dataArea.getMaxX()) {

		if (this.verticalTraceLine != null) {
			g2.draw(this.verticalTraceLine);
			this.verticalTraceLine.setLine(x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY());
		} else {
			this.verticalTraceLine = new Line2D.Float(x, (int) dataArea.getMinY(), x, (int) dataArea.getMaxY());
		}
		g2.draw(this.verticalTraceLine);
	}

	// Reset to the default 'overwrite' mode
	g2.setPaintMode();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:AbstractChartPanel.java

示例2: drawEdit

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawEdit() {
	if( editShape==null ) return;
	synchronized( map.getTreeLock() ) {
		Graphics2D g = map.getGraphics2D();
		g.setStroke( new BasicStroke( 1f/(float)map.getZoom() ));
		g.setXORMode( Color.white);
		Rectangle2D bounds = editShape.getBounds2D();
		double min = bounds.getX();
		double max = min + bounds.getWidth();
		if( wrap>0. ) {
			Rectangle2D rect = map.getClipRect2D();
			double offset = 0.;
			while( min+offset>rect.getX() ) offset -= wrap;
			while( max+offset< rect.getX() ) offset += wrap;
			g.translate( offset, 0.);
			while( min+offset < rect.getX()+rect.getWidth() ) {
				g.draw( editShape );
				offset += wrap;
				g.translate( wrap, 0.);
			}
		} else {
			g.draw( editShape );
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:26,代码来源:LineSegmentsObject.java

示例3: drawLineAtAge

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawLineAtAge( int currentAge )	{
	if ( exists ) {
		synchronized (getTreeLock()) {
			Graphics2D g = (Graphics2D)getGraphics();
			Rectangle r = getVisibleRect();
			int x1 = r.x;
			int x2 = r.x+r.width;
			g.setXORMode( Color.cyan );
			if ( prevAge != -1)	{
				g.drawLine(x1, prevAge, x2, prevAge);
			}
			g.drawLine(x1, currentAge, x2, currentAge);
			prevAge = currentAge;
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:17,代码来源:CoreColorDisplay.java

示例4: renderTest

import java.awt.Graphics2D; //导入方法依赖的package包/类
public static void renderTest(Graphics2D g2d, int w, int h) {
    g2d.setColor(Color.yellow);
    g2d.fillRect(0, 0, w, h);

    BufferedImage image = getTestImage();
    // draw original image
    g2d.drawRenderedImage(image, null);

    // draw image with custom composite
    g2d.translate(175, 25);
    Composite currentComposite = g2d.getComposite();
    g2d.setComposite(new TestComposite());
    g2d.drawRenderedImage(image, null);
    g2d.setComposite(currentComposite);

    // draw image with XOR
    g2d.translate(175, 25);
    g2d.setXORMode(Color.red);
    g2d.drawRenderedImage(image, null);


    System.out.println("Painting is done...");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:CustomCompositeTest.java

示例5: unDrawLasso

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
	undraws the polygon represented by poly
*/
void unDrawLasso(XYGraph xyg){
	synchronized (xyg.getTreeLock()) {
		Graphics2D g = (Graphics2D) xyg.getGraphics(); 
		g.setXORMode(Color.GRAY);
		for(int i=1;i<poly.npoints;i++) {
			g.drawLine(poly.xpoints[i-1], poly.ypoints[i-1], poly.xpoints[i], poly.ypoints[i]);
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:DataSetGraph.java

示例6: handleDrag

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void handleDrag(MouseEvent e) {

	if (firstPort != null) {
		if (!e.isConsumed()) {
			Graphics2D g = mediator.getGraphGraphics();
			Color bg = mediator.getGraphBackground();
			Color fg = Color.black;
			g.setColor(fg);
			g.setXORMode(bg);
			overlay(g);

			current = mediator.snap(e.getPoint());

			port = getInPortViewAt(e.getX(), e.getY());
			if (port != null) {
				current = mediator.toScreen(port.getLocation(null));
			}

			g.setColor(bg);
			g.setXORMode(fg);
			overlay(g);
			e.consume();
		}
	}

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:28,代码来源:ConnectState.java

示例7: drawBox

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawBox() {
	synchronized (map.getTreeLock()) {
		Graphics2D g = (Graphics2D) map.getGraphics();
		g.setXORMode(Color.GRAY);
		g.translate(map.getVisibleRect().x, map.getVisibleRect().y);
		g.translate(x, y);
		g.drawRect(0, 0, this.w, this.h);
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:LocationInset.java

示例8: drawLine

import java.awt.Graphics2D; //导入方法依赖的package包/类
void drawLine() {
	if( currentPath==null )return;
	double wrap = map.getWrap();
	synchronized(map.getTreeLock()) {
		Graphics2D g = map.getGraphics2D();
		g.setStroke( new BasicStroke(2f/(float)map.getZoom()) );
		//g.setColor( Color.red );
		g.setXORMode(Color.white);
		g.draw( currentPath );
		if( wrap>0.) {
			g.translate(wrap,0.);
			g.draw( currentPath );
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:16,代码来源:GMAProfile.java

示例9: drawLine

import java.awt.Graphics2D; //导入方法依赖的package包/类
void drawLine(XYGraph xyg) {
	if( Float.isNaN(lastV) || side==0) return;
	synchronized (xyg.getTreeLock()) {
		Graphics2D g = (Graphics2D)xyg.getGraphics();
		g.transform(dat);
		g.setXORMode( Color.white );
		g.setColor(Color.blue);
		if (side<0) g.drawLine((int)((lastV-x0)*xScale), y1, (int)((lastV-x0)*xScale), y2);
		else g.drawLine(x1, (int)((lastV-y0)*-yScale), x2, (int)((lastV-y0)*-yScale));
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:12,代码来源:DataSetGraph.java

示例10: drawLasso

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
	Draws the last line in polygon poly to XYGraph xyg
	Uses XOR mode
*/
void drawLasso(XYGraph xyg) {
	synchronized (xyg.getTreeLock()) {
		Graphics2D g = (Graphics2D) xyg.getGraphics(); 
		g.setXORMode(Color.GRAY);
		int x1 = poly.xpoints[poly.npoints-2];
		int y1 = poly.ypoints[poly.npoints-2];
		int x2 = poly.xpoints[poly.npoints-1];
		int y2 = poly.ypoints[poly.npoints-1];
		g.drawLine(x1, y1, x2, y2);
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:16,代码来源:PDBDataSetGraph.java

示例11: drawSelectionBox

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawSelectionBox(){
	synchronized (map.getTreeLock()) {
		Graphics2D g = (Graphics2D) map.getGraphics();
		g.setXORMode(Color.GRAY);
		int x = Math.min(p1.x, p2.x);
		int y = Math.min(p1.y, p2.y);
		int w = Math.max(p1.x, p2.x) - x;
		int h = Math.max(p1.y, p2.y) - y;
		r = new Rectangle(x,y,w,h);
		g.draw(r);
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:PDB.java

示例12: draw

import java.awt.Graphics2D; //导入方法依赖的package包/类
private static void draw(Shape clip, Shape shape, Image from, Image to) {
    Graphics2D g2d = (Graphics2D) to.getGraphics();
    g2d.setXORMode(Color.BLACK);
    g2d.setClip(clip);
    Rectangle toBounds = shape.getBounds();
    g2d.drawImage(from, toBounds.x, toBounds.y, toBounds.width,
                  toBounds.height, null);
    g2d.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:IncorrectClipXorModeSurface2Surface.java

示例13: drawCursorLine

import java.awt.Graphics2D; //导入方法依赖的package包/类
void drawCursorLine( int xPos, int yPos ) {
	synchronized (graph.getTreeLock()) {
		Graphics2D g = graph.getGraphics2D();
		g.setXORMode( Color.cyan );
		g.drawLine(0, yPos, xPos, yPos);
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:8,代码来源:AgeDepthModel.java

示例14: drawRect

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawRect(){
	synchronized (map.getTreeLock()) {
		Graphics2D g = (Graphics2D) map.getGraphics();
		g.setXORMode(Color.GRAY);
		g.translate(map.getVisibleRect().x, map.getVisibleRect().y);
		g.translate(x, y);
		g.drawRect((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:LocationInset.java

示例15: tint

import java.awt.Graphics2D; //导入方法依赖的package包/类
public BufferedImage tint(BufferedImage src, Color col) {
	BufferedImage img = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TRANSLUCENT);
	Graphics2D graphics = img.createGraphics();
	graphics.setXORMode(new Color(col.getRed(), col.getGreen(), col.getBlue(), 0));
	graphics.drawImage(src, null, 0, 0);
	graphics.dispose();
	return img;
}
 
开发者ID:Keabot-Studios,项目名称:Caritemere,代码行数:9,代码来源:GuiUtil.java


注:本文中的java.awt.Graphics2D.setXORMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。