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


Java Region.add方法代码示例

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


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

示例1: setClip

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void setClip( ClipRenderEvent cre )
{
	final Location[] loa = cre.getVertices( );

	if ( loa == null )
	{
		_gc.setClipping( (Region) null );
	}
	else
	{
		Region rgClipping = new Region( );
		rgClipping.add( getCoordinatesAsInts( loa,
				TRUNCATE,
				dTranslateX,
				dTranslateY,
				dScale ) );
		_gc.setClipping( rgClipping );
		rgClipping.dispose( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:SwtRendererImpl.java

示例2: RegionAction

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:39,代码来源:RegionAction.java

示例3: handleTransparenceRegion

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
/**
 * This method finds out transparent region in an image
 * 
 * @param image
 *            is the target image
 * @param offsetX
 *            is the distance offset on x axis
 * @param offsetY
 *            is the distance offset on y axis
 * @return Region is the found transparent region
 */
public Region handleTransparenceRegion(Image image, int offsetX, int

offsetY) {

	Region region = new Region();
	final ImageData imageData = image.getImageData();
	if (imageData.alphaData != null) {
		Rectangle pixel = new Rectangle(0, 0, 1, 1);
		for (int y = 0; y < imageData.height; y++) {
			for (int x = 0; x < imageData.width; x++) {
				if (imageData.getAlpha(x, y) != 255) {
					pixel.x = imageData.x + x +

					offsetX;
					pixel.y = imageData.y + y +

					offsetY;
					region.add(pixel);
				}
			}
		}
	}
	return region;
}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:36,代码来源:GUI.java

示例4: initializeBackgroundButton

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void initializeBackgroundButton(Display display) {

		Button changeBgBt = new Button(shell, SWT.PUSH);
		Image changeBtImage = new Image(display,
				ResourceLoader.load("image/changeBg.png"));
		changeBgBt.setToolTipText("Change the background style");
		changeBgBt.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				final Shell changeBg = setChangeDialog();
				center(changeBg);
				changeBg.open();
			}
		});

		Region startBtRegion = new Region();
		startBtRegion.add(circle(circularButtonRadius, circularButtonOffsetX,
				circularButtonOffsetY));
		changeBgBt.setRegion(startBtRegion);
		changeBgBt.setImage(changeBtImage);
		FormData changeBgData = new FormData(circularButtonFormData,
				circularButtonFormData);
		changeBgData.right = new FormAttachment(89);
		changeBgData.top = new FormAttachment(2);
		changeBgBt.setLayoutData(changeBgData);
	}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:27,代码来源:GUI.java

示例5: getBackRegionFromImage

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
/**
 * This method generate a region from a background image
 * 
 * @param display
 *            is the display area of this region
 * @param image
 *            is the file path of the background image
 */
public static Region getBackRegionFromImage(Display display, String image) {

	ImageLoader loader = new ImageLoader();
	ImageData[] imageData = loader.load(ResourceLoader.load(image));
	Region region = new Region(display);
	ImageData data = imageData[0];
	ImageData mask = data.getTransparencyMask();
	org.eclipse.swt.graphics.Rectangle pixel = new org.eclipse.swt.graphics.Rectangle(
			0, 0, 1, 1);
	for (int y = 0; y < mask.height; y++) {
		for (int x = 0; x < mask.width; x++) {
			if (mask.getPixel(x, y) != 0) {
				pixel.x = data.x + x;
				pixel.y = data.y + y;
				region.add(pixel);
			}
		}
	}
	return region;
}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:29,代码来源:GUI.java

示例6: show

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
/**
 * Shows the PopOverShell in a suitable location relative to the parent component. Classes extending PopOverShell will
 * provide the <code>Region</code> via the abstract <code>getAppropriatePopOverRegion()</code> method.
 */
public void show() {
  runBeforeShowPopOverShell();

  Point popOverShellSize = getAppropriatePopOverSize();
  popOverRegion = new Region();
  popOverRegion.add(new Rectangle(0, 0, popOverShellSize.x, popOverShellSize.y));

  Point location = getPopOverShellLocation(parentShell, poppedOverItem, popOverRegion);

  popOverShell.setRegion(popOverRegion);
  popOverShell.setSize(popOverRegion.getBounds().width, popOverRegion.getBounds().height);
  popOverShell.setLocation(location);
  popOverShell.setAlpha(FULLY_VISIBLE_ALPHA);
  popOverShell.setVisible(true);
}
 
开发者ID:ReadyTalk,项目名称:swt-bling,代码行数:20,代码来源:PopOverShell.java

示例7: getRegion

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private Region getRegion(boolean subRect) {
    Region region = new Region();
    region.add(this.shell.getBounds());
    if (subRect) {
        region.subtract(this.getRect());
    }
    return region;
}
 
开发者ID:kamil-karkus,项目名称:EasySnap,代码行数:9,代码来源:ScreenSelectorShell.java

示例8: paintContainer

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
void paintContainer(PaintEvent event) {
	GC gc = event.gc;
	gc.setAdvanced(true);
	if (gc.getAdvanced())
		gc.setAntialias(SWT.ON);

	Point size = composite.getSize();
	int h = size.y;
	int[] simpleCurve = new int[] { 0, h - 1, 1, h - 1, 2, h - 2, 2, 1, 3,
			0 };

	gc.setForeground(getContainerCurveColor(event));
	gc.drawPolyline(simpleCurve);

	Rectangle bounds = ((Control) event.widget).getBounds();
	bounds.x = bounds.y = 0;
	Region r = new Region();
	r.add(bounds);

	int[] simpleCurveClose = new int[simpleCurve.length + 4];
	System.arraycopy(simpleCurve, 0, simpleCurveClose, 0,
			simpleCurve.length);
	int index = simpleCurve.length;
	simpleCurveClose[index++] = bounds.width;
	simpleCurveClose[index++] = 0;
	simpleCurveClose[index++] = bounds.width;
	simpleCurveClose[index++] = bounds.height;

	r.subtract(simpleCurveClose);

	Region clipping = new Region();
	gc.getClipping(clipping);
	r.intersect(clipping);
	gc.setClipping(r);

	clipping.dispose();
	r.dispose();
}
 
开发者ID:cplutte,项目名称:bts,代码行数:39,代码来源:PerspectiveSwitcherSwtTrim.java

示例9: getResources_Create4Regions_CountEquals4

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
@Test
public void getResources_Create4Regions_CountEquals4() {
  Map<String, Integer> counts = ResourceQuery.getAllocatedResourceCounts(display);
  for (int i = 10; i < 14; i++) {
    Region r = new Region(display);
    r.add(0,0, i,i);
  }
  Assert.assertEquals(4, ResourceQuery.getAllocatedResourceCounts(display).get(Region.class.getName()).intValue());
}
 
开发者ID:ReadyTalk,项目名称:swt-bling,代码行数:10,代码来源:ResourceQueryTest.java

示例10: drawOverlay_Label

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private void drawOverlay_Label(	final ChartLabel chartLabel,
								final GC gc,
								final Color colorDefault,
								final Color colorDevice,
								final Color colorHidden,
								final boolean isSelected) {

	if (chartLabel == null) {
		return;
	}

	if (isSelected) {
		gc.setAlpha(0x60);
	} else {
		gc.setAlpha(0x30);
	}

	if (isSelected) {

		final Color selectedColorBg = gc.getDevice().getSystemColor(SWT.COLOR_DARK_GRAY);
		gc.setBackground(selectedColorBg);

	} else if (chartLabel.isDeviceMarker()) {
		gc.setBackground(colorDevice);
	} else if (chartLabel.isVisible) {
		gc.setBackground(colorDefault);
	} else {
		gc.setBackground(colorHidden);
	}

	/*
	 * Rectangles can be merged into a union with regions, took me some time to find this
	 * solution :-)
	 */
	final Region region = new Region(gc.getDevice());

	final Rectangle paintedLabel = chartLabel.paintedLabel;
	if (paintedLabel != null) {

		final int devLabelX = paintedLabel.x - MARKER_HOVER_SIZE;
		final int devLabelY = paintedLabel.y - MARKER_HOVER_SIZE;
		final int devLabelWidth = paintedLabel.width + 2 * MARKER_HOVER_SIZE;
		final int devLabelHeight = paintedLabel.height + 2 * MARKER_HOVER_SIZE;

		region.add(devLabelX, devLabelY, devLabelWidth, devLabelHeight);
	}

	final int devMarkerX = chartLabel.devXMarker - MARKER_HOVER_SIZE;
	final int devMarkerY = chartLabel.devYMarker - MARKER_HOVER_SIZE;
	final int devMarkerSize = MARKER_POINT_SIZE + 2 * MARKER_HOVER_SIZE;

	region.add(devMarkerX, devMarkerY, devMarkerSize, devMarkerSize);

	// get whole chart rect
	final Rectangle clientRect = gc.getClipping();

	gc.setClipping(region);
	{
		gc.fillRectangle(clientRect);
	}
	region.dispose();
	gc.setClipping((Region) null);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:64,代码来源:ChartLayerMarker.java

示例11: setChangeDialog

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private Shell setChangeDialog() {

		final Shell changeBg = new Shell(shell);
		changeBg.setText("Background Styles");
		changeBg.setSize(730, 150);

		/* Names of background styles, also part of image file names */
		String[] backgroundList = { "Rainbow world", "Raining glass",
				"Music girl", "Maple leaf", "Deep blue", "Snowing world",
				"Natural sight" };

		/* Produce previews of backgrounds in form of square buttons */
		for (int i = 0; i < 7; i++) {

			/* String to generate preview image paths */
			final StringBuffer backgroundSmallImageFileName = new StringBuffer(
					"image/");

			/* String to generate background image paths */
			final StringBuffer backgroundImageFileName = new StringBuffer(
					"image/");

			/* Generate preview image paths */
			backgroundSmallImageFileName.append(backgroundList[i]);
			backgroundSmallImageFileName.append(" small");
			backgroundSmallImageFileName.append(".png");

			/* Generate background image paths */
			backgroundImageFileName.append(backgroundList[i]);
			backgroundImageFileName.append(".png");
			Image backgoundImageSmall = new Image(
					display,
					ResourceLoader.load(backgroundSmallImageFileName.toString()));

			Button backgroundBt = new Button(changeBg, SWT.PUSH);
			backgroundBt.setToolTipText(backgroundList[i]);

			/* Reset background according to clicked preview image */
			backgroundBt.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {

					backgroundImageName = backgroundImageFileName.toString();
					backgroundImage = new Image(display, ResourceLoader
							.load(backgroundImageName));
					setShell();
					saveBackgroungImage(backgroundImageName);
					changeBg.dispose();
				}
			});

			Region startBtRegion = new Region();
			startBtRegion.add(square(100));
			backgroundBt.setRegion(startBtRegion);
			backgroundBt.setImage(backgoundImageSmall);
			int xOffset = i * 100 + 10;
			backgroundBt.setBounds(xOffset, 15, 100, 100);
		}
		return changeBg;
	}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:61,代码来源:GUI.java

示例12: initializeHelpButton

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void initializeHelpButton() {

		Button helpBt = new Button(shell, SWT.PUSH);
		Image changeBtImage = new Image(display,
				ResourceLoader.load("/GUI/JustDoIt/image/help.png"));
		helpBt.setToolTipText(MESSAGE_HELP);

		/* Clicking help button trigger the help information dialog */
		helpBt.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {

				if (Desktop.isDesktopSupported()) {
					Desktop desktop = Desktop.getDesktop();
					InputStream resource = getClass().getResourceAsStream(
							"/GUI/JustDoIt/user_manual.pdf");
					try {
						File file = File.createTempFile("user_manual", ".pdf");
						file.deleteOnExit();
						OutputStream out = new FileOutputStream(file);
						try {
							int stream = resource.read();
							while (stream != -1) {
								out.write(stream);
								stream = resource.read();
							}
						} finally {
							out.close();
						}
						desktop.open(file);
						resource.close();
					} catch (IOException e1) {
						e1.printStackTrace();
					}
				}
			}
		});

		Region startBtRegion = new Region();
		startBtRegion.add(circle(10, 16, 16));
		helpBt.setRegion(startBtRegion);
		helpBt.setImage(changeBtImage);
		FormData helpData = new FormData(33, 33);
		helpData.right = new FormAttachment(85);
		helpData.top = new FormAttachment(2);
		helpBt.setLayoutData(helpData);
	}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:48,代码来源:GUI.java

示例13: redrawGadget

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void redrawGadget() {
	// create the region defining the gadget
	Region region = new Region();

	// set the circle data to the region
	int polygon = profiler.getPolygon();

	region.add(GadgetProfiler.generateCircle(polygon, polygon, polygon));

	// define the shape of the shell
	gadget.getShell().setRegion(region);

	Rectangle size = region.getBounds();
	gadget.getShell().setSize(size.width, size.height);

	// dispose of the region object
	region.dispose();

}
 
开发者ID:coddo,项目名称:TeamSubb,代码行数:20,代码来源:GadgetController.java

示例14: addRegion

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private void addRegion(Shell shell) {
	Region region = new Region();
	Point s = shell.getSize();

	/* Add entire Shell */
	region.add(0, 0, s.x, s.y);

	/* Subtract Top-Left Corner */
	region.subtract(0, 0, 5, 1);
	region.subtract(0, 1, 3, 1);
	region.subtract(0, 2, 2, 1);
	region.subtract(0, 3, 1, 1);
	region.subtract(0, 4, 1, 1);

	/* Subtract Top-Right Corner */
	region.subtract(s.x - 5, 0, 5, 1);
	region.subtract(s.x - 3, 1, 3, 1);
	region.subtract(s.x - 2, 2, 2, 1);
	region.subtract(s.x - 1, 3, 1, 1);
	region.subtract(s.x - 1, 4, 1, 1);

	/* Subtract Bottom-Left Corner */
	region.subtract(0, s.y, 5, 1);
	region.subtract(0, s.y - 1, 3, 1);
	region.subtract(0, s.y - 2, 2, 1);
	region.subtract(0, s.y - 3, 1, 1);
	region.subtract(0, s.y - 4, 1, 1);

	/* Subtract Bottom-Right Corner */
	region.subtract(s.x - 5, s.y - 0, 5, 1);
	region.subtract(s.x - 3, s.y - 1, 3, 1);
	region.subtract(s.x - 2, s.y - 2, 2, 1);
	region.subtract(s.x - 1, s.y - 3, 1, 1);
	region.subtract(s.x - 1, s.y - 4, 1, 1);

	/* Dispose old first */
	if (shell.getRegion() != null) {
		shell.getRegion().dispose();
	}

	/* Apply Region */
	shell.setRegion(region);

	/* Remember to dispose later */
	lastUsedRegion = region;
}
 
开发者ID:awltech,项目名称:eclipse-mylyn-notifications,代码行数:47,代码来源:AbstractNotificationPopup.java


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