本文整理汇总了Java中org.eclipse.swt.graphics.Region.subtract方法的典型用法代码示例。如果您正苦于以下问题:Java Region.subtract方法的具体用法?Java Region.subtract怎么用?Java Region.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.Region
的用法示例。
在下文中一共展示了Region.subtract方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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);
}
示例4: 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;
}