/** * Returns a color based on the color configured for the given annotation type and the given scale factor. * * @param annotationType the annotation type * @param scale the scale factor * @return the computed color */ private Color getColor(Object annotationType, double scale) { Color base= findColor(annotationType); if (base == null) return null; RGB baseRGB= base.getRGB(); RGB background= fCanvas.getBackground().getRGB(); boolean darkBase= isDark(baseRGB); boolean darkBackground= isDark(background); if (darkBase && darkBackground) background= new RGB(255, 255, 255); else if (!darkBase && !darkBackground) background= new RGB(0, 0, 0); return fSharedTextColors.getColor(interpolate(baseRGB, background, scale)); }
/** * Returns a color based on the color configured for the given annotation type and the given scale factor. * * @param annotationType the annotation type * @param scale the scale factor * @return the computed color */ private Color getColor(Object annotationType, double scale) { Color base= findColor(annotationType); if (base == null) return null; RGB baseRGB= base.getRGB(); RGB background= fCanvas.getBackground().getRGB(); boolean darkBase= isDark(baseRGB); boolean darkBackground= isDark(background); if (darkBase && darkBackground) background= new RGB(255, 255, 255); else if (!darkBase && !darkBackground) background= new RGB(0, 0, 0); return fSharedTextColors.getColor(interpolate(baseRGB, background, scale)); }
gc.setBackground(canvas.getBackground()); gc.fillRectangle(imgHaveAll.getBounds()); gc.setBackground(canvas.getBackground()); gc.fillRectangle(imgNoHave.getBounds()); int iRow = 0; if (clearImage) { gc.setBackground(canvas.getBackground()); gc.fillRectangle(bounds);
int w2= w/2; g.setBackground(canvas.getBackground()); g.fillRectangle(x, 0, w, size.y);
/** * Double buffer drawing. * * @param dest the GC to draw into */ private void doubleBufferPaint(GC dest) { Point size= fCanvas.getSize(); if (size.x <= 0 || size.y <= 0) return; if (fBuffer != null) { Rectangle r= fBuffer.getBounds(); if (r.width != size.x || r.height != size.y) { fBuffer.dispose(); fBuffer= null; } } if (fBuffer == null) fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); GC gc= new GC(fBuffer); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y); cacheAnnotations(); doPaint(gc); } finally { gc.dispose(); } dest.drawImage(fBuffer, 0, 0); }
/** * Double buffer drawing. * * @param dest the GC to draw into */ private void doubleBufferPaint(GC dest) { Point size= fCanvas.getSize(); if (size.x <= 0 || size.y <= 0) return; if (fBuffer != null) { Rectangle r= fBuffer.getBounds(); if (r.width != size.x || r.height != size.y) { fBuffer.dispose(); fBuffer= null; } } if (fBuffer == null) fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); GC gc= new GC(fBuffer); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y); cacheAnnotations(); doPaint(gc); } finally { gc.dispose(); } dest.drawImage(fBuffer, 0, 0); }
gc.setFont(fCachedTextWidget.getFont()); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y);
gc.setFont(fCachedTextWidget.getFont()); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y);
int w2= w/2; g.setBackground(canvas.getBackground()); g.fillRectangle(x, 0, w, size.y);
gc.setFont(fTextViewer.getTextWidget().getFont()); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y);
gc.setFont(fTextViewer.getTextWidget().getFont()); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y);
@Override public void run() { if(!canvas.isDisposed() && images != null) { currentImage++; if(currentImage >= images.length) { currentImage = 0; } if(currentImage < images.length) { Image image = images[currentImage]; if(image != null && !image.isDisposed()) { Rectangle imageBounds = image.getBounds(); Image tempImage = new Image(canvas.getDisplay(),new Rectangle( 0, 0, imageBounds.width, imageBounds.height )); GC gcImage = new GC(tempImage); gcImage.setBackground( canvas.getBackground()); gcImage.fillRectangle( new Rectangle( 0, 0, imageBounds.width, imageBounds.width )); gcImage.drawImage(image, 0, 0 ); GC gc = new GC(canvas); Point canvasSize = canvas.getSize(); gc.drawImage( tempImage, (canvasSize.x-imageBounds.width)/2, (canvasSize.y-imageBounds.height)/2); tempImage.dispose(); gcImage.dispose(); gc.dispose(); } } } } });
display.syncExec(() -> canvasBackground = imageCanvas.getBackground());
int w= size.x; g.setBackground(canvas.getBackground()); g.fillRectangle(x+1, 0, w-2, size.y);
int w= size.x; g.setBackground(canvas.getBackground()); g.fillRectangle(x+1, 0, w-2, size.y);
gcImg.setBackground(peerInfoCanvas.getBackground()); gcImg.fillRectangle(0, 0, bounds.width, iNeededHeight);
gcImg.setBackground(fileInfoCanvas.getBackground()); gcImg.fillRectangle(0, 0, bounds.width, bounds.height);
gcImg.setBackground(pieceInfoCanvas.getBackground()); gcImg.fillRectangle(0, 0, bounds.width, iNeededHeight); gcImg.setBackground(pieceInfoCanvas.getBackground()); gcImg.fillRectangle(iCol * BLOCK_SIZE, iRow * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);