public void setAlpha( int alpha ) { gc.setAlpha( alpha ); }
public void setAlpha( int alpha ) { gc.setAlpha( alpha ); }
@Override public void setAlpha ( final int alpha ) { this.gc.setAlpha ( alpha ); }
@Override public void setAlpha ( final int alpha ) { this.gc.setAlpha ( alpha ); }
/** * Set the transparency for this graphics context to <code>transparency</code>. * * @param transparency transparency, must be between <code>0.0f</code> and <code>1.0f</code> inclusive */ public void setTransparency(final float transparency) { if ((transparency < 0.0f) || (transparency > 1.0f)) { throw new IllegalArgumentException("transparency must be between 0.0f and 1.0f inclusive"); } this.transparency = transparency; gc.setAlpha((int) (this.transparency * 255.0f)); }
/** * Sets the current composite. This implementation currently supports * only the {@link AlphaComposite} class. * * @param comp the composite ({@code null} not permitted). */ @Override public void setComposite(Composite comp) { if (comp == null) { throw new IllegalArgumentException("Null 'comp' argument."); } this.composite = comp; if (comp instanceof AlphaComposite) { AlphaComposite acomp = (AlphaComposite) comp; int alpha = (int) (acomp.getAlpha() * 0xFF); this.gc.setAlpha(alpha); } }
private void restoreLastSettings( int lineWidth, Color foreground, int alpha ) { gc.setLineWidth( lineWidth ); gc.setForeground( foreground ); gc.setAlpha( alpha ); }
private void drawBar() { if( barColor != null ) { gc.setAlpha( 200 ); gc.setBackground( barColor ); gc.fillRoundRectangle( 1, 1, barWidth, clientArea.height - 2 - 1, ARC_SIZE, ARC_SIZE ); } }
@Override public void renderDynamic(GC gc, ViewPort vp, long time) { adapter.adapt(gc, vp); if (showNodeOccupancy) { for (final Point p : model.getOccupiedNodes()) { gc.setAlpha(SEMI_TRANSPARENT); adapter.setBackgroundSysCol(SWT.COLOR_RED); adapter.fillCircle(p, vehicleLength / 2d + minDistance); gc.setAlpha(OPAQUE); } } }
public void setColor(java.awt.Color color) { if (color.equals(_awt_color)) { return; } Color col = new Color(_gc.getDevice(), color.getRed(), color.getGreen(), color.getBlue()); _gc.setForeground(col); _gc.setBackground(col); _gc.setAlpha(color.getAlpha()); if (_color != null) { _color.dispose(); } _color = col; _awt_color = color; }
@Override public void paintControl(PaintEvent e) { Rectangle client_area = tracker_webseed_comp.getClientArea(); Rectangle rect = new Rectangle(0,0, client_area.width-1, client_area.height-1); e.gc.setAlpha(50); e.gc.drawRectangle(rect); } });
private void drawBorder() { if( ( style & SWT.BORDER ) != 0 ) { int x = clientArea.x; int y = clientArea.y; int width = clientArea.width - 1; int height = clientArea.height - 1 - 1; gc.setAlpha( 255 ); gc.setForeground( getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW ) ); gc.drawRoundRectangle( x, y, width, height, ARC_SIZE, ARC_SIZE ); } }
@Override public void paintControl(PaintEvent e) { if (bufferImage != null && !bufferImage.isDisposed()) { Rectangle bounds = bufferImage.getBounds(); if (bounds.width >= ( e.width + e.x ) && bounds.height >= ( e.height + e.y )) { if (alpha != 255) { try { e.gc.setAlpha(alpha); } catch (Exception ex) { // Ignore ERROR_NO_GRAPHICS_LIBRARY error or any others } } e.gc.drawImage(bufferImage, e.x, e.y, e.width, e.height, e.x, e.y, e.width, e.height); } } } });
@Override public void paintControl(PaintEvent event) { GC gc = event.gc; int clientAreaWidth = fMinimapTextWidget.getClientArea().width; gc.setBackground(fMinimapTextWidget.getSelectionBackground()); Rectangle rect = new Rectangle(0, fTopIndexY, clientAreaWidth, Math.max(fBottomIndexY - fTopIndexY, fMinimalHeight)); gc.drawRectangle(rect.x, rect.y, Math.max(1, rect.width - 1), Math.max(1, rect.height - 1)); gc.setAdvanced(true); if (gc.getAdvanced()) { gc.setAlpha(20); gc.fillRectangle(rect); gc.setAdvanced(false); } }
@Override public void cellPaint(GC gc, TableCellSWT cell) { Object ds = cell.getDataSource(); if (!(ds instanceof TorrentOpenFileOptions)) { return; } TorrentOpenFileOptions tfi = (TorrentOpenFileOptions) ds; float pct = tfi.lSize / (float) tfi.parent.getTorrent().getSize(); Rectangle bounds = cell.getBounds(); bounds.width = (int) (bounds.width * pct); if (bounds.width > 2) { bounds.x++; bounds.y++; bounds.height -= 2; bounds.width -= 2; gc.setBackground(gc.getForeground()); int alpha = gc.getAlpha(); gc.setAlpha(10); gc.fillRectangle(bounds); gc.setAlpha(alpha); } }
private void drawText() { gc.setAlpha( 255 ); Rectangle rect = insideBorderArea(); Point textLocation = getTextLocation( rect ); Color defaultForeground = getSystemColor( SWT.COLOR_WIDGET_FOREGROUND ); drawText( textLocation, defaultForeground, null ); Color barForeground = getBarForegroundColor(); if( !equals( defaultForeground, barForeground ) ) { Rectangle clipping = new Rectangle( rect.x, rect.y, barWidth, rect.height ); drawText( textLocation, barForeground, clipping ); } }
private void setColour( GC gc ) { if ( complete_time != -1 && draw_count > 1 ){ int age = (int)( SystemTime.getMonotonousTime() - complete_time ); gc.setAlpha( Math.max( 0, 200 - (255*age/FADE_OUT))); gc.setForeground( ColorCache.getColor( gc.getDevice(), 0, 0, 0 )); }else{ gc.setAlpha( 255 ); int type = activity.getType(); if ( type == DHTControlActivity.AT_EXTERNAL_GET ){ gc.setForeground( ColorCache.getColor( gc.getDevice(), 20, 200, 20 )); }else if ( type == DHTControlActivity.AT_INTERNAL_GET ){ gc.setForeground( ColorCache.getColor( gc.getDevice(), 140, 160, 40 )); }else if ( type == DHTControlActivity.AT_EXTERNAL_PUT ){ gc.setForeground( ColorCache.getColor( gc.getDevice(), 20, 20, 220 )); }else{ gc.setForeground( ColorCache.getColor( gc.getDevice(), 40, 140, 160 )); } } } }
private void dispatchSetForeground( JsonArray parameters ) { int r = parameters.get( 0 ).asInt(); int g = parameters.get( 1 ).asInt(); int b = parameters.get( 2 ).asInt(); int a = parameters.get( 3 ).asInt(); gc.setForeground( new Color( gc.getDevice(), new RGB( r, g, b ) ) ); gc.setAlpha( a ); }
void drawCorners(GC gc, Rectangle bounds) { Color bg = gc.getBackground(); Color fg = gc.getForeground(); Color toFill = parent.getParent().getBackground(); gc.setAlpha(255); gc.setBackground(toFill); gc.setForeground(toFill); int radius = cornerSize / 2 + 1; int leftX = bounds.x - 1; int topY = bounds.y - 1; int rightX = bounds.x + bounds.width; int bottomY = bounds.y + bounds.height; drawCutout(gc, leftX, topY, radius, CirclePart.LEFT_TOP); drawCutout(gc, rightX, topY, radius, CirclePart.RIGHT_TOP); drawCutout(gc, leftX, bottomY, radius, CirclePart.LEFT_BOTTOM); drawCutout(gc, rightX, bottomY, radius, CirclePart.RIGHT_BOTTOM); gc.setBackground(bg); gc.setForeground(fg); }