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

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

本文整理了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

  1. /**
  2. * Returns a color based on the color configured for the given annotation type and the given scale factor.
  3. *
  4. * @param annotationType the annotation type
  5. * @param scale the scale factor
  6. * @return the computed color
  7. */
  8. private Color getColor(Object annotationType, double scale) {
  9. Color base= findColor(annotationType);
  10. if (base == null)
  11. return null;
  12. RGB baseRGB= base.getRGB();
  13. RGB background= fCanvas.getBackground().getRGB();
  14. boolean darkBase= isDark(baseRGB);
  15. boolean darkBackground= isDark(background);
  16. if (darkBase && darkBackground)
  17. background= new RGB(255, 255, 255);
  18. else if (!darkBase && !darkBackground)
  19. background= new RGB(0, 0, 0);
  20. return fSharedTextColors.getColor(interpolate(baseRGB, background, scale));
  21. }

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

  1. /**
  2. * Returns a color based on the color configured for the given annotation type and the given scale factor.
  3. *
  4. * @param annotationType the annotation type
  5. * @param scale the scale factor
  6. * @return the computed color
  7. */
  8. private Color getColor(Object annotationType, double scale) {
  9. Color base= findColor(annotationType);
  10. if (base == null)
  11. return null;
  12. RGB baseRGB= base.getRGB();
  13. RGB background= fCanvas.getBackground().getRGB();
  14. boolean darkBase= isDark(baseRGB);
  15. boolean darkBackground= isDark(background);
  16. if (darkBase && darkBackground)
  17. background= new RGB(255, 255, 255);
  18. else if (!darkBase && !darkBackground)
  19. background= new RGB(0, 0, 0);
  20. return fSharedTextColors.getColor(interpolate(baseRGB, background, scale));
  21. }

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

  1. gc.setBackground(canvas.getBackground());
  2. gc.fillRectangle(imgHaveAll.getBounds());
  3. gc.setBackground(canvas.getBackground());
  4. gc.fillRectangle(imgNoHave.getBounds());
  5. int iRow = 0;
  6. if (clearImage) {
  7. gc.setBackground(canvas.getBackground());
  8. gc.fillRectangle(bounds);

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

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

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

  1. /**
  2. * Double buffer drawing.
  3. *
  4. * @param dest the GC to draw into
  5. */
  6. private void doubleBufferPaint(GC dest) {
  7. Point size= fCanvas.getSize();
  8. if (size.x <= 0 || size.y <= 0)
  9. return;
  10. if (fBuffer != null) {
  11. Rectangle r= fBuffer.getBounds();
  12. if (r.width != size.x || r.height != size.y) {
  13. fBuffer.dispose();
  14. fBuffer= null;
  15. }
  16. }
  17. if (fBuffer == null)
  18. fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  19. GC gc= new GC(fBuffer);
  20. try {
  21. gc.setBackground(fCanvas.getBackground());
  22. gc.fillRectangle(0, 0, size.x, size.y);
  23. cacheAnnotations();
  24. doPaint(gc);
  25. } finally {
  26. gc.dispose();
  27. }
  28. dest.drawImage(fBuffer, 0, 0);
  29. }

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

  1. /**
  2. * Double buffer drawing.
  3. *
  4. * @param dest the GC to draw into
  5. */
  6. private void doubleBufferPaint(GC dest) {
  7. Point size= fCanvas.getSize();
  8. if (size.x <= 0 || size.y <= 0)
  9. return;
  10. if (fBuffer != null) {
  11. Rectangle r= fBuffer.getBounds();
  12. if (r.width != size.x || r.height != size.y) {
  13. fBuffer.dispose();
  14. fBuffer= null;
  15. }
  16. }
  17. if (fBuffer == null)
  18. fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  19. GC gc= new GC(fBuffer);
  20. try {
  21. gc.setBackground(fCanvas.getBackground());
  22. gc.fillRectangle(0, 0, size.x, size.y);
  23. cacheAnnotations();
  24. doPaint(gc);
  25. } finally {
  26. gc.dispose();
  27. }
  28. dest.drawImage(fBuffer, 0, 0);
  29. }

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public void run() {
  3. if(!canvas.isDisposed() && images != null) {
  4. currentImage++;
  5. if(currentImage >= images.length) {
  6. currentImage = 0;
  7. }
  8. if(currentImage < images.length) {
  9. Image image = images[currentImage];
  10. if(image != null && !image.isDisposed()) {
  11. Rectangle imageBounds = image.getBounds();
  12. Image tempImage = new Image(canvas.getDisplay(),new Rectangle( 0, 0, imageBounds.width, imageBounds.height ));
  13. GC gcImage = new GC(tempImage);
  14. gcImage.setBackground( canvas.getBackground());
  15. gcImage.fillRectangle( new Rectangle( 0, 0, imageBounds.width, imageBounds.width ));
  16. gcImage.drawImage(image, 0, 0 );
  17. GC gc = new GC(canvas);
  18. Point canvasSize = canvas.getSize();
  19. gc.drawImage( tempImage, (canvasSize.x-imageBounds.width)/2, (canvasSize.y-imageBounds.height)/2);
  20. tempImage.dispose();
  21. gcImage.dispose();
  22. gc.dispose();
  23. }
  24. }
  25. }
  26. }
  27. });

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

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

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

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

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

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

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

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

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

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

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

  1. gcImg.setBackground(pieceInfoCanvas.getBackground());
  2. gcImg.fillRectangle(0, 0, bounds.width, iNeededHeight);
  3. gcImg.setBackground(pieceInfoCanvas.getBackground());
  4. gcImg.fillRectangle(iCol * BLOCK_SIZE, iRow * BLOCK_SIZE, BLOCK_SIZE,
  5. BLOCK_SIZE);

相关文章

Canvas类方法