org.eclipse.swt.widgets.Canvas.getBackground()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.eclipse.swt.widgets.Canvas.getBackground()方法的一些代码示例,展示了Canvas.getBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.getBackground()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Canvas
类名称:Canvas
方法名:getBackground

Canvas.getBackground介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * 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));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * 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));
}

代码示例来源:origin: BiglySoftware/BiglyBT

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);

代码示例来源:origin: org.eclipse/org.eclipse.compare

int w2= w/2;
g.setBackground(canvas.getBackground());
g.fillRectangle(x, 0, w, size.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * 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);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * 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);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

gc.setFont(fCachedTextWidget.getFont());
try {
  gc.setBackground(fCanvas.getBackground());
  gc.fillRectangle(0, 0, size.x, size.y);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

gc.setFont(fCachedTextWidget.getFont());
try {
  gc.setBackground(fCanvas.getBackground());
  gc.fillRectangle(0, 0, size.x, size.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

int w2= w/2;
g.setBackground(canvas.getBackground());
g.fillRectangle(x, 0, w, size.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

gc.setFont(fTextViewer.getTextWidget().getFont());
try {
  gc.setBackground(fCanvas.getBackground());
  gc.fillRectangle(0, 0, size.x, size.y);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

gc.setFont(fTextViewer.getTextWidget().getFont());
try {
  gc.setBackground(fCanvas.getBackground());
  gc.fillRectangle(0, 0, size.x, size.y);

代码示例来源:origin: BiglySoftware/BiglyBT

@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();
        }
      }
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

display.syncExec(() -> canvasBackground = imageCanvas.getBackground());

代码示例来源:origin: org.eclipse/org.eclipse.compare

int w= size.x;
g.setBackground(canvas.getBackground());
g.fillRectangle(x+1, 0, w-2, size.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

int w= size.x;
g.setBackground(canvas.getBackground());
g.fillRectangle(x+1, 0, w-2, size.y);

代码示例来源:origin: BiglySoftware/BiglyBT

gcImg.setBackground(peerInfoCanvas.getBackground());
gcImg.fillRectangle(0, 0, bounds.width, iNeededHeight);

代码示例来源:origin: BiglySoftware/BiglyBT

gcImg.setBackground(fileInfoCanvas.getBackground());
gcImg.fillRectangle(0, 0, bounds.width, bounds.height);

代码示例来源:origin: BiglySoftware/BiglyBT

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);

相关文章

微信公众号

最新文章

更多

Canvas类方法