public void drawPolygon( int[] polygon ) { gc.drawPolygon( polygon ); }
public void drawPolygon( int[] polygon ) { gc.drawPolygon( polygon ); }
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 ); }
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 ); }
@Override public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } });
@Override public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } });
/** {@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); }
public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } });
void drawPolygon(Point... points) { gc.get().drawPolygon(toCoordinates(points)); }
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}); }
public void paintControl(PaintEvent pe) { pe.gc.drawText(text, hm, hm); if(!CARBON) { pe.gc.drawPolygon(getPolygon(true)); } } });
@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); } }
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); }
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); }
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); }
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); }
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(); } }); }
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(); } }); }
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(); } }); }
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); }