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


Java Area.exclusiveOr方法代码示例

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


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

示例1: HandleNode

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Fully-specified constructor.
 *
 * @param width
 * @param height
 * @param thickness
 * @param cornerWidth
 * @param fillPaint
 * @param strokePaint
 * @param stroke
 */
public HandleNode( double width, double height, double thickness, double cornerWidth, Paint fillPaint, Paint strokePaint, Stroke stroke ) {
    super();

    // Validate arguments
    if ( width <= 0 ) {
        throw new IllegalArgumentException( "width must be > 0" );
    }
    if ( height <= 0 ) {
        throw new IllegalArgumentException( "height must be > 0" );
    }
    if ( thickness >= Math.min( width, height ) ) {
        throw new IllegalArgumentException( "thickness is too large: " + thickness );
    }
    if ( cornerWidth < 0 ) {
        throw new IllegalArgumentException( "cornerWidth must be >= 0" );
    }

    /*
    * Create the handle shape using constructive geometry.
    * To get rounded corners on the handle, create a rounded rectangle
    * that is twice as wide as needed, then cut it in half.
    */
    RoundRectangle2D outerRect = new RoundRectangle2D.Double( 0, 0, 2 * width, height, cornerWidth, cornerWidth );
    RoundRectangle2D innerRect = new RoundRectangle2D.Double( thickness, thickness, 2 * ( width - thickness ), height - ( 2 * thickness ), cornerWidth, cornerWidth );
    Rectangle2D boundsRect = new Rectangle2D.Double( 0, 0, width, height );
    Area handleArea = new Area( outerRect );
    handleArea.exclusiveOr( new Area( innerRect ) );
    handleArea.intersect( new Area( boundsRect ) );

    handleNode = new PPath( handleArea );
    handleNode.setPaint( fillPaint );
    handleNode.setStrokePaint( strokePaint );
    handleNode.setStroke( stroke );

    addChild( handleNode );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:48,代码来源:HandleNode.java

示例2: getCombinedShape

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
	 * Internal,
	 * For shape types composed of multiple basic shapes.
	 * 
	 * NOTE: These are all being deprecated. They should be 
	 * automatically converted to semantic-free shapes.
	 */
	static public java.awt.Shape getCombinedShape (Internal st)
	{
		Area area = new Area();
		
		switch (st)
		{
		case CELL:
			RoundRectangle2D.Double c1 = new RoundRectangle2D.Double(0,0,600,600,100, 100);
			RoundRectangle2D.Double c2 = new RoundRectangle2D.Double(11,11,578,578,100, 100);
			area.add(new Area(c1));
			area.exclusiveOr(new Area(c2));
			break;
		case NUCLEUS:
			Ellipse2D.Double n1 = new Ellipse2D.Double (0, 0, 300, 200);
			Ellipse2D.Double n2 = new Ellipse2D.Double (8, 8, 284, 184);
			area.add(new Area(n1));
			area.exclusiveOr(new Area(n2));
			break;
//		case MITOCHONDRIA:
//			RoundRectangle2D.Double m1 = new RoundRectangle2D.Double (0, 0, 200, 100, 40, 60);
//			Ellipse2D.Double m2 = new Ellipse2D.Double (4, 4, 192, 92);
//			area.add(new Area(m1));
//			area.exclusiveOr(new Area(m2));
//			break;
		case ORGANELLE:
			RoundRectangle2D.Double g1 = new RoundRectangle2D.Double(0,0,200,100,40, 60);
			RoundRectangle2D.Double g2 = new RoundRectangle2D.Double(8,8,184,84,40, 60);
			area.add(new Area(g1));
			area.exclusiveOr(new Area(g2));
			break;
		case VESICLE:
			Ellipse2D.Double v1 = new Ellipse2D.Double (0, 0, 100, 100);
			area.add(new Area(v1));
			break;
			
		
		}
		return area;
	}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:47,代码来源:GenMAPPShapes.java

示例3: getExclusiveOr

import java.awt.geom.Area; //导入方法依赖的package包/类
public RectListImpl getExclusiveOr(RectListImpl rli) {
    Area a2 = new Area(theArea);
    a2.exclusiveOr(((AreaImpl) rli).theArea);
    return new AreaImpl(a2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:RegionOps.java


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