public void fillPolygon( int[] polygon ) { gc.fillPolygon( polygon ); }
public void fillPolygon( int[] polygon ) { gc.fillPolygon( 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 ); }
Color back = gc.getBackground(); gc.setBackground( fore ); gc.fillPolygon( new int[] { mx, my, x3, y3, x4, y4 } ); gc.setBackground( back );
public void fillPolygon(int[] pointArray) { gc.fillPolygon(pointArray); }
@Override public void draw(FigureDrawContext fdc) { int[] drawPoints = new int[points.length]; for (int i = 0; i < points.length; i += 2) { drawPoints[i] = points[i] * fdc.xScale - fdc.xOffset; drawPoints[i + 1] = points[i + 1] * fdc.yScale - fdc.yOffset; } fdc.gc.setBackground(color); fdc.gc.fillPolygon(drawPoints); } @Override
/** {@inheritDoc} */ public void fillPolygon(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.fillPolygon(ptArray); }
/** * Fill a polyline from the specified double array of points. * * @param pts double array of points */ public void fillPolygon(final double[] pts) { final int[] intPts = SWTShapeManager.transform(pts, transform); gc.fillPolygon(intPts); }
void fillPolygon(Point... points) { gc.get().fillPolygon(toCoordinates(points)); }
void fillRect(Point corner, double radius) { final int x1 = vp.get().toCoordX(corner.x - radius); final int y1 = vp.get().toCoordY(corner.y - radius); final int x2 = vp.get().toCoordX(corner.x + radius); final int y2 = vp.get().toCoordY(corner.y + radius); gc.get().fillPolygon(new int[] {x1, y1, x2, y1, x2, y2, x1, y2}); }
void fillRect(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().fillPolygon(new int[] {x1, y1, x2, y1, x2, y2, x1, y2}); }
/** * Fills the specified polygon. * * @param xPoints the x-coordinates. * @param yPoints the y-coordinates. * @param npoints the number of points. */ @Override public void fillPolygon(int[] xPoints, int[] yPoints, int npoints) { int[] pointArray = new int[npoints * 2]; for (int i = 0; i < npoints; i++) { pointArray[2 * i] = xPoints[i]; pointArray[2 * i + 1] = yPoints[i]; } switchColors(); this.gc.fillPolygon(pointArray); switchColors(); }
@Override public void paintControl(PaintEvent e) { /* * The graphic is drawn to the left of the titleLabel so define the offset from the titleLabel */ int offsetX = titleLabel.getBounds().x - 10; int offsetY = titleLabel.getBounds().y + 3; if (null != twistieColor) { e.gc.setBackground(twistieColor); } else { e.gc.setBackground(getForeground()); } if (isCollapsed) { e.gc.fillPolygon(translate(points_for_collapsed, offsetX, offsetY)); } else { e.gc.fillPolygon(translate(points_for_expanded, offsetX, offsetY)); } } });
private void drawCutout(GC gc, int x, int y, int radius, CirclePart side) { int centerX = x + (side.isLeft() ? radius : -radius); int centerY = y + (side.isTop() ? radius : -radius); int[] circle = drawCircle(centerX, centerY, radius, side); int[] result = new int[circle.length + 2]; result[0] = x; result[1] = y; int count = circle.length / 2; for (int idx = 0; idx < count; idx++) { int destIdx = idx * 2 + 2; int srcIdx = (count - 1 - idx) * 2; result[destIdx] = circle[srcIdx]; result[destIdx + 1] = circle[srcIdx + 1]; } gc.fillPolygon(result); }
@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); }
@Override public void paintControl(PaintEvent e) { Control c = (Control) e.widget; Point size = c.getSize(); int arrowSize = 8; int xStart = size.x - arrowSize; int yStart = size.y - (size.y + arrowSize) / 2; e.gc.setBackground(Colors.getSystemColor(e.display, SWT.COLOR_WIDGET_FOREGROUND)); e.gc.setAntialias(SWT.ON); e.gc.fillPolygon(new int[] { xStart, yStart, xStart + arrowSize, yStart + (arrowSize / 2), xStart, yStart + arrowSize, }); } };
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); }