本文整理了Java中org.eclipse.swt.graphics.GC.drawPolygon()
方法的一些代码示例,展示了GC.drawPolygon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GC.drawPolygon()
方法的具体详情如下:
包路径:org.eclipse.swt.graphics.GC
类名称:GC
方法名:drawPolygon
[英]Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color. The array contains alternating x and y values which are considered to represent points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and last pair in the array.
[中]使用接收器的前景色绘制由指定的整数坐标数组定义的闭合多边形。该数组包含交替的x和y值,这些值被视为表示作为多边形顶点的点。在每个连续对之间以及阵列中第一对和最后一对之间绘制线。
代码示例来源:origin: pentaho/pentaho-kettle
public void drawPolygon( int[] polygon ) {
gc.drawPolygon( polygon );
}
代码示例来源:origin: pentaho/pentaho-kettle
public void drawPolygon( int[] polygon ) {
gc.drawPolygon( polygon );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void drawMarker( GC gc, int x, int maxy ) {
int[] triangle =
new int[] {
LEFT + MARGIN + x * fontwidth + offset.x, TOP - 4, LEFT + MARGIN + x * fontwidth + offset.x + 3,
TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x - 3, TOP + 1 };
gc.fillPolygon( triangle );
gc.drawPolygon( triangle );
gc
.drawLine(
LEFT + MARGIN + x * fontwidth + offset.x, TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x, maxy );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void drawMarker( GC gc, int x, int maxy ) {
int[] triangle =
new int[] {
LEFT + MARGIN + x * fontwidth + offset.x, TOP - 4, LEFT + MARGIN + x * fontwidth + offset.x + 3,
TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x - 3, TOP + 1 };
gc.fillPolygon( triangle );
gc.drawPolygon( triangle );
gc
.drawLine(
LEFT + MARGIN + x * fontwidth + offset.x, TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x, maxy );
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public void paintControl(PaintEvent pe) {
pe.gc.drawPolygon(getPolygon(true));
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
public void paintControl(PaintEvent pe) {
pe.gc.drawPolygon(getPolygon(true));
}
});
代码示例来源:origin: org.piccolo2d/piccolo2d-swt
/** {@inheritDoc} */
public void drawPolygon(final int[] xPoints, final int[] yPoints, final int nPoints) {
final int[] ptArray = new int[2 * nPoints];
for (int i = 0; i < nPoints; i++) {
TEMP_POINT.setLocation(xPoints[i], yPoints[i]);
transform.transform(TEMP_POINT, TEMP_POINT);
ptArray[2 * i] = xPoints[i];
ptArray[2 * i + 1] = yPoints[i];
}
gc.drawPolygon(ptArray);
}
代码示例来源:origin: org.eclipse.xtext/ui
public void paintControl(PaintEvent pe) {
pe.gc.drawPolygon(getPolygon(true));
}
});
代码示例来源:origin: rinde/RinSim
void drawPolygon(Point... points) {
gc.get().drawPolygon(toCoordinates(points));
}
代码示例来源:origin: rinde/RinSim
void drawRect(Point corner1, Point corner2) {
final int x1 = vp.get().toCoordX(corner1.x);
final int y1 = vp.get().toCoordY(corner1.y);
final int x2 = vp.get().toCoordX(corner2.x);
final int y2 = vp.get().toCoordY(corner2.y);
gc.get().drawPolygon(new int[] {x1, y1, x2, y1, x2, y2, x1, y2});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
public void paintControl(PaintEvent pe) {
pe.gc.drawText(text, hm, hm);
if(!CARBON) {
pe.gc.drawPolygon(getPolygon(true));
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
@Override
public void paint(GC gc, int width, int height) {
int centerX = width / 2;
int centerY = height / 2;
int pos = 0;
for (int i = 0; i < POINTS; ++i) {
double r = Math.PI*2 * pos/POINTS;
radial[i*2] = (int)((1+Math.cos(r))*centerX);
radial[i*2+1] = (int)((1+Math.sin(r))*centerY);
pos = (pos + POINTS/2) % POINTS;
}
gc.setFillRule(fillRuleCb.getSelectionIndex() != 0 ? SWT.FILL_WINDING : SWT.FILL_EVEN_ODD);
gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
gc.fillPolygon(radial);
gc.drawPolygon(radial);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
private void paintBottom(GC gc) {
int[] left = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER;
int[] right = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER;
int[] shape = new int[left.length + right.length + 4];
int index = 0;
Point size = container.getSize();
int x = 0;
int y = 0;
index = fillShape(shape, left, index, x, y, false);
x = size.x - 1;
index = fillShape(shape, right, index, x, y, false);
shape[index++] = size.x - 1;
shape[index++] = size.y;
shape[index++] = 0;
shape[index++] = size.y;
gc.fillPolygon(shape);
gc.drawPolygon(shape);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
private void paintLeft(GC gc) {
int[] top = simple ? SIMPLE_TOP_RIGHT_CORNER : TOP_RIGHT_CORNER;
int[] bot = simple ? SIMPLE_BOTTOM_RIGHT_CORNER : BOTTOM_RIGHT_CORNER;
int[] shape = new int[top.length + bot.length + 4];
int index = 0;
Point size = container.getSize();
int x = size.x - 1;
int y = 0;
index = fillShape(shape, top, index, x, y, false);
y = size.y - 1;
index = fillShape(shape, bot, index, x, y, true);
shape[index++] = -1;
shape[index++] = size.y - 1;
shape[index++] = -1;
shape[index++] = 0;
gc.fillPolygon(shape);
gc.drawPolygon(shape);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
private void paintRight(GC gc) {
int[] top = simple ? SIMPLE_TOP_LEFT_CORNER : TOP_LEFT_CORNER;
int[] bot = simple ? SIMPLE_BOTTOM_LEFT_CORNER : BOTTOM_LEFT_CORNER;
int[] shape = new int[top.length + bot.length + 4];
int index = 0;
Point size = container.getSize();
int x = 0;
int y = 0;
index = fillShape(shape, top, index, x, y, false);
shape[index++] = size.x;
shape[index++] = 0;
shape[index++] = size.x;
shape[index++] = size.y - 1;
x = 0;
y = size.y - 1;
fillShape(shape, bot, index, x, y, true);
gc.fillPolygon(shape);
gc.drawPolygon(shape);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private static void drawViewMenu(GC gc, GC maskgc) {
Display display = Display.getCurrent();
gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
int[] shapeArray = new int[] {1, 1, 10, 1, 6, 5, 5, 5};
gc.fillPolygon(shapeArray);
gc.drawPolygon(shapeArray);
Color black = display.getSystemColor(SWT.COLOR_BLACK);
Color white = display.getSystemColor(SWT.COLOR_WHITE);
maskgc.setBackground(black);
maskgc.fillRectangle(0,0,12,16);
maskgc.setBackground(white);
maskgc.setForeground(white);
maskgc.fillPolygon(shapeArray);
maskgc.drawPolygon(shapeArray);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
Hover(Shell parent) {
final Display display = parent.getDisplay();
hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP
| SWT.NO_FOCUS | SWT.TOOL);
hoverShell.setBackground(display
.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
hoverShell.setForeground(display
.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
hoverShell.addPaintListener(pe -> {
pe.gc.drawString(text, hm, hm);
if (!MAC) {
pe.gc.drawPolygon(getPolygon(true));
}
});
hoverShell.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
hideHover();
}
});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
Hover(Shell parent) {
final Display display = parent.getDisplay();
hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP
| SWT.NO_FOCUS | SWT.TOOL);
hoverShell.setBackground(display
.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
hoverShell.setForeground(display
.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
hoverShell.addPaintListener(pe -> {
pe.gc.drawString(text, hm, hm);
if (!MAC) {
pe.gc.drawPolygon(getPolygon(true));
}
});
hoverShell.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
hideHover();
}
});
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
Hover(Shell parent) {
final Display display = parent.getDisplay();
hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP
| SWT.NO_FOCUS | SWT.TOOL);
hoverShell.setBackground(display
.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
hoverShell.setForeground(display
.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
hoverShell.addPaintListener(pe -> {
pe.gc.drawText(text, hm, hm);
if (!MAC) {
pe.gc.drawPolygon(getPolygon(true));
}
});
hoverShell.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
hideHover();
}
});
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.server.ui
protected void paintRect(GC gc, int x, int y, Color a, Color b, Color c) {
int[] p = new int[] { 0, 2, 2, 0, 30, 0, 32, 2, 32, 30, 30, 32, 2, 32, 0, 30};
int[] q = new int[p.length];
for (int i = 0; i < p.length / 2; i++) {
q[i*2] = p[i*2] + x;
q[i*2+1] = p[i*2+1] + y;
}
Region region = new Region(getDisplay());
region.add(q);
gc.setClipping(region);
gc.setBackground(a);
gc.setForeground(b);
gc.fillGradientRectangle(x, y, 32, 32, true);
gc.setClipping((Region)null);
gc.setForeground(c);
gc.drawPolygon(q);
gc.setForeground(getForeground());
gc.setBackground(getBackground());
String st = "Tomcat Test Environment";
Point stp = gc.stringExtent(st);
gc.drawString(st, x+16 - stp.x / 2, y + 32 + 2);
}
内容来源于网络,如有侵权,请联系作者删除!