本文整理汇总了Java中org.eclipse.swt.graphics.Path.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java Path.dispose方法的具体用法?Java Path.dispose怎么用?Java Path.dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.Path
的用法示例。
在下文中一共展示了Path.dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decrementGCCount
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
* Decreases the number of uses of this graphics 2d object.
*/
public static void decrementGCCount() {
CACHE_COUNT--;
if (CACHE_COUNT == 0) {
for (final Iterator i = FONT_CACHE.values().iterator(); i.hasNext();) {
final org.eclipse.swt.graphics.Font font = (org.eclipse.swt.graphics.Font) i.next();
font.dispose();
}
for (final Iterator i = COLOR_CACHE.values().iterator(); i.hasNext();) {
final org.eclipse.swt.graphics.Color color = (org.eclipse.swt.graphics.Color) i.next();
color.dispose();
}
for (final Iterator i = SHAPE_CACHE.values().iterator(); i.hasNext();) {
final Path path = (Path) i.next();
path.dispose();
}
}
}
示例2: paintToImage
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
public static Image paintToImage(DrawableViewNode tree) {
Image image =
new Image(Display.getDefault(), (int) Math.ceil(tree.bounds.width), (int) Math
.ceil(tree.bounds.height));
Transform transform = new Transform(Display.getDefault());
transform.identity();
transform.translate((float) -tree.bounds.x, (float) -tree.bounds.y);
Path connectionPath = new Path(Display.getDefault());
GC gc = new GC(image);
// Can't use Display.getDefault().getSystemColor in a non-UI thread.
Color white = new Color(Display.getDefault(), 255, 255, 255);
Color black = new Color(Display.getDefault(), 0, 0, 0);
gc.setForeground(white);
gc.setBackground(black);
gc.fillRectangle(0, 0, image.getBounds().width, image.getBounds().height);
gc.setTransform(transform);
paintRecursive(gc, transform, tree, null, connectionPath);
gc.drawPath(connectionPath);
gc.dispose();
connectionPath.dispose();
white.dispose();
black.dispose();
return image;
}
示例3: decrementGCCount
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
* Decreases the number of uses of this graphics 2d object.
*/
public static void decrementGCCount() {
CACHE_COUNT--;
if (CACHE_COUNT == 0) {
for (final Iterator i = FONT_CACHE.values().iterator(); i.hasNext();) {
final org.eclipse.swt.graphics.Font font = (org.eclipse.swt.graphics.Font) i.next();
font.dispose();
}
FONT_CACHE.clear();
for (final Iterator i = COLOR_CACHE.values().iterator(); i.hasNext();) {
final org.eclipse.swt.graphics.Color color = (org.eclipse.swt.graphics.Color) i.next();
color.dispose();
}
COLOR_CACHE.clear();
for (final Iterator i = SHAPE_CACHE.values().iterator(); i.hasNext();) {
final Path path = (Path) i.next();
path.dispose();
}
SHAPE_CACHE.clear();
}
}
示例4: drawBackground
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
private void drawBackground(final GC gc, final Rectangle rect) {
setBackground(getParent().getBackground());
final GamaUIColor color = GamaColors.get(colorCode);
final Color background = hovered ? color.lighter() : color.color();
final Color foreground = GamaColors.getTextColorForBackground(background).color();
gc.setForeground(foreground);
gc.setBackground(background);
if (down) {
gc.fillRoundRectangle(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2, 5, 5);
} else {
final Path path = createClipping(rect);
gc.setClipping(path);
gc.fillRectangle(rect);
gc.setClipping((Rectangle) null);
path.dispose();
}
}
示例5: paintControl
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
@Override
public void paintControl(PaintEvent e) {
GC gc = e.gc;
gc.setAntialias(SWT.ON);
Rectangle bounds = getBounds();
Path path = new Path(getDisplay());
path.addArc(bounds.x, bounds.y, arcSize, arcSize, 90, 180);
// path.addRectangle(bounds.x + arcSize / 2, bounds.y, bounds.width - arcSize,
// arcSize);
path.addArc(bounds.x + bounds.width - arcSize, bounds.y, arcSize, arcSize,
270, 180);
// gc.setClipping(path);
Color b = gc.getBackground();
gc.setBackground(backgroundColor);
gc.fillPath(path);
path.dispose();
gc.setAntialias(SWT.OFF);
gc.setBackground(b);
}
示例6: clipPath
import org.eclipse.swt.graphics.Path; //导入方法依赖的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();
}
}
示例7: fill
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/** fill an arbitrary shape on the swt graphic composite
* with the current stroke and paint.
* note that for consistency with the awt method, it is needed
* to switch temporarily the foreground and background colors.
* @see java.awt.Graphics2D#fill(java.awt.Shape)
*/
public void fill(Shape shape) {
Path path = toSwtPath(shape);
switchColors();
this.gc.fillPath(path);
switchColors();
path.dispose();
}
示例8: setClip
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
public void setClip(Shape clip) {
if (clip == null)
return;
Path clipPath = toSwtPath(clip);
gc.setClipping(clipPath);
clipPath.dispose();
}
示例9: setClip
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
* Sets the clip region.
*
* @param clip the clip.
*/
public void setClip(Shape clip) {
if (clip == null) {
return;
}
Path clipPath = toSwtPath(clip);
this.gc.setClipping(clipPath);
clipPath.dispose();
}
示例10: fill
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/**
* Fills the specified shape using the current paint.
*
* @param shape the shape (<code>null</code> not permitted).
*
* @see #getPaint()
* @see #draw(Shape)
*/
public void fill(Shape shape) {
Path path = toSwtPath(shape);
// Note that for consistency with the AWT implementation, it is
// necessary to switch temporarily the foreground and background
// colours
switchColors();
this.gc.fillPath(path);
switchColors();
path.dispose();
}
示例11: paint
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
@Override
public void paint(Graphics graphics) {
graphics.pushState();
graphics.setForegroundColor(getForegroundColor());
graphics.setBackgroundColor(getBackgroundColor());
super.paint(graphics);
Path path = new Path(Display.getDefault());
path.addArc(getBounds().x, getBounds().y, getBounds().width - 1, getBounds().height - 1, 0, 360);
graphics.setClip(path);
graphics.setLineWidth(2);
graphics.drawLine(bounds.getTopLeft(), bounds.getBottomRight());
graphics.drawLine(bounds.getTopRight(), bounds.getBottomLeft());
path.dispose();
graphics.popState();
}
示例12: paintControl
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
@Override
public void paintControl(PaintEvent e) {
synchronized (TreeViewOverview.this) {
if (mTree != null) {
e.gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
e.gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
e.gc.fillRectangle(0, 0, getBounds().width, getBounds().height);
e.gc.setTransform(mTransform);
e.gc.setLineWidth((int) Math.ceil(0.7 / mScale));
Path connectionPath = new Path(Display.getDefault());
paintRecursive(e.gc, mTree, connectionPath);
e.gc.drawPath(connectionPath);
connectionPath.dispose();
if (mViewport != null) {
e.gc.setAlpha(50);
e.gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
e.gc.fillRectangle((int) mViewport.x, (int) mViewport.y, (int) Math
.ceil(mViewport.width), (int) Math.ceil(mViewport.height));
e.gc.setAlpha(255);
e.gc
.setForeground(Display.getDefault().getSystemColor(
SWT.COLOR_DARK_GRAY));
e.gc.setLineWidth((int) Math.ceil(2 / mScale));
e.gc.drawRectangle((int) mViewport.x, (int) mViewport.y, (int) Math
.ceil(mViewport.width), (int) Math.ceil(mViewport.height));
}
}
}
}
示例13: paintScale
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
void paintScale(final GC gc) {
gc.setBackground(IGamaColors.BLACK.color());
final int BAR_WIDTH = 1;
final int BAR_HEIGHT = 8;
final int x = 0;
final int y = 0;
final int margin = 20;
final int width = scalebar.getBounds().width - 2 * margin;
final int height = scalebar.getBounds().height;
final int barStartX = x + 1 + BAR_WIDTH / 2 + margin;
final int barStartY = y + height - BAR_HEIGHT / 2;
final Path path = new Path(WorkbenchHelper.getDisplay());
path.moveTo(barStartX, barStartY - BAR_HEIGHT + 2);
path.lineTo(barStartX, barStartY + 2);
path.moveTo(barStartX, barStartY - BAR_HEIGHT / 2 + 2);
path.lineTo(barStartX + width, barStartY - BAR_HEIGHT / 2 + 2);
path.moveTo(barStartX + width, barStartY - BAR_HEIGHT + 2);
path.lineTo(barStartX + width, barStartY + 2);
gc.setForeground(IGamaColors.WHITE.color());
gc.setLineStyle(SWT.LINE_SOLID);
gc.setLineWidth(BAR_WIDTH);
gc.drawPath(path);
gc.setFont(coord.getFont());
drawStringCentered(gc, "0", barStartX, barStartY - 6, false);
drawStringCentered(gc, getScaleRight(), barStartX + width, barStartY - 6, false);
path.dispose();
}
示例14: drawPath
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/** @see Graphics#drawPath(Path) */
public void drawPath(Path path) {
Path scaledPath = createScaledPath(path);
try {
graphics.drawPath(scaledPath);
} finally {
scaledPath.dispose();
}
}
示例15: fillPath
import org.eclipse.swt.graphics.Path; //导入方法依赖的package包/类
/** @see Graphics#fillPath(Path) */
public void fillPath(Path path) {
Path scaledPath = createScaledPath(path);
try {
graphics.fillPath(scaledPath);
} finally {
scaledPath.dispose();
}
}