/**
* 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();
}
}
SWTGraphics.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:gef-gwt
作者:
评论列表
文章目录