public void setLineWidth( int width ) { gc.setLineWidth( width ); }
public void setLineWidth( int width ) { gc.setLineWidth( width ); }
protected void drawRect( GC gc, Rectangle rect ) { if ( rect == null ) { return; } gc.setLineStyle( SWT.LINE_DASHDOT ); gc.setLineWidth( 1 ); gc.setForeground( GUIResource.getInstance().getColorDarkGray() ); // PDI-2619: SWT on Windows doesn't cater for negative rect.width/height so handle here. Point s = new Point( rect.x + offset.x, rect.y + offset.y ); if ( rect.width < 0 ) { s.x = s.x + rect.width; } if ( rect.height < 0 ) { s.y = s.y + rect.height; } gc.drawRoundRectangle( s.x, s.y, Math.abs( rect.width ), Math.abs( rect.height ), 3, 3 ); gc.setLineStyle( SWT.LINE_SOLID ); }
public void drawErrorMarker(GC gc, int x, int y0) { int radius = Math.round(cellSize / 4); gc.setForeground(resourceManager.reds[2]); gc.setLineWidth(Math.max(1, Math.round(cellSize / 8))); gc.drawLine(x - radius, y0 - radius, x + radius, y0 + radius); gc.drawLine(x - radius, y0 + radius, x + radius, y0 - radius); }
private void restoreLastSettings( int lineWidth, Color foreground, int alpha ) { gc.setLineWidth( lineWidth ); gc.setForeground( foreground ); gc.setAlpha( alpha ); }
protected void drawLine(final Color color, final int x1, final int y1, final int x2, final int y2, final int width) { g.setForeground(color); g.setLineWidth(width); g.drawLine(cellX + x1, cellY + y1, cellX + x2, cellY + y2); }
private void dispatchLineWidth( JsonArray parameters ) { int width = parameters.get( 0 ).asInt(); gc.setLineWidth( width ); }
/** {@inheritDoc} */ public void drawPolyline(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.setLineWidth(getTransformedLineWidth()); gc.drawPolyline(ptArray); }
public void setStrokeWidth(double sw) { strokeWidth = sw; strokeWidthPx = Math.round(canvasControl.pixelSize(sw)); gc().setLineWidth(strokeWidthPx); stroke = strokeWidthPx > 0 && foreground.getAlpha() != 0; }
public void drawConnector(GC gc, int x0, int y0, int x1, int y1, Type type) { Color color = resourceManager.typeColor(type, false); if (type instanceof ArrayType) { gc.setLineWidth(arrayConnectorWidth); gc.setForeground(color); gc.drawLine(x0, y0, x1, y1); gc.setForeground(resourceManager.background); } else { gc.setForeground(color); } gc.setLineWidth(connectorWidth); gc.drawLine(x0, y0, x1, y1); }
protected void drawDot(final Color outline, final Color fill, final int x, final int y, final int w, final int h) { int dotX = cellX + x + 2; int dotY = cellY + y + 1; int dotW = w - 2; int dotH = h - 2; g.setBackground(fill); g.fillOval(dotX, dotY, dotW, dotH); g.setForeground(outline); g.setLineWidth(2); g.drawOval(dotX, dotY, dotW, dotH); }
private void drawRangeIndication(GC gc, Canvas canvas, Rectangle r) { final int MARGIN= 3; /* cap the height - at least on GTK, large numbers are converted to * negatives at some point */ int height= Math.min(r.y + r.height - MARGIN, canvas.getSize().y); gc.setForeground(canvas.getDisplay().getSystemColor(COLOR)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.drawLine(r.x + 4, r.y + 12, r.x + 4, height); gc.drawLine(r.x + 4, height, r.x + r.width - MARGIN, height); }
private void drawRangeIndication(GC gc, Canvas canvas, Rectangle r) { final int MARGIN= 3; /* cap the height - at least on GTK, large numbers are converted to * negatives at some point */ int height= Math.min(r.y + r.height - MARGIN, canvas.getSize().y); gc.setForeground(canvas.getDisplay().getSystemColor(COLOR)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.drawLine(r.x + 4, r.y + 12, r.x + 4, height); gc.drawLine(r.x + 4, height, r.x + r.width - MARGIN, height); }
@Override public void paintControl(PaintEvent e) { if (fTextWidget != null) { int x= fCachedWidgetX - fTextWidget.getHorizontalPixel(); if (x >= 0) { Rectangle area= fTextWidget.getClientArea(); e.gc.setForeground(fColor); e.gc.setLineStyle(fLineStyle); e.gc.setLineWidth(fLineWidth); e.gc.drawLine(x, 0, x, area.height); } } }
/** * Draws the outline of the specified rectangle. The left and right edges of * the rectangle are at x and x + width. The top and bottom edges are at y * and y + height. The rectangle is drawn using the graphics context's * current color. * * @param x the x coordinate of the rectangle to be drawn. * @param y the y coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. */ public void drawRect(final double x, final double y, final double width, final double height) { TEMP_RECT.setRect(x, y, width, height); SWTShapeManager.transform(TEMP_RECT, transform); SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT); gc.setLineWidth(getTransformedLineWidth()); gc.drawRectangle(SWT_RECT); }
@Override public void paintControl(PaintEvent e) { if (fTextWidget != null) { if (fFontForCachedWidgetX != fTextWidget.getFont()) { computeWidgetX(); } int x= fCachedWidgetX - fTextWidget.getHorizontalPixel(); if (x >= 0) { Rectangle area= fTextWidget.getClientArea(); e.gc.setForeground(fColor); e.gc.setLineStyle(fLineStyle); e.gc.setLineWidth(fLineWidth); e.gc.drawLine(x, 0, x, area.height); } } }
@Override public void paintControl(PaintEvent e) { Point s= fSummaryHeader.getSize(); if (fIndicatorColor != null) { Display d= fSummaryHeader.getDisplay(); e.gc.setBackground(getColor(d, fIndicatorColor)); int min= Math.min(s.x, s.y)-2*INSET; Rectangle r= new Rectangle((s.x-min)/2, (s.y-min)/2, min, min); e.gc.fillRectangle(r); if (d != null) drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); e.gc.setForeground(fSeparatorColor); e.gc.setLineWidth(0 /* 1 */); e.gc.drawLine(0+1, s.y-1, s.x-1-1, s.y-1); } } }
public void paintControl(PaintEvent e) { Point s= fSummaryHeader.getSize(); if (fIndicatorColor != null) { Display d= fSummaryHeader.getDisplay(); e.gc.setBackground(getColor(d, fIndicatorColor)); int min= Math.min(s.x, s.y)-2*INSET; Rectangle r= new Rectangle((s.x-min)/2, (s.y-min)/2, min, min); e.gc.fillRectangle(r); if (d != null) drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); e.gc.setForeground(fSeparatorColor); e.gc.setLineWidth(0 /* 1 */); e.gc.drawLine(0+1, s.y-1, s.x-1-1, s.y-1); } } }
public static void drawBoolean(GC gc, boolean value, int x, int y, int size) { Device device = gc.getDevice(); gc.setBackground(device.getSystemColor(value ? SWT.COLOR_GREEN : SWT.COLOR_RED)); gc.fillOval(x, y, size, size); gc.setForeground(device.getSystemColor(SWT.COLOR_WHITE)); gc.setLineWidth(Math.max(1, size / 8)); gc.setLineCap(value ? SWT.CAP_ROUND : SWT.CAP_FLAT); int d = size / 4; int cx = x + size / 2; int cy = y + size / 2; if (value) { gc.drawLine(cx - d, cy, cx-d/4, cy + d); gc.drawLine(cx-d/4, cy + d, cx + d, cy - d); } else { gc.drawLine(cx - d, cy - d, cx + d, cy + d); gc.drawLine(cx - d, cy + d, cx + d, cy - d); } }
@Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { if (gc != null) { if (length < 1) return; Point left= textWidget.getLocationAtOffset(offset); Point right= textWidget.getLocationAtOffset(offset + length); Rectangle rect= textWidget.getTextBounds(offset, offset + length - 1); left.x= rect.x; right.x= rect.x + rect.width; int[] polyline= computePolyline(left, right, textWidget.getBaseline(offset), textWidget.getLineHeight(offset)); gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.setLineStyle(SWT.LINE_SOLID); gc.setForeground(color); gc.drawPolyline(polyline); } else { textWidget.redrawRange(offset, length, true); } }