本文整理汇总了Java中org.eclipse.draw2d.Graphics.restoreState方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.restoreState方法的具体用法?Java Graphics.restoreState怎么用?Java Graphics.restoreState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.restoreState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintChildren
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Override the original paintChildren to avoid to pain elements
* that are marked as not visible inside the model
*/
protected void paintChildren(Graphics graphics) {
for (int i = 0; i < getChildren().size(); i++) {
IFigure child = (IFigure) getChildren().get(i);
if (child.isVisible() && isFigurevisible(child)) {
// determine clipping areas for child
Rectangle[] clipping = null;
if (getClippingStrategy() != null) {
clipping = getClippingStrategy().getClip(child);
} else {
// default clipping behavior is to clip at bounds
clipping = new Rectangle[] { child.getBounds() };
}
// child may now paint inside the clipping areas
for (int j = 0; j < clipping.length; j++) {
if (clipping[j].intersects(graphics.getClip(Rectangle.SINGLETON))) {
graphics.clipRect(clipping[j]);
child.paint(graphics);
graphics.restoreState();
}
}
}
}
}
示例2: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle bounds = getBounds();
graphics.setBackgroundColor(headerColor);
float bw = getBorder().getBorderWidth();
if (hasHeader()){
PrecisionRectangle top = new PrecisionRectangle();
top.setX(bounds.x + bw);
top.setY(bounds.y + bw);
top.setWidth(bounds.width - 2*bw);
top.setHeight(getTitleHeight());
//Path topPath = Drawer.getPartlyRoundedRectangle(top, getBorder().getBorderRadius() - bw, true, true, false, false);
Path topPath = Drawer.getTopRoundedRectangle(top, getBorder().getActualBorderRadius(getBounds()) - bw);
graphics.fillPath(topPath);
}
if (footerTitle != null || hasFooterView){
PrecisionRectangle bottom = new PrecisionRectangle();
bottom.setX(bounds.x + bw);
bottom.setY(bounds.bottom() - bw - getTitleHeight());
bottom.setWidth(bounds.width - 2*bw);
bottom.setHeight(getTitleHeight());
//Path bottomPath = Drawer.getPartlyRoundedRectangle(bottom, getBorder().getBorderRadius() - bw, false, false, true, true);
Path bottomPath = Drawer.getBottomRoundedRectangle(bottom, getBorder().getActualBorderRadius(getBounds()) - bw);
graphics.fillPath(bottomPath);
}
graphics.restoreState();
this.paintString(graphics, headerTitle, true);
this.paintString(graphics, footerTitle, false);
}
示例3: paintClientArea
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintClientArea(Graphics graphics) {
if (getChildren().isEmpty())
return;
graphics.translate(getBounds().x + getInsets().left, getBounds().y
+ getInsets().top);
graphics.clipRect(getFullArea());
graphics.pushState();
paintChildren(graphics);
graphics.popState();
graphics.restoreState();
}
示例4: paintChildren
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Override the original paintChildren to avoid to pain elements
* that are marked as not visible inside the model
*/
protected void paintChildren(Graphics graphics) {
//if (!isMainEditor()) return;
for (int i = 0; i < getChildren().size(); i++) {
IFigure child = (IFigure) getChildren().get(i);
boolean modelVisible = true;
if (child instanceof FrameFigure){
ANode model = ((FrameFigure)child).getModel();
if (model != null) {
modelVisible = model.isVisible();
child.setVisible(modelVisible);
}
}
if (child.isVisible() && modelVisible && isFigurevisible(child)) {
// determine clipping areas for child
Rectangle[] clipping = null;
if (getClippingStrategy() != null) {
clipping = getClippingStrategy().getClip(child);
} else {
// default clipping behavior is to clip at bounds
clipping = new Rectangle[] { child.getBounds() };
}
// child may now paint inside the clipping areas
for (int j = 0; j < clipping.length; j++) {
if (clipping[j].intersects(graphics.getClip(Rectangle.SINGLETON))) {
graphics.clipRect(clipping[j]);
child.paint(graphics);
graphics.restoreState();
}
}
}
}
}