本文整理汇总了Java中org.eclipse.draw2d.Graphics.setXORMode方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.setXORMode方法的具体用法?Java Graphics.setXORMode怎么用?Java Graphics.setXORMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.setXORMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Paints this Figure's primary representation, or background
*
* @param graphics
* The Graphics used to paint
*/
protected void paintFigure(Graphics graphics) {
Rectangle rect = getBounds().getCopy();
graphics.setXORMode(true);
graphics.setForegroundColor(ColorConstants.white);
graphics.setBackgroundColor(CustomColorRegistry.INSTANCE.getColorFromRegistry( 31, 31, 31));
graphics.translate(getLocation());
PointList outline = new PointList();
outline.addPoint(0, 0);
outline.addPoint(rect.width - getCornerSize(), 0);
outline.addPoint(rect.width - 1, getCornerSize());
outline.addPoint(rect.width - 1, rect.height - 1);
outline.addPoint(0, rect.height - 1);
graphics.fillPolygon(outline);
// draw the inner outline
PointList innerLine = new PointList();
innerLine.addPoint(rect.width - getCornerSize() - 1, 0);
innerLine.addPoint(rect.width - getCornerSize() - 1, getCornerSize());
innerLine.addPoint(rect.width - 1, getCornerSize());
innerLine.addPoint(rect.width - getCornerSize() - 1, 0);
innerLine.addPoint(0, 0);
innerLine.addPoint(0, rect.height - 1);
innerLine.addPoint(rect.width - 1, rect.height - 1);
innerLine.addPoint(rect.width - 1, getCornerSize());
graphics.drawPolygon(innerLine);
graphics.drawLine(rect.width - getCornerSize() - 1, 0, rect.width - 1, getCornerSize());
graphics.translate(getLocation().getNegated());
}
示例2: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintFigure(Graphics g) {
g.setLineStyle(Graphics.LINE_DOT);
g.setXORMode(true);
g.setForegroundColor(ColorConstants.black);
if (bounds.width > bounds.height) {
g.drawLine(bounds.x, bounds.y, bounds.right(), bounds.y);
g.drawLine(bounds.x + 2, bounds.y, bounds.right(), bounds.y);
} else {
g.drawLine(bounds.x, bounds.y, bounds.x, bounds.bottom());
g.drawLine(bounds.x, bounds.y + 2, bounds.x, bounds.bottom());
}
}
示例3: paint
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void paint(Graphics graphics) {
graphics.setAdvanced(false);
graphics.setXORMode(true);
super.paint(graphics);
}