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


Java Path.dispose方法代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:SWTGraphics2D.java

示例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;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:27,代码来源:TreeView.java

示例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();
    }
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:25,代码来源:SWTGraphics2D.java

示例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();
	}

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:FlatButton.java

示例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);
	}
 
开发者ID:Talend,项目名称:tesb-studio-se,代码行数:20,代码来源:SearchControl.java

示例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();
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:34,代码来源:SWTGraphics.java

示例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();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:SWTGraphics2D.java

示例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();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:SWTGraphics2D.java

示例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();
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:14,代码来源:SWTGraphics2D.java

示例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();
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:19,代码来源:SWTGraphics2D.java

示例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();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:16,代码来源:ExitFigure.java

示例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));
            }
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:TreeViewOverview.java

示例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();
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:30,代码来源:DisplayOverlay.java

示例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();
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:10,代码来源:ScaledGraphics.java

示例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();
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:10,代码来源:ScaledGraphics.java


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