本文整理汇总了Java中org.eclipse.draw2d.Graphics.getClip方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.getClip方法的具体用法?Java Graphics.getClip怎么用?Java Graphics.getClip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.getClip方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printPages
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void printPages() {
final Graphics graphics = getFreshPrinterGraphics();
final IFigure figure = getPrintSource();
setupPrinterGraphicsFor(graphics, figure);
final Rectangle bounds = figure.getBounds();
int x = bounds.x, y = bounds.y;
final Rectangle clipRect = new Rectangle();
while (y < bounds.y + bounds.height) {
while (x < bounds.x + bounds.width) {
graphics.pushState();
getPrinter().startPage();
graphics.translate(-x, -y);
graphics.getClip(clipRect);
clipRect.setLocation(x, y);
graphics.clipRect(clipRect);
figure.paint(graphics);
getPrinter().endPage();
graphics.popState();
x += clipRect.width;
}
x = bounds.x;
y += clipRect.height;
}
}
示例2: printPages
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void printPages() {
Graphics graphics = getFreshPrinterGraphics();
IFigure figure = getPrintSource();
setupPrinterGraphicsFor(graphics, figure);
Rectangle bounds = figure.getBounds();
int x = bounds.x, y = bounds.y;
Rectangle clipRect = new Rectangle();
while (y < bounds.y + bounds.height) {
while (x < bounds.x + bounds.width) {
graphics.pushState();
getPrinter().startPage();
graphics.translate(-x, -y);
graphics.getClip(clipRect);
clipRect.setLocation(x, y);
graphics.clipRect(clipRect);
figure.paint(graphics);
getPrinter().endPage();
graphics.popState();
x += clipRect.width;
}
x = bounds.x;
y += clipRect.height;
}
}
示例3: printPages
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void printPages() {
final Graphics graphics = getFreshPrinterGraphics();
final IFigure figure = getPrintSource();
setupPrinterGraphicsFor(graphics, figure);
final Rectangle bounds = figure.getBounds();
int x = bounds.x, y = bounds.y;
final Rectangle clipRect = new Rectangle();
while (y < bounds.y + bounds.height) {
while (x < bounds.x + bounds.width) {
graphics.pushState();
getPrinter().startPage();
graphics.translate(-x, -y);
graphics.getClip(clipRect);
clipRect.setLocation(x, y);
graphics.clipRect(clipRect);
figure.paint(graphics);
getPrinter().endPage();
graphics.popState();
x += clipRect.width;
}
x = bounds.x;
y += clipRect.height;
}
}
示例4: paintGrid
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void paintGrid(final Graphics g) {
super.paintGrid(g);
final Rectangle clip = g.getClip(Rectangle.SINGLETON);
final PageSetting pageSetting = diagram.getPageSetting();
final int width = pageSetting.getWidth();
final int height = pageSetting.getHeight();
final Rectangle rect = clip;
final Color color = g.getForegroundColor();
g.setForegroundColor(ColorConstants.lightGray);
int startX = rect.x;
if (startX > 0) {
startX = 0;
}
int startY = rect.y;
if (startY > 0) {
startY = 0;
}
for (int i = startX; i < rect.x + rect.width; i += width) {
g.drawLine(i, rect.y, i, rect.y + rect.height);
}
for (int i = startY; i < rect.y + rect.height; i += height) {
g.drawLine(rect.x, i, rect.x + rect.width, i);
}
g.setForegroundColor(color);
i++;
if (i > 0) {
i = -1;
repaint();
}
}
示例5: paintGrid
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void paintGrid(Graphics g) {
super.paintGrid(g);
Rectangle clip = g.getClip(Rectangle.SINGLETON);
PageSetting pageSetting = diagram.getPageSetting();
int width = pageSetting.getWidth();
int height = pageSetting.getHeight();
Rectangle rect = clip;
Color color = g.getForegroundColor();
g.setForegroundColor(ColorConstants.lightGray);
int startX = rect.x;
if (startX > 0) {
startX = 0;
}
int startY = rect.y;
if (startY > 0) {
startY = 0;
}
for (int i = startX; i < rect.x + rect.width; i += width) {
g.drawLine(i, rect.y, i, rect.y + rect.height);
}
for (int i = startY; i < rect.y + rect.height; i += height) {
g.drawLine(rect.x, i, rect.x + rect.width, i);
}
g.setForegroundColor(color);
i++;
if (i > 0) {
i = -1;
repaint();
}
}
示例6: paintGrid
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintGrid(Graphics g) {
super.paintGrid(g);
Rectangle clip = g.getClip(Rectangle.SINGLETON);
PageSettings pageSetting = diagram.getPageSetting();
int width = pageSetting.getWidth();
int height = pageSetting.getHeight();
Rectangle rect = clip;
Color color = g.getForegroundColor();
g.setForegroundColor(ColorConstants.lightGray);
int startX = rect.x;
if (startX > 0) {
startX = 0;
}
int startY = rect.y;
if (startY > 0) {
startY = 0;
}
for (int i = startX; i < rect.x + rect.width; i += width) {
g.drawLine(i, rect.y, i, rect.y + rect.height);
}
for (int i = startY; i < rect.y + rect.height; i += height) {
g.drawLine(rect.x, i, rect.x + rect.width, i);
}
g.setForegroundColor(color);
i++;
if (i > 0) {
i = -1;
repaint();
}
}