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


Java Region类代码示例

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


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

示例1: refreshLabel

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
void refreshLabel () {
	int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0, regions = 0;
	for (int i=0; i<objects.length; i++) {
		Object object = objects [i];
		if (object instanceof Color) colors++;
		if (object instanceof Cursor) cursors++;
		if (object instanceof Font) fonts++;
		if (object instanceof GC) gcs++;
		if (object instanceof Image) images++;
		if (object instanceof Region) regions++;
	}
	String string = ""; //$NON-NLS-1$
	if (colors != 0) string += colors + " Color(s)\n"; //$NON-NLS-1$
	if (cursors != 0) string += cursors + " Cursor(s)\n"; //$NON-NLS-1$
	if (fonts != 0) string += fonts + " Font(s)\n"; //$NON-NLS-1$
	if (gcs != 0) string += gcs + " GC(s)\n"; //$NON-NLS-1$
	if (images != 0) string += images + " Image(s)\n"; //$NON-NLS-1$
	if (regions != 0) string += regions + " Region(s)\n"; //$NON-NLS-1$
	if (string.length () != 0) {
		string = string.substring (0, string.length () - 1);
	}
	label.setText (string);
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:24,代码来源:Sleak.java

示例2: clipPath

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
/**
 * Simple implementation of clipping a Path within the context of current
 * clipping rectangle for now (not region) <li>Note that this method wipes
 * out the clipping rectangle area, hence if clients need to reset it call
 * {@link #restoreState()}
 * 
 * @see org.eclipse.draw2d.Graphics#clipPath(org.eclipse.swt.graphics.Path)
 */
public void clipPath(Path path) {
	initTransform(false);
	if (((appliedState.graphicHints ^ currentState.graphicHints) & FILL_RULE_MASK) != 0) {
		// If there is a pending change to the fill rule, apply it first.
		gc.setFillRule(((currentState.graphicHints & FILL_RULE_MASK) >> FILL_RULE_SHIFT)
				- FILL_RULE_WHOLE_NUMBER);
		// As long as the FILL_RULE is stored in a single bit, just toggling
		// it works.
		appliedState.graphicHints ^= FILL_RULE_MASK;
	}
	Rectangle clipping = currentState.relativeClip != null ? getClip(new Rectangle())
			: new Rectangle();
	if (!clipping.isEmpty()) {
		Path flatPath = new Path(path.getDevice(), path, 0.01f);
		PathData pathData = flatPath.getPathData();
		flatPath.dispose();
		Region region = new Region(path.getDevice());
		loadPath(region, pathData.points, pathData.types);
		region.intersect(new org.eclipse.swt.graphics.Rectangle(clipping.x,
				clipping.y, clipping.width, clipping.height));
		gc.setClipping(region);
		appliedState.relativeClip = currentState.relativeClip = null;
		region.dispose();
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:34,代码来源:SWTGraphics.java

示例3: refreshLabel

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
void refreshLabel() {
    @SuppressWarnings("unused")
    int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0, regions = 0;
    for (int i = 0; i < objects.length; i++) {
        Object object = objects[i];
        if (object instanceof Color) colors++;
        if (object instanceof Cursor) cursors++;
        if (object instanceof Font) fonts++;
        if (object instanceof GC) gcs++;
        if (object instanceof Image) images++;
        if (object instanceof Region) regions++;
    }
    String string = "";
    if (colors != 0) string += colors + " Color(s)\n";
    if (cursors != 0) string += cursors + " Cursor(s)\n";
    if (fonts != 0) string += fonts + " Font(s)\n";
    if (gcs != 0) string += gcs + " GC(s)\n";
    if (images != 0) string += images + " Image(s)\n";
    /* Currently regions are not counted. */
    // if (regions != 0) string += regions + " Region(s)\n";
    if (string.length() != 0) {
        string = string.substring(0, string.length() - 1);
    }
    label.setText(string);
}
 
开发者ID:prasser,项目名称:swtknob,代码行数:26,代码来源:Sleak.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: refreshLabel

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
void refreshLabel () {
  int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0, regions = 0;
  for (int i=0; i<objects.length; i++) {
    Object object = objects [i];
    if (object instanceof Color) colors++;
    if (object instanceof Cursor) cursors++;
    if (object instanceof Font) fonts++;
    if (object instanceof GC) gcs++;
    if (object instanceof Image) images++;
    if (object instanceof Region) regions++;
  }
  String string = "";
  if (colors != 0) string += colors + " Color(s)\n";
  if (cursors != 0) string += cursors + " Cursor(s)\n";
  if (fonts != 0) string += fonts + " Font(s)\n";
  if (gcs != 0) string += gcs + " GC(s)\n";
  if (images != 0) string += images + " Image(s)\n";
  /* Currently regions are not counted. */
  //  if (regions != 0) string += regions + " Region(s)\n";
  if (string.length () != 0) {
    string = string.substring (0, string.length () - 1);
  }
  label.setText (string);
}
 
开发者ID:ReadyTalk,项目名称:swt-bling,代码行数:25,代码来源:Sleak.java

示例10: 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

示例11: 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

示例12: 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

示例13: setAdvanced

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
/**
 * Equivalent to <code><b>GC.setAdvanced()</b></code> in r3.1.
 * 
 * @param gc
 * @param value
 */
static void setAdvanced( GC gc, boolean value, Region clipping )
{
	if ( R31_AVAILABLE )
	{
		gc.setAdvanced( value );

		// setAdvanced will clean the clipping info, restore it here.
		gc.setClipping( clipping );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:R31Enhance.java

示例14: setShell

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

		Region region = getBackRegionFromImage(display, backgroundImageName);

		/* Capture the transparent regions and remove them */
		Region corner = handleTransparenceRegion(backgroundImage, 0, 0);
		region.subtract(corner);
		shell.setRegion(region);

		/* Set shell size and background according to the region */
		Rectangle size = region.getBounds();
		shell.setSize(size.width, size.height);

		/* Load background */
		ImageLoader loader = new ImageLoader();
		ImageData[] imageData = loader.load(ResourceLoader
				.load(backgroundImageName));
		Image image = new Image(null, imageData[0]);
		shell.setBackgroundImage(image);
		shell.setBackgroundMode(SWT.INHERIT_FORCE);

		/* Set icon */
		Image shellIcon = new Image(Display.getCurrent(),
				GUI.class.getResourceAsStream("/GUI/JustDoIt/image/icon.png"));
		shell.setImage(shellIcon);

		/* Put the shell in center of screen */
		center(shell);
	}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:30,代码来源:GUI.java

示例15: refreshLabel

import org.eclipse.swt.graphics.Region; //导入依赖的package包/类
void refreshLabel () {
	int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0;
	int paths = 0, patterns = 0, regions = 0, textLayouts = 0, transforms= 0;
	for (int i=0; i<objects.length; i++) {
		Object object = objects [i];
		if (object instanceof Color) colors++;
		if (object instanceof Cursor) cursors++;
		if (object instanceof Font) fonts++;
		if (object instanceof GC) gcs++;
		if (object instanceof Image) images++;
		if (object instanceof Path) paths++;
		if (object instanceof Pattern) patterns++;
		if (object instanceof Region) regions++;
		if (object instanceof TextLayout) textLayouts++;
		if (object instanceof Transform) transforms++;
	}
	String string = "";
	if (colors != 0) string += colors + " Color(s)\n";
	if (cursors != 0) string += cursors + " Cursor(s)\n";
	if (fonts != 0) string += fonts + " Font(s)\n";
	if (gcs != 0) string += gcs + " GC(s)\n";
	if (images != 0) string += images + " Image(s)\n";
	if (paths != 0) string += paths + " Paths(s)\n";
	if (patterns != 0) string += patterns + " Pattern(s)\n";
	if (regions != 0) string += regions + " Region(s)\n";
	if (textLayouts != 0) string += textLayouts + " TextLayout(s)\n";
	if (transforms != 0) string += transforms + " Transform(s)\n";
	if (string.length () != 0) {
		string = string.substring (0, string.length () - 1);
	}
	label.setText (string);
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:33,代码来源:Sleak.java


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