Java Code Examples for org.eclipse.swt.graphics.Region#intersect()

The following examples show how to use org.eclipse.swt.graphics.Region#intersect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegionAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * RegionAction constructor taking a polygon to define the region
 * 
 * @param oSource
 *            StructureSource
 * @param loa
 *            Polygon points
 * @param ac
 *            Action
 * @param dTranslateX
 *            X Translation to apply on polygon coordinates
 * @param dTranslateY
 *            Y Translation to apply on polygon coordinates
 * @param dScale
 *            Scale to apply on polygon coordinates
 * @param clipping
 *            Clipping area, points outside it will be clipped
 */
RegionAction( StructureSource oSource, Location[] loa, Action ac,
		double dTranslateX, double dTranslateY, double dScale,
		Region clipping )
{
	_oSource = oSource;
	final int[] i2a = SwtRendererImpl.getCoordinatesAsInts( loa,
			SwtRendererImpl.TRUNCATE,
			dTranslateX,
			dTranslateY,
			dScale );
	Region sh = new Region( );
	sh.add( i2a );
	if ( clipping != null )
	{
		sh.intersect( clipping );
	}
	_ac = ac;

	this.region = sh;
}
 
Example 2
Source File: RegionAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This constructor supports shape definition via a rectangle.
 * 
 * @param oSource
 *            StructureSource
 * @param bo
 *            Rectangle
 * @param ac
 *            Action
 * @param dTranslateX
 *            X translation to apply to rectangle
 * @param dTranslateY
 *            Y translation to apply to rectangle
 * @param dScale
 *            scale to apply to rectangle
 * @param clipping
 *            Clipping area, points outside it will be clipped
 */
RegionAction( StructureSource oSource, Bounds bo, Action ac,
		double dTranslateX, double dTranslateY, double dScale,
		Region clipping )
{
	_oSource = oSource;

	bo = goFactory.copyOf( bo );
	bo.translate( dTranslateX, dTranslateY );
	bo.scale( dScale );

	Rectangle rect = new Rectangle( (int) bo.getLeft( ),
			(int) bo.getTop( ),
			(int) bo.getWidth( ),
			(int) bo.getHeight( ) );

	Region sh = new Region( );
	sh.add( rect );
	if ( clipping != null )
	{
		sh.intersect( clipping );
	}
	_ac = ac;

	this.region = sh;
}
 
Example 3
Source File: RegionAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructor supports shape definition via an elliptical arc
 * 
 * @param oSource
 * @param boEllipse
 * @param dStart
 * @param dExtent
 * @param iArcType
 * @param ac
 */
RegionAction( StructureSource oSource, Bounds boEllipse, double dStart,
		double dExtent, int iArcType, Action ac, double dTranslateX,
		double dTranslateY, double dScale, Region clipping )
{
	_oSource = oSource;

	boEllipse = goFactory.copyOf( boEllipse );
	boEllipse.translate( dTranslateX, dTranslateY );
	boEllipse.scale( dScale );

	Shape shape = new Arc2D.Double( boEllipse.getLeft( ),
			boEllipse.getTop( ),
			boEllipse.getWidth( ),
			boEllipse.getHeight( ),
			dStart,
			dExtent,
			toSwingArcType( iArcType ) );

	int[] i2a = shape2polyCoords( shape );
	Region sh = new Region( );
	sh.add( i2a );

	if ( clipping != null )
	{
		sh.intersect( clipping );
	}

	_ac = ac;
	this.region = sh;

}